{"action":"created","comment":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/79525151","id":79525151,"diff_hunk":"@@ -0,0 +1,76 @@\n+// Copyright 2016 The Cockroach Authors.\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n+// implied. See the License for the specific language governing\n+// permissions and limitations under the License.\n+//\n+// Author: Nathan VanBenschoten (nvanbenschoten@gmail.com)\n+\n+package syncutil\n+\n+import \"sync/atomic\"\n+\n+// Once is an object that will perform exactly one action.\n+//\n+// This object behaves the same as sync.Once from the standard library, except\n+// that it holds a reference to a Mutex instead of holding the Mutex by value.\n+// This means that it can be used in conjunction with external synchronization\n+// that uses the same Mutex.\n+type Once struct {\n+\tm    *Mutex\n+\tdone uint32\n+}\n+\n+// SetMutex sets the mutex that the Once object should use for synchronization.\n+func (o *Once) SetMutex(m *Mutex) {","path":"util/syncutil/once.go","position":33,"original_position":33,"commit_id":"c515626569cd0ea42fc82f493ba2e111acebf439","original_commit_id":"c515626569cd0ea42fc82f493ba2e111acebf439","user":{"login":"bdarnell","id":160562,"avatar_url":"https://avatars.githubusercontent.com/u/160562?v=3","gravatar_id":"","url":"https://api.github.com/users/bdarnell","html_url":"https://github.com/bdarnell","followers_url":"https://api.github.com/users/bdarnell/followers","following_url":"https://api.github.com/users/bdarnell/following{/other_user}","gists_url":"https://api.github.com/users/bdarnell/gists{/gist_id}","starred_url":"https://api.github.com/users/bdarnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdarnell/subscriptions","organizations_url":"https://api.github.com/users/bdarnell/orgs","repos_url":"https://api.github.com/users/bdarnell/repos","events_url":"https://api.github.com/users/bdarnell/events{/privacy}","received_events_url":"https://api.github.com/users/bdarnell/received_events","type":"User","site_admin":false},"body":"Why `*Mutex` instead of `sync.Locker`?","created_at":"2016-09-20T02:01:43Z","updated_at":"2016-09-20T02:01:43Z","html_url":"https://github.com/cockroachdb/cockroach/pull/9448#discussion_r79525151","pull_request_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448","_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments/79525151"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/9448#discussion_r79525151"},"pull_request":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448"}}},"pull_request":{"url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448","id":85695123,"html_url":"https://github.com/cockroachdb/cockroach/pull/9448","diff_url":"https://github.com/cockroachdb/cockroach/pull/9448.diff","patch_url":"https://github.com/cockroachdb/cockroach/pull/9448.patch","issue_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9448","number":9448,"state":"open","locked":false,"title":"storage: Support deferred cancellation in the CommandQueue","user":{"login":"nvanbenschoten","id":5438456,"avatar_url":"https://avatars.githubusercontent.com/u/5438456?v=3","gravatar_id":"","url":"https://api.github.com/users/nvanbenschoten","html_url":"https://github.com/nvanbenschoten","followers_url":"https://api.github.com/users/nvanbenschoten/followers","following_url":"https://api.github.com/users/nvanbenschoten/following{/other_user}","gists_url":"https://api.github.com/users/nvanbenschoten/gists{/gist_id}","starred_url":"https://api.github.com/users/nvanbenschoten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvanbenschoten/subscriptions","organizations_url":"https://api.github.com/users/nvanbenschoten/orgs","repos_url":"https://api.github.com/users/nvanbenschoten/repos","events_url":"https://api.github.com/users/nvanbenschoten/events{/privacy}","received_events_url":"https://api.github.com/users/nvanbenschoten/received_events","type":"User","site_admin":false},"body":"Fixes #9237.\r\n\r\nPreviously when a command was cancelled while in the `CommandQueue` due to\r\na `Context` cancellation, we would spawn a goroutine to block until all\r\nprerequisite commands completed. This change allows us to avoid the\r\nextra goroutine by offloading the cleanup work to the abandoned commands'\r\ndependents.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/cockroachdb/cockroach/9448)\n<!-- Reviewable:end -->\n","created_at":"2016-09-18T03:14:08Z","updated_at":"2016-09-20T02:37:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b79db4930b74655fcb868b712b685061b6f56cd","assignee":{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},"assignees":[{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},{"login":"petermattis","id":6201335,"avatar_url":"https://avatars.githubusercontent.com/u/6201335?v=3","gravatar_id":"","url":"https://api.github.com/users/petermattis","html_url":"https://github.com/petermattis","followers_url":"https://api.github.com/users/petermattis/followers","following_url":"https://api.github.com/users/petermattis/following{/other_user}","gists_url":"https://api.github.com/users/petermattis/gists{/gist_id}","starred_url":"https://api.github.com/users/petermattis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermattis/subscriptions","organizations_url":"https://api.github.com/users/petermattis/orgs","repos_url":"https://api.github.com/users/petermattis/repos","events_url":"https://api.github.com/users/petermattis/events{/privacy}","received_events_url":"https://api.github.com/users/petermattis/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448/commits","review_comments_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448/comments","review_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/9448/comments","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/c515626569cd0ea42fc82f493ba2e111acebf439","head":{"label":"nvanbenschoten:nvanbenschoten/deferredCancellation","ref":"nvanbenschoten/deferredCancellation","sha":"c515626569cd0ea42fc82f493ba2e111acebf439","user":{"login":"nvanbenschoten","id":5438456,"avatar_url":"https://avatars.githubusercontent.com/u/5438456?v=3","gravatar_id":"","url":"https://api.github.com/users/nvanbenschoten","html_url":"https://github.com/nvanbenschoten","followers_url":"https://api.github.com/users/nvanbenschoten/followers","following_url":"https://api.github.com/users/nvanbenschoten/following{/other_user}","gists_url":"https://api.github.com/users/nvanbenschoten/gists{/gist_id}","starred_url":"https://api.github.com/users/nvanbenschoten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvanbenschoten/subscriptions","organizations_url":"https://api.github.com/users/nvanbenschoten/orgs","repos_url":"https://api.github.com/users/nvanbenschoten/repos","events_url":"https://api.github.com/users/nvanbenschoten/events{/privacy}","received_events_url":"https://api.github.com/users/nvanbenschoten/received_events","type":"User","site_admin":false},"repo":{"id":42610470,"name":"cockroach","full_name":"nvanbenschoten/cockroach","owner":{"login":"nvanbenschoten","id":5438456,"avatar_url":"https://avatars.githubusercontent.com/u/5438456?v=3","gravatar_id":"","url":"https://api.github.com/users/nvanbenschoten","html_url":"https://github.com/nvanbenschoten","followers_url":"https://api.github.com/users/nvanbenschoten/followers","following_url":"https://api.github.com/users/nvanbenschoten/following{/other_user}","gists_url":"https://api.github.com/users/nvanbenschoten/gists{/gist_id}","starred_url":"https://api.github.com/users/nvanbenschoten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nvanbenschoten/subscriptions","organizations_url":"https://api.github.com/users/nvanbenschoten/orgs","repos_url":"https://api.github.com/users/nvanbenschoten/repos","events_url":"https://api.github.com/users/nvanbenschoten/events{/privacy}","received_events_url":"https://api.github.com/users/nvanbenschoten/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nvanbenschoten/cockroach","description":"A Scalable, Geo-Replicated, Transactional Datastore","fork":true,"url":"https://api.github.com/repos/nvanbenschoten/cockroach","forks_url":"https://api.github.com/repos/nvanbenschoten/cockroach/forks","keys_url":"https://api.github.com/repos/nvanbenschoten/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nvanbenschoten/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nvanbenschoten/cockroach/teams","hooks_url":"https://api.github.com/repos/nvanbenschoten/cockroach/hooks","issue_events_url":"https://api.github.com/repos/nvanbenschoten/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/nvanbenschoten/cockroach/events","assignees_url":"https://api.github.com/repos/nvanbenschoten/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/nvanbenschoten/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/nvanbenschoten/cockroach/tags","blobs_url":"https://api.github.com/repos/nvanbenschoten/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nvanbenschoten/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nvanbenschoten/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/nvanbenschoten/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nvanbenschoten/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/nvanbenschoten/cockroach/languages","stargazers_url":"https://api.github.com/repos/nvanbenschoten/cockroach/stargazers","contributors_url":"https://api.github.com/repos/nvanbenschoten/cockroach/contributors","subscribers_url":"https://api.github.com/repos/nvanbenschoten/cockroach/subscribers","subscription_url":"https://api.github.com/repos/nvanbenschoten/cockroach/subscription","commits_url":"https://api.github.com/repos/nvanbenschoten/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/nvanbenschoten/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/nvanbenschoten/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/nvanbenschoten/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/nvanbenschoten/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/nvanbenschoten/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nvanbenschoten/cockroach/merges","archive_url":"https://api.github.com/repos/nvanbenschoten/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nvanbenschoten/cockroach/downloads","issues_url":"https://api.github.com/repos/nvanbenschoten/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/nvanbenschoten/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/nvanbenschoten/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/nvanbenschoten/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nvanbenschoten/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/nvanbenschoten/cockroach/releases{/id}","deployments_url":"https://api.github.com/repos/nvanbenschoten/cockroach/deployments","created_at":"2015-09-16T20:04:21Z","updated_at":"2016-01-13T21:23:53Z","pushed_at":"2016-09-18T15:09:52Z","git_url":"git://github.com/nvanbenschoten/cockroach.git","ssh_url":"git@github.com:nvanbenschoten/cockroach.git","clone_url":"https://github.com/nvanbenschoten/cockroach.git","svn_url":"https://github.com/nvanbenschoten/cockroach","homepage":null,"size":186634,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"cockroachdb:develop","ref":"develop","sha":"fd3b6cfe118e182bf3564da481774c0adff30851","user":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"repo":{"id":16563587,"name":"cockroach","full_name":"cockroachdb/cockroach","owner":{"login":"cockroachdb","id":6748139,"avatar_url":"https://avatars.githubusercontent.com/u/6748139?v=3","gravatar_id":"","url":"https://api.github.com/users/cockroachdb","html_url":"https://github.com/cockroachdb","followers_url":"https://api.github.com/users/cockroachdb/followers","following_url":"https://api.github.com/users/cockroachdb/following{/other_user}","gists_url":"https://api.github.com/users/cockroachdb/gists{/gist_id}","starred_url":"https://api.github.com/users/cockroachdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockroachdb/subscriptions","organizations_url":"https://api.github.com/users/cockroachdb/orgs","repos_url":"https://api.github.com/users/cockroachdb/repos","events_url":"https://api.github.com/users/cockroachdb/events{/privacy}","received_events_url":"https://api.github.com/users/cockroachdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockroachdb/cockroach","description":"A Scalable, Survivable, Strongly-Consistent SQL Database","fork":false,"url":"https://api.github.com/repos/cockroachdb/cockroach","forks_url":"https://api.github.com/repos/cockroachdb/cockroach/forks","keys_url":"https://api.github.com/repos/cockroachdb/cockroach/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockroachdb/cockroach/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockroachdb/cockroach/teams","hooks_url":"https://api.github.com/repos/cockroachdb/cockroach/hooks","issue_events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/events{/number}","events_url":"https://api.github.com/repos/cockroachdb/cockroach/events","assignees_url":"https://api.github.com/repos/cockroachdb/cockroach/assignees{/user}","branches_url":"https://api.github.com/repos/cockroachdb/cockroach/branches{/branch}","tags_url":"https://api.github.com/repos/cockroachdb/cockroach/tags","blobs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockroachdb/cockroach/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockroachdb/cockroach/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockroachdb/cockroach/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockroachdb/cockroach/statuses/{sha}","languages_url":"https://api.github.com/repos/cockroachdb/cockroach/languages","stargazers_url":"https://api.github.com/repos/cockroachdb/cockroach/stargazers","contributors_url":"https://api.github.com/repos/cockroachdb/cockroach/contributors","subscribers_url":"https://api.github.com/repos/cockroachdb/cockroach/subscribers","subscription_url":"https://api.github.com/repos/cockroachdb/cockroach/subscription","commits_url":"https://api.github.com/repos/cockroachdb/cockroach/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockroachdb/cockroach/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockroachdb/cockroach/contents/{+path}","compare_url":"https://api.github.com/repos/cockroachdb/cockroach/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockroachdb/cockroach/merges","archive_url":"https://api.github.com/repos/cockroachdb/cockroach/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockroachdb/cockroach/downloads","issues_url":"https://api.github.com/repos/cockroachdb/cockroach/issues{/number}","pulls_url":"https://api.github.com/repos/cockroachdb/cockroach/pulls{/number}","milestones_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones{/number}","notifications_url":"https://api.github.com/repos/cockroachdb/cockroach/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/labels{/name}","releases_url":"https://api.github.com/repos/cockroachdb/cockroach/releases{/id}","deployments_url":"https://api.github.com/repos/cockroachdb/cockroach/deployments","created_at":"2014-02-06T00:18:47Z","updated_at":"2016-09-20T00:40:43Z","pushed_at":"2016-09-20T01:23:41Z","git_url":"git://github.com/cockroachdb/cockroach.git","ssh_url":"git@github.com:cockroachdb/cockroach.git","clone_url":"https://github.com/cockroachdb/cockroach.git","svn_url":"https://github.com/cockroachdb/cockroach","homepage":"https://www.cockroachlabs.com","size":338443,"stargazers_count":7592,"watchers_count":7592,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":758,"mirror_url":null,"open_issues_count":696,"forks":758,"open_issues":696,"watchers":7592,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448"},"html":{"href":"https://github.com/cockroachdb/cockroach/pull/9448"},"issue":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/9448"},"comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/issues/9448/comments"},"review_comments":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448/comments"},"review_comment":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockroachdb/cockroach/pulls/9448/commits"},"statuses":{"href":"https://api.github.com/repos/cockroachdb/cockroach/statuses/c515626569cd0ea42fc82f493ba2e111acebf439"}}}}
{"actor":{"display_login":"bdarnell"}}