{"action":"created","comment":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/44147764","id":44147764,"diff_hunk":"@@ -718,16 +718,28 @@ def retrieveBlocks(self):\n                 updateBlocksDAO.execute(blocks = loadedBlocks,\n                                         conn = myThread.transaction.conn,\n                                         transaction = True)\n-            except WMException:\n-                myThread.transaction.rollback()\n-                raise\n             except Exception as ex:\n                 myThread.transaction.rollback()\n-                msg =  \"Unhandled exception while finished closed blocks in DBSBuffer\\n\"\n-                msg += str(ex)\n-                logging.error(msg)\n-                logging.debug(\"Blocks for Update: %s\\n\" % loadedBlocks)\n-                raise DBSUploadException(msg)\n+                # possible deadlock with PhEDExInjector, retry once after 10s\n+                time.sleep(10)\n+                try:\n+                    myThread.transaction.begin()\n+                    updateFilesDAO.execute(blocks = loadedBlocks, status = \"InDBS\",\n+                                           conn = myThread.transaction.conn,\n+                                           transaction = True)\n+                    updateBlocksDAO.execute(blocks = loadedBlocks,\n+                                            conn = myThread.transaction.conn,\n+                                            transaction = True)\n+                except Exception as ex:\n+                    myThread.transaction.rollback()\n+                    msg =  \"Unhandled exception while finished closed blocks in DBSBuffer\\n\"\n+                    msg += str(ex)\n+                    logging.error(msg)\n+                    logging.debug(\"Blocks for Update: %s\\n\", loadedBlocks)\n+                    raise DBSUploadException(msg)\n+                else:\n+                    myThread.transaction.commit()","path":"src/python/WMComponent/DBS3Buffer/DBSUploadPoller.py","position":169,"original_position":169,"commit_id":"580d50abab6b3bbcbf29a5a0f3e93f28ddd8736d","original_commit_id":"580d50abab6b3bbcbf29a5a0f3e93f28ddd8736d","user":{"login":"amaltaro","id":1798520,"avatar_url":"https://avatars.githubusercontent.com/u/1798520?v=3","gravatar_id":"","url":"https://api.github.com/users/amaltaro","html_url":"https://github.com/amaltaro","followers_url":"https://api.github.com/users/amaltaro/followers","following_url":"https://api.github.com/users/amaltaro/following{/other_user}","gists_url":"https://api.github.com/users/amaltaro/gists{/gist_id}","starred_url":"https://api.github.com/users/amaltaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amaltaro/subscriptions","organizations_url":"https://api.github.com/users/amaltaro/orgs","repos_url":"https://api.github.com/users/amaltaro/repos","events_url":"https://api.github.com/users/amaltaro/events{/privacy}","received_events_url":"https://api.github.com/users/amaltaro/received_events","type":"User","site_admin":false},"body":"Arguable :-) I'm all in favor of avoiding duplicate code as much as possible (even 2 lines only).","created_at":"2015-11-06T15:25:47Z","updated_at":"2015-11-06T15:25:47Z","html_url":"https://github.com/dmwm/WMCore/pull/6383#discussion_r44147764","pull_request_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6383","_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments/44147764"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6383#discussion_r44147764"},"pull_request":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6383"}}},"pull_request":{"url":"https://api.github.com/repos/dmwm/WMCore/pulls/6383","id":49820436,"html_url":"https://github.com/dmwm/WMCore/pull/6383","diff_url":"https://github.com/dmwm/WMCore/pull/6383.diff","patch_url":"https://github.com/dmwm/WMCore/pull/6383.patch","issue_url":"https://api.github.com/repos/dmwm/WMCore/issues/6383","number":6383,"state":"open","locked":false,"title":"dbsbuffer changes to work around race condition between dbs and phedex updates","user":{"login":"hufnagel","id":1798355,"avatar_url":"https://avatars.githubusercontent.com/u/1798355?v=3","gravatar_id":"","url":"https://api.github.com/users/hufnagel","html_url":"https://github.com/hufnagel","followers_url":"https://api.github.com/users/hufnagel/followers","following_url":"https://api.github.com/users/hufnagel/following{/other_user}","gists_url":"https://api.github.com/users/hufnagel/gists{/gist_id}","starred_url":"https://api.github.com/users/hufnagel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hufnagel/subscriptions","organizations_url":"https://api.github.com/users/hufnagel/orgs","repos_url":"https://api.github.com/users/hufnagel/repos","events_url":"https://api.github.com/users/hufnagel/events{/privacy}","received_events_url":"https://api.github.com/users/hufnagel/received_events","type":"User","site_admin":false},"body":"Both PhEDExInjector and DBS3Buffer components update dbsbuffer_file records. They do it in a way that the two updates can deadlock each other. General slow performance of dbsbuffer related code makes this quite likely to happen, therefor rework and simplify the schema (add some indexes, remove triggers, general cleanup).\r\n\r\nNo functional changes and the cleanup and indexes are only done on Oracle for now as some of it is very Oracle specific. We could sync the MySQL version later if so desired.\r\n\r\nAlso put in recovery logic to at least retry once in each component if deadlock occurs.","created_at":"2015-11-05T12:57:25Z","updated_at":"2015-11-06T15:25:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68969864b223564a67d6974781ec2701e16d4fac","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6383/commits","review_comments_url":"https://api.github.com/repos/dmwm/WMCore/pulls/6383/comments","review_comment_url":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmwm/WMCore/issues/6383/comments","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/580d50abab6b3bbcbf29a5a0f3e93f28ddd8736d","head":{"label":"hufnagel:dbs_phedex_deadlock","ref":"dbs_phedex_deadlock","sha":"580d50abab6b3bbcbf29a5a0f3e93f28ddd8736d","user":{"login":"hufnagel","id":1798355,"avatar_url":"https://avatars.githubusercontent.com/u/1798355?v=3","gravatar_id":"","url":"https://api.github.com/users/hufnagel","html_url":"https://github.com/hufnagel","followers_url":"https://api.github.com/users/hufnagel/followers","following_url":"https://api.github.com/users/hufnagel/following{/other_user}","gists_url":"https://api.github.com/users/hufnagel/gists{/gist_id}","starred_url":"https://api.github.com/users/hufnagel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hufnagel/subscriptions","organizations_url":"https://api.github.com/users/hufnagel/orgs","repos_url":"https://api.github.com/users/hufnagel/repos","events_url":"https://api.github.com/users/hufnagel/events{/privacy}","received_events_url":"https://api.github.com/users/hufnagel/received_events","type":"User","site_admin":false},"repo":{"id":5087540,"name":"WMCore","full_name":"hufnagel/WMCore","owner":{"login":"hufnagel","id":1798355,"avatar_url":"https://avatars.githubusercontent.com/u/1798355?v=3","gravatar_id":"","url":"https://api.github.com/users/hufnagel","html_url":"https://github.com/hufnagel","followers_url":"https://api.github.com/users/hufnagel/followers","following_url":"https://api.github.com/users/hufnagel/following{/other_user}","gists_url":"https://api.github.com/users/hufnagel/gists{/gist_id}","starred_url":"https://api.github.com/users/hufnagel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hufnagel/subscriptions","organizations_url":"https://api.github.com/users/hufnagel/orgs","repos_url":"https://api.github.com/users/hufnagel/repos","events_url":"https://api.github.com/users/hufnagel/events{/privacy}","received_events_url":"https://api.github.com/users/hufnagel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hufnagel/WMCore","description":"WMCore","fork":true,"url":"https://api.github.com/repos/hufnagel/WMCore","forks_url":"https://api.github.com/repos/hufnagel/WMCore/forks","keys_url":"https://api.github.com/repos/hufnagel/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hufnagel/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hufnagel/WMCore/teams","hooks_url":"https://api.github.com/repos/hufnagel/WMCore/hooks","issue_events_url":"https://api.github.com/repos/hufnagel/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/hufnagel/WMCore/events","assignees_url":"https://api.github.com/repos/hufnagel/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/hufnagel/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/hufnagel/WMCore/tags","blobs_url":"https://api.github.com/repos/hufnagel/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hufnagel/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hufnagel/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/hufnagel/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hufnagel/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/hufnagel/WMCore/languages","stargazers_url":"https://api.github.com/repos/hufnagel/WMCore/stargazers","contributors_url":"https://api.github.com/repos/hufnagel/WMCore/contributors","subscribers_url":"https://api.github.com/repos/hufnagel/WMCore/subscribers","subscription_url":"https://api.github.com/repos/hufnagel/WMCore/subscription","commits_url":"https://api.github.com/repos/hufnagel/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/hufnagel/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/hufnagel/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/hufnagel/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/hufnagel/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/hufnagel/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hufnagel/WMCore/merges","archive_url":"https://api.github.com/repos/hufnagel/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hufnagel/WMCore/downloads","issues_url":"https://api.github.com/repos/hufnagel/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/hufnagel/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/hufnagel/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/hufnagel/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hufnagel/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/hufnagel/WMCore/releases{/id}","created_at":"2012-07-17T20:23:34Z","updated_at":"2015-05-07T20:25:46Z","pushed_at":"2015-11-05T15:23:52Z","git_url":"git://github.com/hufnagel/WMCore.git","ssh_url":"git@github.com:hufnagel/WMCore.git","clone_url":"https://github.com/hufnagel/WMCore.git","svn_url":"https://github.com/hufnagel/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":24918,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dmwm:master","ref":"master","sha":"f9f6b4beec5dfbebf99f86ed23b10c2b0422ce48","user":{"login":"dmwm","id":988897,"avatar_url":"https://avatars.githubusercontent.com/u/988897?v=3","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"repo":{"id":2370458,"name":"WMCore","full_name":"dmwm/WMCore","owner":{"login":"dmwm","id":988897,"avatar_url":"https://avatars.githubusercontent.com/u/988897?v=3","gravatar_id":"","url":"https://api.github.com/users/dmwm","html_url":"https://github.com/dmwm","followers_url":"https://api.github.com/users/dmwm/followers","following_url":"https://api.github.com/users/dmwm/following{/other_user}","gists_url":"https://api.github.com/users/dmwm/gists{/gist_id}","starred_url":"https://api.github.com/users/dmwm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmwm/subscriptions","organizations_url":"https://api.github.com/users/dmwm/orgs","repos_url":"https://api.github.com/users/dmwm/repos","events_url":"https://api.github.com/users/dmwm/events{/privacy}","received_events_url":"https://api.github.com/users/dmwm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmwm/WMCore","description":"WMCore","fork":false,"url":"https://api.github.com/repos/dmwm/WMCore","forks_url":"https://api.github.com/repos/dmwm/WMCore/forks","keys_url":"https://api.github.com/repos/dmwm/WMCore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmwm/WMCore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmwm/WMCore/teams","hooks_url":"https://api.github.com/repos/dmwm/WMCore/hooks","issue_events_url":"https://api.github.com/repos/dmwm/WMCore/issues/events{/number}","events_url":"https://api.github.com/repos/dmwm/WMCore/events","assignees_url":"https://api.github.com/repos/dmwm/WMCore/assignees{/user}","branches_url":"https://api.github.com/repos/dmwm/WMCore/branches{/branch}","tags_url":"https://api.github.com/repos/dmwm/WMCore/tags","blobs_url":"https://api.github.com/repos/dmwm/WMCore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmwm/WMCore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmwm/WMCore/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmwm/WMCore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmwm/WMCore/statuses/{sha}","languages_url":"https://api.github.com/repos/dmwm/WMCore/languages","stargazers_url":"https://api.github.com/repos/dmwm/WMCore/stargazers","contributors_url":"https://api.github.com/repos/dmwm/WMCore/contributors","subscribers_url":"https://api.github.com/repos/dmwm/WMCore/subscribers","subscription_url":"https://api.github.com/repos/dmwm/WMCore/subscription","commits_url":"https://api.github.com/repos/dmwm/WMCore/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmwm/WMCore/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmwm/WMCore/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmwm/WMCore/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmwm/WMCore/contents/{+path}","compare_url":"https://api.github.com/repos/dmwm/WMCore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmwm/WMCore/merges","archive_url":"https://api.github.com/repos/dmwm/WMCore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmwm/WMCore/downloads","issues_url":"https://api.github.com/repos/dmwm/WMCore/issues{/number}","pulls_url":"https://api.github.com/repos/dmwm/WMCore/pulls{/number}","milestones_url":"https://api.github.com/repos/dmwm/WMCore/milestones{/number}","notifications_url":"https://api.github.com/repos/dmwm/WMCore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmwm/WMCore/labels{/name}","releases_url":"https://api.github.com/repos/dmwm/WMCore/releases{/id}","created_at":"2011-09-12T10:37:21Z","updated_at":"2015-05-08T18:42:10Z","pushed_at":"2015-11-06T14:20:23Z","git_url":"git://github.com/dmwm/WMCore.git","ssh_url":"git@github.com:dmwm/WMCore.git","clone_url":"https://github.com/dmwm/WMCore.git","svn_url":"https://github.com/dmwm/WMCore","homepage":"https://svnweb.cern.ch/trac/CMSDMWM/","size":65482,"stargazers_count":24,"watchers_count":24,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":312,"forks":49,"open_issues":312,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6383"},"html":{"href":"https://github.com/dmwm/WMCore/pull/6383"},"issue":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6383"},"comments":{"href":"https://api.github.com/repos/dmwm/WMCore/issues/6383/comments"},"review_comments":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6383/comments"},"review_comment":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmwm/WMCore/pulls/6383/commits"},"statuses":{"href":"https://api.github.com/repos/dmwm/WMCore/statuses/580d50abab6b3bbcbf29a5a0f3e93f28ddd8736d"}}}}