{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/36169208","id":36169208,"diff_hunk":"@@ -46,74 +51,91 @@\n /**\n  * Refresh action.\n  */\n-public class TransportRefreshAction extends TransportBroadcastAction<RefreshRequest, RefreshResponse, ShardRefreshRequest, ShardRefreshResponse> {\n+public class TransportRefreshAction extends HandledTransportAction<RefreshRequest, RefreshResponse> {\n \n-    private final IndicesService indicesService;\n+    private final TransportReplicatedRefreshAction replicatedRefreshAction;\n+    ClusterService clusterService;\n \n     @Inject\n     public TransportRefreshAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,\n-                                  TransportService transportService, IndicesService indicesService,\n-                                  ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {\n-        super(settings, RefreshAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,\n-                RefreshRequest.class, ShardRefreshRequest.class, ThreadPool.Names.REFRESH);\n-        this.indicesService = indicesService;\n+                                  TransportService transportService,\n+                                  ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, TransportReplicatedRefreshAction replicatedRefreshAction) {\n+        super(settings, RefreshAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, RefreshRequest.class);\n+        this.replicatedRefreshAction = replicatedRefreshAction;\n+        this.clusterService = clusterService;\n     }\n \n     @Override\n-    protected RefreshResponse newResponse(RefreshRequest request, AtomicReferenceArray shardsResponses, ClusterState clusterState) {\n+    protected void doExecute(final RefreshRequest request, final ActionListener<RefreshResponse> listener) {\n+        logger.trace(\"execute refresh\");","path":"core/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java","position":66,"original_position":66,"commit_id":"a294f813345abf9cea7d9e71bcf568ec258680d0","original_commit_id":"a294f813345abf9cea7d9e71bcf568ec258680d0","user":{"login":"s1monw","id":973334,"avatar_url":"https://avatars.githubusercontent.com/u/973334?v=3","gravatar_id":"","url":"https://api.github.com/users/s1monw","html_url":"https://github.com/s1monw","followers_url":"https://api.github.com/users/s1monw/followers","following_url":"https://api.github.com/users/s1monw/following{/other_user}","gists_url":"https://api.github.com/users/s1monw/gists{/gist_id}","starred_url":"https://api.github.com/users/s1monw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1monw/subscriptions","organizations_url":"https://api.github.com/users/s1monw/orgs","repos_url":"https://api.github.com/users/s1monw/repos","events_url":"https://api.github.com/users/s1monw/events{/privacy}","received_events_url":"https://api.github.com/users/s1monw/received_events","type":"User","site_admin":false},"body":"is this trace needed?","created_at":"2015-08-04T09:01:23Z","updated_at":"2015-08-04T09:01:23Z","html_url":"https://github.com/elastic/elasticsearch/pull/12600#discussion_r36169208","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/36169208"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/12600#discussion_r36169208"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600","id":41463089,"html_url":"https://github.com/elastic/elasticsearch/pull/12600","diff_url":"https://github.com/elastic/elasticsearch/pull/12600.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/12600.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/12600","number":12600,"state":"open","locked":false,"title":"Fix for search failures if shard is in POST_RECOVERY","user":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"body":"Currently, we do not allow reads on shards which are in POST_RECOVERY which unfortunately can cause search failures on shards which just recovered if there no replicas (#9421). \r\nThe reason why we did not allow reads on shards that are in POST_RECOVERY is that after relocating a shard might miss a refresh if the node that executed the refresh is behind with cluster state processing.  If that happens, a user might execute index/refresh/search but still not find the document that was indexed.\r\nMore details [here](https://github.com/elastic/elasticsearch/compare/elastic:master...brwe:replicated_refresh?expand=1#diff-90cb64bedfe055b7d7f1cc28103784d5R971).\r\n\r\n@bleskes and I discussed this briefly and he mentioned we could make refresh a replicated operation that goes the same route that index operations go and thereby make sure that the refresh reaches every shard. In this case we could also allow reads on POST_RECOVERY.\r\n\r\nI make this PR as a proof of concept so that we can discuss if this is actually a good idea. \r\nThis PR contains:\r\n\r\n- a reliable test for #9421\r\n- a fix for #9421 \r\n- a test for the visibility issue that we have when we allow reads in POST_RECOVERY\r\n- the change to make refresh a replicated action just like index, delete, etc.\r\n\r\nLet me know what you think. I would make the same changes for flush also.","created_at":"2015-08-03T12:45:31Z","updated_at":"2015-08-04T09:01:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"460ab42ef0f2e9ed716c8401789045ccfd475bf6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/12600/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/a294f813345abf9cea7d9e71bcf568ec258680d0","head":{"label":"brwe:replicated_refresh","ref":"replicated_refresh","sha":"a294f813345abf9cea7d9e71bcf568ec258680d0","user":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"repo":{"id":9810286,"name":"elasticsearch","full_name":"brwe/elasticsearch","owner":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brwe/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/brwe/elasticsearch","forks_url":"https://api.github.com/repos/brwe/elasticsearch/forks","keys_url":"https://api.github.com/repos/brwe/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brwe/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brwe/elasticsearch/teams","hooks_url":"https://api.github.com/repos/brwe/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/brwe/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/brwe/elasticsearch/events","assignees_url":"https://api.github.com/repos/brwe/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/brwe/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/brwe/elasticsearch/tags","blobs_url":"https://api.github.com/repos/brwe/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brwe/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brwe/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/brwe/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brwe/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/brwe/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/brwe/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/brwe/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/brwe/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/brwe/elasticsearch/subscription","commits_url":"https://api.github.com/repos/brwe/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/brwe/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/brwe/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/brwe/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/brwe/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/brwe/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brwe/elasticsearch/merges","archive_url":"https://api.github.com/repos/brwe/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brwe/elasticsearch/downloads","issues_url":"https://api.github.com/repos/brwe/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/brwe/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/brwe/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/brwe/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brwe/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/brwe/elasticsearch/releases{/id}","created_at":"2013-05-02T09:49:12Z","updated_at":"2014-08-14T12:47:29Z","pushed_at":"2015-08-03T12:31:28Z","git_url":"git://github.com/brwe/elasticsearch.git","ssh_url":"git@github.com:brwe/elasticsearch.git","clone_url":"https://github.com/brwe/elasticsearch.git","svn_url":"https://github.com/brwe/elasticsearch","homepage":"http://elasticsearch.org","size":144882,"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":"c5b91b905898b0484f9e135f643437392cc50ef5","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-08-04T08:26:26Z","pushed_at":"2015-08-04T08:58:15Z","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":1918425,"stargazers_count":12201,"watchers_count":12201,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3912,"mirror_url":null,"open_issues_count":1180,"forks":3912,"open_issues":1180,"watchers":12201,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/12600"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/12600"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/12600/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/12600/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/a294f813345abf9cea7d9e71bcf568ec258680d0"}}}}