{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/core/pulls/comments/39973688","id":39973688,"diff_hunk":"@@ -122,19 +136,20 @@ public function acquireLock($path, $type) {\n \t * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE\n \t */\n \tpublic function releaseLock($path, $type) {\n-\t\t$this->initLockField($path);\n \t\tif ($type === self::LOCK_SHARED) {\n-\t\t\t$this->connection->executeUpdate(\n+\t\t\t$result = $this->connection->executeUpdate(\n \t\t\t\t'UPDATE `*PREFIX*file_locks` SET `lock` = `lock` - 1 WHERE `key` = ? AND `lock` > 0',\n \t\t\t\t[$path]\n \t\t\t);\n \t\t} else {\n-\t\t\t$this->connection->executeUpdate(\n+\t\t\t$result = $this->connection->executeUpdate(\n \t\t\t\t'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = -1',\n \t\t\t\t[$path]\n \t\t\t);\n \t\t}\n-\n+\t\tif ($result !== 1) {","path":"lib/private/lock/dblockingprovider.php","position":75,"original_position":75,"commit_id":"dfb6e7ccafe1976e24a8a7cbb33ef1298ad33083","original_commit_id":"dfb6e7ccafe1976e24a8a7cbb33ef1298ad33083","user":{"login":"icewind1991","id":1283854,"avatar_url":"https://avatars.githubusercontent.com/u/1283854?v=3","gravatar_id":"","url":"https://api.github.com/users/icewind1991","html_url":"https://github.com/icewind1991","followers_url":"https://api.github.com/users/icewind1991/followers","following_url":"https://api.github.com/users/icewind1991/following{/other_user}","gists_url":"https://api.github.com/users/icewind1991/gists{/gist_id}","starred_url":"https://api.github.com/users/icewind1991/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icewind1991/subscriptions","organizations_url":"https://api.github.com/users/icewind1991/orgs","repos_url":"https://api.github.com/users/icewind1991/repos","events_url":"https://api.github.com/users/icewind1991/events{/privacy}","received_events_url":"https://api.github.com/users/icewind1991/received_events","type":"User","site_admin":false},"body":"The problem is differentiating \"lock could not be released\" from \"file was never locked in the first place\", for now don't have it throwing an exception since that's the current behavior","created_at":"2015-09-21T14:05:51Z","updated_at":"2015-09-21T14:05:51Z","html_url":"https://github.com/owncloud/core/pull/18993#discussion_r39973688","pull_request_url":"https://api.github.com/repos/owncloud/core/pulls/18993","_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments/39973688"},"html":{"href":"https://github.com/owncloud/core/pull/18993#discussion_r39973688"},"pull_request":{"href":"https://api.github.com/repos/owncloud/core/pulls/18993"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/18993","id":44872065,"html_url":"https://github.com/owncloud/core/pull/18993","diff_url":"https://github.com/owncloud/core/pull/18993.diff","patch_url":"https://github.com/owncloud/core/pull/18993.patch","issue_url":"https://api.github.com/repos/owncloud/core/issues/18993","number":18993,"state":"open","locked":false,"title":"reduce amount of db calls needed for file-locks","user":{"login":"individual-it","id":2425577,"avatar_url":"https://avatars.githubusercontent.com/u/2425577?v=3","gravatar_id":"","url":"https://api.github.com/users/individual-it","html_url":"https://github.com/individual-it","followers_url":"https://api.github.com/users/individual-it/followers","following_url":"https://api.github.com/users/individual-it/following{/other_user}","gists_url":"https://api.github.com/users/individual-it/gists{/gist_id}","starred_url":"https://api.github.com/users/individual-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/individual-it/subscriptions","organizations_url":"https://api.github.com/users/individual-it/orgs","repos_url":"https://api.github.com/users/individual-it/repos","events_url":"https://api.github.com/users/individual-it/events{/privacy}","received_events_url":"https://api.github.com/users/individual-it/received_events","type":"User","site_admin":false},"body":"locking functions in dblockingprovider.php need 2 DB calls for a locking operation:\r\n1. initLockField inserts a row into the table if it does not exist yet\r\n2. then the \"lock\" field get updated to the correct value\r\n\r\nI suggest to set the \"lock\" field to the correct value already in initLockField. Every time there is no row yet for that file the time for the SQL UPDATE would be saved.","created_at":"2015-09-13T12:33:05Z","updated_at":"2015-09-21T14:05:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09f7f8eaab09fd191a86b010e6b7c525c8bb56cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/owncloud/core/pulls/18993/commits","review_comments_url":"https://api.github.com/repos/owncloud/core/pulls/18993/comments","review_comment_url":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/core/issues/18993/comments","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/dfb6e7ccafe1976e24a8a7cbb33ef1298ad33083","head":{"label":"individual-it:reduce_db_calls_for_filelocks","ref":"reduce_db_calls_for_filelocks","sha":"dfb6e7ccafe1976e24a8a7cbb33ef1298ad33083","user":{"login":"individual-it","id":2425577,"avatar_url":"https://avatars.githubusercontent.com/u/2425577?v=3","gravatar_id":"","url":"https://api.github.com/users/individual-it","html_url":"https://github.com/individual-it","followers_url":"https://api.github.com/users/individual-it/followers","following_url":"https://api.github.com/users/individual-it/following{/other_user}","gists_url":"https://api.github.com/users/individual-it/gists{/gist_id}","starred_url":"https://api.github.com/users/individual-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/individual-it/subscriptions","organizations_url":"https://api.github.com/users/individual-it/orgs","repos_url":"https://api.github.com/users/individual-it/repos","events_url":"https://api.github.com/users/individual-it/events{/privacy}","received_events_url":"https://api.github.com/users/individual-it/received_events","type":"User","site_admin":false},"repo":{"id":41785026,"name":"core","full_name":"individual-it/core","owner":{"login":"individual-it","id":2425577,"avatar_url":"https://avatars.githubusercontent.com/u/2425577?v=3","gravatar_id":"","url":"https://api.github.com/users/individual-it","html_url":"https://github.com/individual-it","followers_url":"https://api.github.com/users/individual-it/followers","following_url":"https://api.github.com/users/individual-it/following{/other_user}","gists_url":"https://api.github.com/users/individual-it/gists{/gist_id}","starred_url":"https://api.github.com/users/individual-it/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/individual-it/subscriptions","organizations_url":"https://api.github.com/users/individual-it/orgs","repos_url":"https://api.github.com/users/individual-it/repos","events_url":"https://api.github.com/users/individual-it/events{/privacy}","received_events_url":"https://api.github.com/users/individual-it/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/individual-it/core","description":"The ownCloud core","fork":true,"url":"https://api.github.com/repos/individual-it/core","forks_url":"https://api.github.com/repos/individual-it/core/forks","keys_url":"https://api.github.com/repos/individual-it/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/individual-it/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/individual-it/core/teams","hooks_url":"https://api.github.com/repos/individual-it/core/hooks","issue_events_url":"https://api.github.com/repos/individual-it/core/issues/events{/number}","events_url":"https://api.github.com/repos/individual-it/core/events","assignees_url":"https://api.github.com/repos/individual-it/core/assignees{/user}","branches_url":"https://api.github.com/repos/individual-it/core/branches{/branch}","tags_url":"https://api.github.com/repos/individual-it/core/tags","blobs_url":"https://api.github.com/repos/individual-it/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/individual-it/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/individual-it/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/individual-it/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/individual-it/core/statuses/{sha}","languages_url":"https://api.github.com/repos/individual-it/core/languages","stargazers_url":"https://api.github.com/repos/individual-it/core/stargazers","contributors_url":"https://api.github.com/repos/individual-it/core/contributors","subscribers_url":"https://api.github.com/repos/individual-it/core/subscribers","subscription_url":"https://api.github.com/repos/individual-it/core/subscription","commits_url":"https://api.github.com/repos/individual-it/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/individual-it/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/individual-it/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/individual-it/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/individual-it/core/contents/{+path}","compare_url":"https://api.github.com/repos/individual-it/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/individual-it/core/merges","archive_url":"https://api.github.com/repos/individual-it/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/individual-it/core/downloads","issues_url":"https://api.github.com/repos/individual-it/core/issues{/number}","pulls_url":"https://api.github.com/repos/individual-it/core/pulls{/number}","milestones_url":"https://api.github.com/repos/individual-it/core/milestones{/number}","notifications_url":"https://api.github.com/repos/individual-it/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/individual-it/core/labels{/name}","releases_url":"https://api.github.com/repos/individual-it/core/releases{/id}","created_at":"2015-09-02T06:50:11Z","updated_at":"2015-09-02T06:50:23Z","pushed_at":"2015-09-21T13:42:00Z","git_url":"git://github.com/individual-it/core.git","ssh_url":"git@github.com:individual-it/core.git","clone_url":"https://github.com/individual-it/core.git","svn_url":"https://github.com/individual-it/core","homepage":"https://owncloud.org/","size":183456,"stargazers_count":0,"watchers_count":0,"language":"PHP","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":"owncloud:master","ref":"master","sha":"c433d48d8e4b6dd1392a25170dff173852544fcf","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550552,"name":"core","full_name":"owncloud/core","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/core","description":"The ownCloud core","fork":false,"url":"https://api.github.com/repos/owncloud/core","forks_url":"https://api.github.com/repos/owncloud/core/forks","keys_url":"https://api.github.com/repos/owncloud/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/core/teams","hooks_url":"https://api.github.com/repos/owncloud/core/hooks","issue_events_url":"https://api.github.com/repos/owncloud/core/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/core/events","assignees_url":"https://api.github.com/repos/owncloud/core/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/core/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/core/tags","blobs_url":"https://api.github.com/repos/owncloud/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/core/languages","stargazers_url":"https://api.github.com/repos/owncloud/core/stargazers","contributors_url":"https://api.github.com/repos/owncloud/core/contributors","subscribers_url":"https://api.github.com/repos/owncloud/core/subscribers","subscription_url":"https://api.github.com/repos/owncloud/core/subscription","commits_url":"https://api.github.com/repos/owncloud/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/core/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/core/merges","archive_url":"https://api.github.com/repos/owncloud/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/core/downloads","issues_url":"https://api.github.com/repos/owncloud/core/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/core/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/core/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/core/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/core/releases{/id}","created_at":"2012-08-25T10:32:48Z","updated_at":"2015-09-21T13:59:12Z","pushed_at":"2015-09-21T13:51:06Z","git_url":"git://github.com/owncloud/core.git","ssh_url":"git@github.com:owncloud/core.git","clone_url":"https://github.com/owncloud/core.git","svn_url":"https://github.com/owncloud/core","homepage":"https://owncloud.org/","size":1133298,"stargazers_count":3667,"watchers_count":3667,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1165,"mirror_url":null,"open_issues_count":1976,"forks":1165,"open_issues":1976,"watchers":3667,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/18993"},"html":{"href":"https://github.com/owncloud/core/pull/18993"},"issue":{"href":"https://api.github.com/repos/owncloud/core/issues/18993"},"comments":{"href":"https://api.github.com/repos/owncloud/core/issues/18993/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/core/pulls/18993/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/core/pulls/18993/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/core/statuses/dfb6e7ccafe1976e24a8a7cbb33ef1298ad33083"}}}}