{"action":"created","comment":{"url":"https://api.github.com/repos/basho/riak_kv/pulls/comments/23694688","id":23694688,"diff_hunk":"@@ -564,7 +598,13 @@ do_new_tree(Id, State=#state{trees=Trees, path=Path}) ->\n     Trees2 = orddict:store(Id, NewTree, Trees),\n     State#state{trees=Trees2}.\n \n--spec do_get_lock(any(), pid(), state()) -> {not_built | ok | already_locked, state()}.\n+-spec do_get_lock(any(), pid(), state()) -> {building | not_built | ok | already_locked, state()}.\n+ do_get_lock(_, _, State) when State#state.waiting_for_lock /= undefined ->\n+    lager:debug(\"Already waiting for lock: ~p ~p\", [State#state.index, State#state.waiting_for_lock]),\n+    {already_locked, State};\n+do_get_lock(_, _, State) when is_pid(State#state.built) ->\n+    lager:debug(\"Building: ~p :: ~p\", [State#state.index, State#state.built]),\n+    {building, State};","path":"src/riak_kv_index_hashtree.erl","position":103,"original_position":103,"commit_id":"3d9ad3e885748058d9f03ff11fb7c995ae82e4bb","original_commit_id":"3d9ad3e885748058d9f03ff11fb7c995ae82e4bb","user":{"login":"engelsanchez","id":115947,"avatar_url":"https://avatars.githubusercontent.com/u/115947?v=3","gravatar_id":"","url":"https://api.github.com/users/engelsanchez","html_url":"https://github.com/engelsanchez","followers_url":"https://api.github.com/users/engelsanchez/followers","following_url":"https://api.github.com/users/engelsanchez/following{/other_user}","gists_url":"https://api.github.com/users/engelsanchez/gists{/gist_id}","starred_url":"https://api.github.com/users/engelsanchez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/engelsanchez/subscriptions","organizations_url":"https://api.github.com/users/engelsanchez/orgs","repos_url":"https://api.github.com/users/engelsanchez/repos","events_url":"https://api.github.com/users/engelsanchez/events{/privacy}","received_events_url":"https://api.github.com/users/engelsanchez/received_events","type":"User","site_admin":false},"body":"Is it really necessary to introduce the `building` reply instead of returning not_built? Notice that this makes the get_lock call also start returning this, which propagates down many paths in the Riak code. ","created_at":"2015-01-28T15:33:45Z","updated_at":"2015-01-28T15:33:45Z","html_url":"https://github.com/basho/riak_kv/pull/1074#discussion_r23694688","pull_request_url":"https://api.github.com/repos/basho/riak_kv/pulls/1074","_links":{"self":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/comments/23694688"},"html":{"href":"https://github.com/basho/riak_kv/pull/1074#discussion_r23694688"},"pull_request":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/1074"}}},"pull_request":{"url":"https://api.github.com/repos/basho/riak_kv/pulls/1074","id":27835175,"html_url":"https://github.com/basho/riak_kv/pull/1074","diff_url":"https://github.com/basho/riak_kv/pull/1074.diff","patch_url":"https://github.com/basho/riak_kv/pull/1074.patch","issue_url":"https://api.github.com/repos/basho/riak_kv/issues/1074","number":1074,"state":"open","locked":false,"title":"Enhance/miklix/auto create hash tree","user":{"login":"lixen","id":102409,"avatar_url":"https://avatars.githubusercontent.com/u/102409?v=3","gravatar_id":"","url":"https://api.github.com/users/lixen","html_url":"https://github.com/lixen","followers_url":"https://api.github.com/users/lixen/followers","following_url":"https://api.github.com/users/lixen/following{/other_user}","gists_url":"https://api.github.com/users/lixen/gists{/gist_id}","starred_url":"https://api.github.com/users/lixen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lixen/subscriptions","organizations_url":"https://api.github.com/users/lixen/orgs","repos_url":"https://api.github.com/users/lixen/repos","events_url":"https://api.github.com/users/lixen/events{/privacy}","received_events_url":"https://api.github.com/users/lixen/received_events","type":"User","site_admin":false},"body":"\r\nIntroduce build and wait for lock. Needed by https://github.com/basho/riak_repl/pull/655\r\nWait for lock to give the trees time to finish building.","created_at":"2015-01-22T11:24:33Z","updated_at":"2015-01-28T15:33:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a24cc6154a2dd45799a4c31c80a249c926db439","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/basho/riak_kv/pulls/1074/commits","review_comments_url":"https://api.github.com/repos/basho/riak_kv/pulls/1074/comments","review_comment_url":"https://api.github.com/repos/basho/riak_kv/pulls/comments/{number}","comments_url":"https://api.github.com/repos/basho/riak_kv/issues/1074/comments","statuses_url":"https://api.github.com/repos/basho/riak_kv/statuses/3d9ad3e885748058d9f03ff11fb7c995ae82e4bb","head":{"label":"basho:enhance/miklix/auto-create-hash-tree","ref":"enhance/miklix/auto-create-hash-tree","sha":"3d9ad3e885748058d9f03ff11fb7c995ae82e4bb","user":{"login":"basho","id":176293,"avatar_url":"https://avatars.githubusercontent.com/u/176293?v=3","gravatar_id":"","url":"https://api.github.com/users/basho","html_url":"https://github.com/basho","followers_url":"https://api.github.com/users/basho/followers","following_url":"https://api.github.com/users/basho/following{/other_user}","gists_url":"https://api.github.com/users/basho/gists{/gist_id}","starred_url":"https://api.github.com/users/basho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basho/subscriptions","organizations_url":"https://api.github.com/users/basho/orgs","repos_url":"https://api.github.com/users/basho/repos","events_url":"https://api.github.com/users/basho/events{/privacy}","received_events_url":"https://api.github.com/users/basho/received_events","type":"Organization","site_admin":false},"repo":{"id":791522,"name":"riak_kv","full_name":"basho/riak_kv","owner":{"login":"basho","id":176293,"avatar_url":"https://avatars.githubusercontent.com/u/176293?v=3","gravatar_id":"","url":"https://api.github.com/users/basho","html_url":"https://github.com/basho","followers_url":"https://api.github.com/users/basho/followers","following_url":"https://api.github.com/users/basho/following{/other_user}","gists_url":"https://api.github.com/users/basho/gists{/gist_id}","starred_url":"https://api.github.com/users/basho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basho/subscriptions","organizations_url":"https://api.github.com/users/basho/orgs","repos_url":"https://api.github.com/users/basho/repos","events_url":"https://api.github.com/users/basho/events{/privacy}","received_events_url":"https://api.github.com/users/basho/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basho/riak_kv","description":"Riak Key/Value Store","fork":false,"url":"https://api.github.com/repos/basho/riak_kv","forks_url":"https://api.github.com/repos/basho/riak_kv/forks","keys_url":"https://api.github.com/repos/basho/riak_kv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basho/riak_kv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basho/riak_kv/teams","hooks_url":"https://api.github.com/repos/basho/riak_kv/hooks","issue_events_url":"https://api.github.com/repos/basho/riak_kv/issues/events{/number}","events_url":"https://api.github.com/repos/basho/riak_kv/events","assignees_url":"https://api.github.com/repos/basho/riak_kv/assignees{/user}","branches_url":"https://api.github.com/repos/basho/riak_kv/branches{/branch}","tags_url":"https://api.github.com/repos/basho/riak_kv/tags","blobs_url":"https://api.github.com/repos/basho/riak_kv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basho/riak_kv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basho/riak_kv/git/refs{/sha}","trees_url":"https://api.github.com/repos/basho/riak_kv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basho/riak_kv/statuses/{sha}","languages_url":"https://api.github.com/repos/basho/riak_kv/languages","stargazers_url":"https://api.github.com/repos/basho/riak_kv/stargazers","contributors_url":"https://api.github.com/repos/basho/riak_kv/contributors","subscribers_url":"https://api.github.com/repos/basho/riak_kv/subscribers","subscription_url":"https://api.github.com/repos/basho/riak_kv/subscription","commits_url":"https://api.github.com/repos/basho/riak_kv/commits{/sha}","git_commits_url":"https://api.github.com/repos/basho/riak_kv/git/commits{/sha}","comments_url":"https://api.github.com/repos/basho/riak_kv/comments{/number}","issue_comment_url":"https://api.github.com/repos/basho/riak_kv/issues/comments/{number}","contents_url":"https://api.github.com/repos/basho/riak_kv/contents/{+path}","compare_url":"https://api.github.com/repos/basho/riak_kv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basho/riak_kv/merges","archive_url":"https://api.github.com/repos/basho/riak_kv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basho/riak_kv/downloads","issues_url":"https://api.github.com/repos/basho/riak_kv/issues{/number}","pulls_url":"https://api.github.com/repos/basho/riak_kv/pulls{/number}","milestones_url":"https://api.github.com/repos/basho/riak_kv/milestones{/number}","notifications_url":"https://api.github.com/repos/basho/riak_kv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basho/riak_kv/labels{/name}","releases_url":"https://api.github.com/repos/basho/riak_kv/releases{/id}","created_at":"2010-07-22T17:27:35Z","updated_at":"2015-01-23T22:54:50Z","pushed_at":"2015-01-27T18:25:04Z","git_url":"git://github.com/basho/riak_kv.git","ssh_url":"git@github.com:basho/riak_kv.git","clone_url":"https://github.com/basho/riak_kv.git","svn_url":"https://github.com/basho/riak_kv","homepage":"","size":22940,"stargazers_count":230,"watchers_count":230,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":132,"forks":111,"open_issues":132,"watchers":230,"default_branch":"develop"}},"base":{"label":"basho:2.0","ref":"2.0","sha":"23de41a30af7af8e9bc2da393b7cff69a5d30c7a","user":{"login":"basho","id":176293,"avatar_url":"https://avatars.githubusercontent.com/u/176293?v=3","gravatar_id":"","url":"https://api.github.com/users/basho","html_url":"https://github.com/basho","followers_url":"https://api.github.com/users/basho/followers","following_url":"https://api.github.com/users/basho/following{/other_user}","gists_url":"https://api.github.com/users/basho/gists{/gist_id}","starred_url":"https://api.github.com/users/basho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basho/subscriptions","organizations_url":"https://api.github.com/users/basho/orgs","repos_url":"https://api.github.com/users/basho/repos","events_url":"https://api.github.com/users/basho/events{/privacy}","received_events_url":"https://api.github.com/users/basho/received_events","type":"Organization","site_admin":false},"repo":{"id":791522,"name":"riak_kv","full_name":"basho/riak_kv","owner":{"login":"basho","id":176293,"avatar_url":"https://avatars.githubusercontent.com/u/176293?v=3","gravatar_id":"","url":"https://api.github.com/users/basho","html_url":"https://github.com/basho","followers_url":"https://api.github.com/users/basho/followers","following_url":"https://api.github.com/users/basho/following{/other_user}","gists_url":"https://api.github.com/users/basho/gists{/gist_id}","starred_url":"https://api.github.com/users/basho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basho/subscriptions","organizations_url":"https://api.github.com/users/basho/orgs","repos_url":"https://api.github.com/users/basho/repos","events_url":"https://api.github.com/users/basho/events{/privacy}","received_events_url":"https://api.github.com/users/basho/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basho/riak_kv","description":"Riak Key/Value Store","fork":false,"url":"https://api.github.com/repos/basho/riak_kv","forks_url":"https://api.github.com/repos/basho/riak_kv/forks","keys_url":"https://api.github.com/repos/basho/riak_kv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basho/riak_kv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basho/riak_kv/teams","hooks_url":"https://api.github.com/repos/basho/riak_kv/hooks","issue_events_url":"https://api.github.com/repos/basho/riak_kv/issues/events{/number}","events_url":"https://api.github.com/repos/basho/riak_kv/events","assignees_url":"https://api.github.com/repos/basho/riak_kv/assignees{/user}","branches_url":"https://api.github.com/repos/basho/riak_kv/branches{/branch}","tags_url":"https://api.github.com/repos/basho/riak_kv/tags","blobs_url":"https://api.github.com/repos/basho/riak_kv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basho/riak_kv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basho/riak_kv/git/refs{/sha}","trees_url":"https://api.github.com/repos/basho/riak_kv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basho/riak_kv/statuses/{sha}","languages_url":"https://api.github.com/repos/basho/riak_kv/languages","stargazers_url":"https://api.github.com/repos/basho/riak_kv/stargazers","contributors_url":"https://api.github.com/repos/basho/riak_kv/contributors","subscribers_url":"https://api.github.com/repos/basho/riak_kv/subscribers","subscription_url":"https://api.github.com/repos/basho/riak_kv/subscription","commits_url":"https://api.github.com/repos/basho/riak_kv/commits{/sha}","git_commits_url":"https://api.github.com/repos/basho/riak_kv/git/commits{/sha}","comments_url":"https://api.github.com/repos/basho/riak_kv/comments{/number}","issue_comment_url":"https://api.github.com/repos/basho/riak_kv/issues/comments/{number}","contents_url":"https://api.github.com/repos/basho/riak_kv/contents/{+path}","compare_url":"https://api.github.com/repos/basho/riak_kv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basho/riak_kv/merges","archive_url":"https://api.github.com/repos/basho/riak_kv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basho/riak_kv/downloads","issues_url":"https://api.github.com/repos/basho/riak_kv/issues{/number}","pulls_url":"https://api.github.com/repos/basho/riak_kv/pulls{/number}","milestones_url":"https://api.github.com/repos/basho/riak_kv/milestones{/number}","notifications_url":"https://api.github.com/repos/basho/riak_kv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basho/riak_kv/labels{/name}","releases_url":"https://api.github.com/repos/basho/riak_kv/releases{/id}","created_at":"2010-07-22T17:27:35Z","updated_at":"2015-01-23T22:54:50Z","pushed_at":"2015-01-27T18:25:04Z","git_url":"git://github.com/basho/riak_kv.git","ssh_url":"git@github.com:basho/riak_kv.git","clone_url":"https://github.com/basho/riak_kv.git","svn_url":"https://github.com/basho/riak_kv","homepage":"","size":22940,"stargazers_count":230,"watchers_count":230,"language":"Erlang","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":111,"mirror_url":null,"open_issues_count":132,"forks":111,"open_issues":132,"watchers":230,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/1074"},"html":{"href":"https://github.com/basho/riak_kv/pull/1074"},"issue":{"href":"https://api.github.com/repos/basho/riak_kv/issues/1074"},"comments":{"href":"https://api.github.com/repos/basho/riak_kv/issues/1074/comments"},"review_comments":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/1074/comments"},"review_comment":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/basho/riak_kv/pulls/1074/commits"},"statuses":{"href":"https://api.github.com/repos/basho/riak_kv/statuses/3d9ad3e885748058d9f03ff11fb7c995ae82e4bb"}}}}