{"action":"created","comment":{"url":"https://api.github.com/repos/crate/crate/pulls/comments/40793212","id":40793212,"diff_hunk":"@@ -204,6 +218,45 @@ private ShardId shardId(String indexName, String id, @Nullable String routing) {\n         return shardId;\n     }\n \n+    private ShardId getShardIdBlocking(final String indexName, final String id, @Nullable final String routing) {\n+        final SettableFuture<ShardId> shardIdFuture = SettableFuture.create();\n+        final ShardId shardId = shardId(indexName, id, routing);\n+        if (shardId == null) {\n+            clusterService.add(WAIT_FOR_SHARDS_TIMEOUT, new TimeoutClusterStateListener() {\n+                @Override\n+                public void postAdded() {\n+                    // ignore\n+                }\n+\n+                @Override\n+                public void onClose() {\n+                    setFailure(new NodeClosedException(clusterService.localNode()));\n+                }\n+\n+                @Override\n+                public void onTimeout(TimeValue timeout) {\n+                    setFailure(new ElasticsearchTimeoutException(\"shard was not initialized within \" + timeout.format()));\n+                }\n+\n+                @Override\n+                public void clusterChanged(ClusterChangedEvent event) {\n+                    ShardId localShardId = shardId(event.state(), indexName, id, routing);\n+                    if (localShardId != null) {\n+                        shardIdFuture.set(localShardId);\n+                        clusterService.remove(this);\n+                    }\n+                }\n+            });\n+        } else {\n+            shardIdFuture.set(shardId);\n+        }\n+        try {\n+            return shardIdFuture.get();","path":"sql/src/main/java/org/elasticsearch/action/bulk/BulkShardProcessor.java","position":114,"original_position":114,"commit_id":"cf41c51b15f16ea1f85736556d2b6e5d0b58153c","original_commit_id":"e6327d577f35d6b0c541c61ad910292b88cd20ea","user":{"login":"seut","id":219690,"avatar_url":"https://avatars.githubusercontent.com/u/219690?v=3","gravatar_id":"","url":"https://api.github.com/users/seut","html_url":"https://github.com/seut","followers_url":"https://api.github.com/users/seut/followers","following_url":"https://api.github.com/users/seut/following{/other_user}","gists_url":"https://api.github.com/users/seut/gists{/gist_id}","starred_url":"https://api.github.com/users/seut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seut/subscriptions","organizations_url":"https://api.github.com/users/seut/orgs","repos_url":"https://api.github.com/users/seut/repos","events_url":"https://api.github.com/users/seut/events{/privacy}","received_events_url":"https://api.github.com/users/seut/received_events","type":"User","site_admin":false},"body":"this must timeout afaik","created_at":"2015-09-30T13:34:25Z","updated_at":"2015-09-30T13:34:25Z","html_url":"https://github.com/crate/crate/pull/2658#discussion_r40793212","pull_request_url":"https://api.github.com/repos/crate/crate/pulls/2658","_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/comments/40793212"},"html":{"href":"https://github.com/crate/crate/pull/2658#discussion_r40793212"},"pull_request":{"href":"https://api.github.com/repos/crate/crate/pulls/2658"}}},"pull_request":{"url":"https://api.github.com/repos/crate/crate/pulls/2658","id":46401163,"html_url":"https://github.com/crate/crate/pull/2658","diff_url":"https://github.com/crate/crate/pull/2658.diff","patch_url":"https://github.com/crate/crate/pull/2658.patch","issue_url":"https://api.github.com/repos/crate/crate/issues/2658","number":2658,"state":"open","locked":false,"title":"M/concurrent copy from issues","user":{"login":"mfelsche","id":1152667,"avatar_url":"https://avatars.githubusercontent.com/u/1152667?v=3","gravatar_id":"","url":"https://api.github.com/users/mfelsche","html_url":"https://github.com/mfelsche","followers_url":"https://api.github.com/users/mfelsche/followers","following_url":"https://api.github.com/users/mfelsche/following{/other_user}","gists_url":"https://api.github.com/users/mfelsche/gists{/gist_id}","starred_url":"https://api.github.com/users/mfelsche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfelsche/subscriptions","organizations_url":"https://api.github.com/users/mfelsche/orgs","repos_url":"https://api.github.com/users/mfelsche/repos","events_url":"https://api.github.com/users/mfelsche/events{/privacy}","received_events_url":"https://api.github.com/users/mfelsche/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-30T13:27:27Z","updated_at":"2015-09-30T13:34:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d460dbf9d5f402e707b592803a0c04b2192d61ae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crate/crate/pulls/2658/commits","review_comments_url":"https://api.github.com/repos/crate/crate/pulls/2658/comments","review_comment_url":"https://api.github.com/repos/crate/crate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crate/crate/issues/2658/comments","statuses_url":"https://api.github.com/repos/crate/crate/statuses/cf41c51b15f16ea1f85736556d2b6e5d0b58153c","head":{"label":"crate:m/concurrent_copy_from_issues","ref":"m/concurrent_copy_from_issues","sha":"cf41c51b15f16ea1f85736556d2b6e5d0b58153c","user":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"repo":{"id":9342529,"name":"crate","full_name":"crate/crate","owner":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crate/crate","description":"CRATE: Your Elastic Data Store","fork":false,"url":"https://api.github.com/repos/crate/crate","forks_url":"https://api.github.com/repos/crate/crate/forks","keys_url":"https://api.github.com/repos/crate/crate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crate/crate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crate/crate/teams","hooks_url":"https://api.github.com/repos/crate/crate/hooks","issue_events_url":"https://api.github.com/repos/crate/crate/issues/events{/number}","events_url":"https://api.github.com/repos/crate/crate/events","assignees_url":"https://api.github.com/repos/crate/crate/assignees{/user}","branches_url":"https://api.github.com/repos/crate/crate/branches{/branch}","tags_url":"https://api.github.com/repos/crate/crate/tags","blobs_url":"https://api.github.com/repos/crate/crate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crate/crate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crate/crate/git/refs{/sha}","trees_url":"https://api.github.com/repos/crate/crate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crate/crate/statuses/{sha}","languages_url":"https://api.github.com/repos/crate/crate/languages","stargazers_url":"https://api.github.com/repos/crate/crate/stargazers","contributors_url":"https://api.github.com/repos/crate/crate/contributors","subscribers_url":"https://api.github.com/repos/crate/crate/subscribers","subscription_url":"https://api.github.com/repos/crate/crate/subscription","commits_url":"https://api.github.com/repos/crate/crate/commits{/sha}","git_commits_url":"https://api.github.com/repos/crate/crate/git/commits{/sha}","comments_url":"https://api.github.com/repos/crate/crate/comments{/number}","issue_comment_url":"https://api.github.com/repos/crate/crate/issues/comments{/number}","contents_url":"https://api.github.com/repos/crate/crate/contents/{+path}","compare_url":"https://api.github.com/repos/crate/crate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crate/crate/merges","archive_url":"https://api.github.com/repos/crate/crate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crate/crate/downloads","issues_url":"https://api.github.com/repos/crate/crate/issues{/number}","pulls_url":"https://api.github.com/repos/crate/crate/pulls{/number}","milestones_url":"https://api.github.com/repos/crate/crate/milestones{/number}","notifications_url":"https://api.github.com/repos/crate/crate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crate/crate/labels{/name}","releases_url":"https://api.github.com/repos/crate/crate/releases{/id}","created_at":"2013-04-10T09:17:16Z","updated_at":"2015-09-27T15:55:45Z","pushed_at":"2015-09-30T13:31:22Z","git_url":"git://github.com/crate/crate.git","ssh_url":"git@github.com:crate/crate.git","clone_url":"https://github.com/crate/crate.git","svn_url":"https://github.com/crate/crate","homepage":"https://crate.io","size":110690,"stargazers_count":1024,"watchers_count":1024,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":59,"forks":110,"open_issues":59,"watchers":1024,"default_branch":"master"}},"base":{"label":"crate:master","ref":"master","sha":"15f82d3967129763101374e8ac71a0d1d2a07e11","user":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"repo":{"id":9342529,"name":"crate","full_name":"crate/crate","owner":{"login":"crate","id":4048232,"avatar_url":"https://avatars.githubusercontent.com/u/4048232?v=3","gravatar_id":"","url":"https://api.github.com/users/crate","html_url":"https://github.com/crate","followers_url":"https://api.github.com/users/crate/followers","following_url":"https://api.github.com/users/crate/following{/other_user}","gists_url":"https://api.github.com/users/crate/gists{/gist_id}","starred_url":"https://api.github.com/users/crate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crate/subscriptions","organizations_url":"https://api.github.com/users/crate/orgs","repos_url":"https://api.github.com/users/crate/repos","events_url":"https://api.github.com/users/crate/events{/privacy}","received_events_url":"https://api.github.com/users/crate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crate/crate","description":"CRATE: Your Elastic Data Store","fork":false,"url":"https://api.github.com/repos/crate/crate","forks_url":"https://api.github.com/repos/crate/crate/forks","keys_url":"https://api.github.com/repos/crate/crate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crate/crate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crate/crate/teams","hooks_url":"https://api.github.com/repos/crate/crate/hooks","issue_events_url":"https://api.github.com/repos/crate/crate/issues/events{/number}","events_url":"https://api.github.com/repos/crate/crate/events","assignees_url":"https://api.github.com/repos/crate/crate/assignees{/user}","branches_url":"https://api.github.com/repos/crate/crate/branches{/branch}","tags_url":"https://api.github.com/repos/crate/crate/tags","blobs_url":"https://api.github.com/repos/crate/crate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crate/crate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crate/crate/git/refs{/sha}","trees_url":"https://api.github.com/repos/crate/crate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crate/crate/statuses/{sha}","languages_url":"https://api.github.com/repos/crate/crate/languages","stargazers_url":"https://api.github.com/repos/crate/crate/stargazers","contributors_url":"https://api.github.com/repos/crate/crate/contributors","subscribers_url":"https://api.github.com/repos/crate/crate/subscribers","subscription_url":"https://api.github.com/repos/crate/crate/subscription","commits_url":"https://api.github.com/repos/crate/crate/commits{/sha}","git_commits_url":"https://api.github.com/repos/crate/crate/git/commits{/sha}","comments_url":"https://api.github.com/repos/crate/crate/comments{/number}","issue_comment_url":"https://api.github.com/repos/crate/crate/issues/comments{/number}","contents_url":"https://api.github.com/repos/crate/crate/contents/{+path}","compare_url":"https://api.github.com/repos/crate/crate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crate/crate/merges","archive_url":"https://api.github.com/repos/crate/crate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crate/crate/downloads","issues_url":"https://api.github.com/repos/crate/crate/issues{/number}","pulls_url":"https://api.github.com/repos/crate/crate/pulls{/number}","milestones_url":"https://api.github.com/repos/crate/crate/milestones{/number}","notifications_url":"https://api.github.com/repos/crate/crate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crate/crate/labels{/name}","releases_url":"https://api.github.com/repos/crate/crate/releases{/id}","created_at":"2013-04-10T09:17:16Z","updated_at":"2015-09-27T15:55:45Z","pushed_at":"2015-09-30T13:31:22Z","git_url":"git://github.com/crate/crate.git","ssh_url":"git@github.com:crate/crate.git","clone_url":"https://github.com/crate/crate.git","svn_url":"https://github.com/crate/crate","homepage":"https://crate.io","size":110690,"stargazers_count":1024,"watchers_count":1024,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":59,"forks":110,"open_issues":59,"watchers":1024,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crate/crate/pulls/2658"},"html":{"href":"https://github.com/crate/crate/pull/2658"},"issue":{"href":"https://api.github.com/repos/crate/crate/issues/2658"},"comments":{"href":"https://api.github.com/repos/crate/crate/issues/2658/comments"},"review_comments":{"href":"https://api.github.com/repos/crate/crate/pulls/2658/comments"},"review_comment":{"href":"https://api.github.com/repos/crate/crate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crate/crate/pulls/2658/commits"},"statuses":{"href":"https://api.github.com/repos/crate/crate/statuses/cf41c51b15f16ea1f85736556d2b6e5d0b58153c"}}}}