{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/46296645","id":46296645,"diff_hunk":"@@ -141,54 +137,52 @@ public void handleException(TransportException exp) {\n                 });\n     }\n \n+    private final ShardFailedClusterStateHandler shardFailedClusterStateHandler = new ShardFailedClusterStateHandler();\n+\n     private void handleShardFailureOnMaster(final ShardRoutingEntry shardRoutingEntry) {\n         logger.warn(\"{} received shard failed for {}\", shardRoutingEntry.failure, shardRoutingEntry.shardRouting.shardId(), shardRoutingEntry);\n-        failedShardQueue.add(shardRoutingEntry);\n-        clusterService.submitStateUpdateTask(\"shard-failed (\" + shardRoutingEntry.shardRouting + \"), message [\" + shardRoutingEntry.message + \"]\",\n-                new ClusterStateUpdateTask(Priority.HIGH) {\n-\n-            @Override\n-            public ClusterState execute(ClusterState currentState) {\n-                if (shardRoutingEntry.processed) {\n-                    return currentState;\n-                }\n-\n-                List<ShardRoutingEntry> shardRoutingEntries = new ArrayList<>();\n-                failedShardQueue.drainTo(shardRoutingEntries);\n-\n-                // nothing to process (a previous event has processed it already)\n-                if (shardRoutingEntries.isEmpty()) {\n-                    return currentState;\n-                }\n-\n-                List<FailedRerouteAllocation.FailedShard> shardRoutingsToBeApplied = new ArrayList<>(shardRoutingEntries.size());\n-\n-                // mark all entries as processed\n-                for (ShardRoutingEntry entry : shardRoutingEntries) {\n-                    entry.processed = true;\n-                    shardRoutingsToBeApplied.add(new FailedRerouteAllocation.FailedShard(entry.shardRouting, entry.message, entry.failure));\n-                }\n+        clusterService.submitStateUpdateTask(\n+                \"shard-failed (\" + shardRoutingEntry.shardRouting + \"), message [\" + shardRoutingEntry.message + \"]\",\n+                shardRoutingEntry,\n+                ClusterStateTaskConfig.build(Priority.HIGH),\n+                shardFailedClusterStateHandler,\n+                shardFailedClusterStateHandler);","path":"core/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java","position":65,"original_position":65,"commit_id":"d7f4dd0767db33ac331236629304b5e7f4168d96","original_commit_id":"d7f4dd0767db33ac331236629304b5e7f4168d96","user":{"login":"bleskes","id":1006375,"avatar_url":"https://avatars.githubusercontent.com/u/1006375?v=3","gravatar_id":"","url":"https://api.github.com/users/bleskes","html_url":"https://github.com/bleskes","followers_url":"https://api.github.com/users/bleskes/followers","following_url":"https://api.github.com/users/bleskes/following{/other_user}","gists_url":"https://api.github.com/users/bleskes/gists{/gist_id}","starred_url":"https://api.github.com/users/bleskes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bleskes/subscriptions","organizations_url":"https://api.github.com/users/bleskes/orgs","repos_url":"https://api.github.com/users/bleskes/repos","events_url":"https://api.github.com/users/bleskes/events{/privacy}","received_events_url":"https://api.github.com/users/bleskes/received_events","type":"User","site_admin":false},"body":"I meant in the future (another PR) we we want to know the results of individual shard failure requests.","created_at":"2015-12-01T16:01:52Z","updated_at":"2015-12-01T16:01:52Z","html_url":"https://github.com/elastic/elasticsearch/pull/15016#discussion_r46296645","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/46296645"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/15016#discussion_r46296645"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016","id":51797097,"html_url":"https://github.com/elastic/elasticsearch/pull/15016","diff_url":"https://github.com/elastic/elasticsearch/pull/15016.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/15016.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15016","number":15016,"state":"open","locked":false,"title":"Use general cluster state batching mechanism for shard failures","user":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"body":"This commit modifies the handling of shard failure cluster state updates\r\nto use the general cluster state batching mechanism. An advantage of\r\nthis approach is we now get correct per-listener notification on\r\nfailures.\r\n\r\nRelates #14899, relates #14725","created_at":"2015-11-25T13:59:03Z","updated_at":"2015-12-01T16:01:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77dcff8bbfc44617079168b05d125521a0e3b866","assignee":{"login":"bleskes","id":1006375,"avatar_url":"https://avatars.githubusercontent.com/u/1006375?v=3","gravatar_id":"","url":"https://api.github.com/users/bleskes","html_url":"https://github.com/bleskes","followers_url":"https://api.github.com/users/bleskes/followers","following_url":"https://api.github.com/users/bleskes/following{/other_user}","gists_url":"https://api.github.com/users/bleskes/gists{/gist_id}","starred_url":"https://api.github.com/users/bleskes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bleskes/subscriptions","organizations_url":"https://api.github.com/users/bleskes/orgs","repos_url":"https://api.github.com/users/bleskes/repos","events_url":"https://api.github.com/users/bleskes/events{/privacy}","received_events_url":"https://api.github.com/users/bleskes/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15016/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/d7f4dd0767db33ac331236629304b5e7f4168d96","head":{"label":"jasontedor:shard-failure-batch","ref":"shard-failure-batch","sha":"d7f4dd0767db33ac331236629304b5e7f4168d96","user":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"repo":{"id":38618383,"name":"elasticsearch","full_name":"jasontedor/elasticsearch","owner":{"login":"jasontedor","id":4744941,"avatar_url":"https://avatars.githubusercontent.com/u/4744941?v=3","gravatar_id":"","url":"https://api.github.com/users/jasontedor","html_url":"https://github.com/jasontedor","followers_url":"https://api.github.com/users/jasontedor/followers","following_url":"https://api.github.com/users/jasontedor/following{/other_user}","gists_url":"https://api.github.com/users/jasontedor/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontedor/subscriptions","organizations_url":"https://api.github.com/users/jasontedor/orgs","repos_url":"https://api.github.com/users/jasontedor/repos","events_url":"https://api.github.com/users/jasontedor/events{/privacy}","received_events_url":"https://api.github.com/users/jasontedor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasontedor/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/jasontedor/elasticsearch","forks_url":"https://api.github.com/repos/jasontedor/elasticsearch/forks","keys_url":"https://api.github.com/repos/jasontedor/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasontedor/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasontedor/elasticsearch/teams","hooks_url":"https://api.github.com/repos/jasontedor/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/jasontedor/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/jasontedor/elasticsearch/events","assignees_url":"https://api.github.com/repos/jasontedor/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/jasontedor/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/jasontedor/elasticsearch/tags","blobs_url":"https://api.github.com/repos/jasontedor/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasontedor/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasontedor/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasontedor/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasontedor/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/jasontedor/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/jasontedor/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/jasontedor/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/jasontedor/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/jasontedor/elasticsearch/subscription","commits_url":"https://api.github.com/repos/jasontedor/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasontedor/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasontedor/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasontedor/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasontedor/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/jasontedor/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasontedor/elasticsearch/merges","archive_url":"https://api.github.com/repos/jasontedor/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasontedor/elasticsearch/downloads","issues_url":"https://api.github.com/repos/jasontedor/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/jasontedor/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/jasontedor/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/jasontedor/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasontedor/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/jasontedor/elasticsearch/releases{/id}","created_at":"2015-07-06T12:48:14Z","updated_at":"2015-07-06T12:48:36Z","pushed_at":"2015-12-01T15:33:40Z","git_url":"git://github.com/jasontedor/elasticsearch.git","ssh_url":"git@github.com:jasontedor/elasticsearch.git","clone_url":"https://github.com/jasontedor/elasticsearch.git","svn_url":"https://github.com/jasontedor/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":175452,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"elastic:master","ref":"master","sha":"6f2c36dcb709f2907ffe79bc4907c88e3f343a66","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-12-01T15:58:54Z","pushed_at":"2015-12-01T15:58:57Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":224703,"stargazers_count":13771,"watchers_count":13771,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4569,"mirror_url":null,"open_issues_count":1236,"forks":4569,"open_issues":1236,"watchers":13771,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/15016"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/15016"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/15016/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15016/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/d7f4dd0767db33ac331236629304b5e7f4168d96"}}}}