{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/58922318","id":58922318,"diff_hunk":"@@ -0,0 +1,71 @@\n+/*\n+ * Licensed to Elasticsearch under one or more contributor\n+ * license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright\n+ * ownership. Elasticsearch licenses this file to you under\n+ * the Apache License, Version 2.0 (the \"License\"); you may\n+ * 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,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.elasticsearch.action.admin.cluster.allocation;\n+\n+import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;\n+import org.elasticsearch.common.settings.Settings;\n+import org.elasticsearch.test.ESIntegTestCase;\n+import org.elasticsearch.test.ESSingleNodeTestCase;\n+\n+import java.util.List;\n+\n+import static org.hamcrest.Matchers.equalTo;\n+import static org.hamcrest.Matchers.greaterThan;\n+import static org.hamcrest.Matchers.greaterThanOrEqualTo;\n+\n+/**\n+ * Tests for the cluster allocation explanation\n+ */\n+@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)\n+public final class ClusterAllocationExplainIT extends ESIntegTestCase {\n+    public void testDelayShards() throws Exception {\n+        logger.info(\"--> starting 3 nodes\");\n+        List<String> nodes = internalCluster().startNodesAsync(3).get();\n+\n+        // Wait for all 3 nodes to be up\n+        logger.info(\"--> waiting for 3 nodes to be up\");\n+        assertBusy(new Runnable() {\n+            @Override\n+            public void run() {\n+                NodesStatsResponse resp = client().admin().cluster().prepareNodesStats().get();\n+                assertThat(resp.getNodes().length, equalTo(3));\n+            }\n+        });\n+\n+        logger.info(\"--> creating 'test' index\");\n+        prepareCreate(\"test\").setSettings(Settings.settingsBuilder()\n+                .put(\"index.unassigned.node_left.delayed_timeout\", \"1m\")\n+                .put(\"number_of_shards\", 5)\n+                .put(\"number_of_replicas\", 1)).get();","path":"core/src/test/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java","position":56,"original_position":56,"commit_id":"78e6ff6e5e4d04783d3ad52d1c5512265334ded1","original_commit_id":"78e6ff6e5e4d04783d3ad52d1c5512265334ded1","user":{"login":"abeyad","id":1631297,"avatar_url":"https://avatars.githubusercontent.com/u/1631297?v=3","gravatar_id":"","url":"https://api.github.com/users/abeyad","html_url":"https://github.com/abeyad","followers_url":"https://api.github.com/users/abeyad/followers","following_url":"https://api.github.com/users/abeyad/following{/other_user}","gists_url":"https://api.github.com/users/abeyad/gists{/gist_id}","starred_url":"https://api.github.com/users/abeyad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abeyad/subscriptions","organizations_url":"https://api.github.com/users/abeyad/orgs","repos_url":"https://api.github.com/users/abeyad/repos","events_url":"https://api.github.com/users/abeyad/events{/privacy}","received_events_url":"https://api.github.com/users/abeyad/received_events","type":"User","site_admin":false},"body":"could use \r\n\r\n1. `UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey()`\r\n2. `IndexMetaData.INDEX_NUMBER_OF_SHARDS.getKey()`\r\n3. `IndexMetaData.INDEX_NUMBER_OF_REPLICAS.getKey()`","created_at":"2016-04-07T18:34:51Z","updated_at":"2016-04-07T18:34:51Z","html_url":"https://github.com/elastic/elasticsearch/pull/17515#discussion_r58922318","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/58922318"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17515#discussion_r58922318"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515","id":65185190,"html_url":"https://github.com/elastic/elasticsearch/pull/17515","diff_url":"https://github.com/elastic/elasticsearch/pull/17515.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/17515.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17515","number":17515,"state":"open","locked":false,"title":"Show configured and remaining delay for an unassigned shard.","user":{"login":"dakrone","id":19060,"avatar_url":"https://avatars.githubusercontent.com/u/19060?v=3","gravatar_id":"","url":"https://api.github.com/users/dakrone","html_url":"https://github.com/dakrone","followers_url":"https://api.github.com/users/dakrone/followers","following_url":"https://api.github.com/users/dakrone/following{/other_user}","gists_url":"https://api.github.com/users/dakrone/gists{/gist_id}","starred_url":"https://api.github.com/users/dakrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakrone/subscriptions","organizations_url":"https://api.github.com/users/dakrone/orgs","repos_url":"https://api.github.com/users/dakrone/repos","events_url":"https://api.github.com/users/dakrone/events{/privacy}","received_events_url":"https://api.github.com/users/dakrone/received_events","type":"User","site_admin":false},"body":"When a shard is delayed, we now show output like:\r\n\r\n```json\r\n{\r\n  \"shard\" : {\r\n    \"index\" : \"i\",\r\n    \"index_uuid\" : \"QzoKda9aQCG_hCaZQ18GEg\",\r\n    \"id\" : 3,\r\n    \"primary\" : false\r\n  },\r\n  \"assigned\" : false,\r\n  \"unassigned_info\" : {\r\n    \"reason\" : \"NODE_LEFT\",\r\n    \"at\" : \"2016-04-04T16:44:47.520Z\",\r\n    \"details\" : \"node_left[HyRLmMLxR5m_f58RKURApQ]\"\r\n  },\r\n  \"allocation_delay\" : \"59.9s\",\r\n  \"allocation_delay_ms\" : 59910,\r\n  \"remaining_delay\" : \"38.9s\",\r\n  \"remaining_delay_ms\" : 38991,\r\n  \"nodes\" : {\r\n    \"jKiyQcWFTkyp3htyyjxoCw\" : {\r\n      \"node_name\" : \"Landslide\",\r\n      \"node_attributes\" : { },\r\n      \"final_decision\" : \"YES\",\r\n      \"weight\" : 1.0,\r\n      \"decisions\" : [ ]\r\n    },\r\n    \"9bzF0SgoQh-G0F0sRW_qew\" : {\r\n      \"node_name\" : \"Caretaker\",\r\n      \"node_attributes\" : { },\r\n      \"final_decision\" : \"NO\",\r\n      \"weight\" : 2.0,\r\n      \"decisions\" : [ {\r\n        \"decider\" : \"same_shard\",\r\n        \"decision\" : \"NO\",\r\n        \"explanation\" : \"the shard cannot be allocated on the same node id [9bzF0SgoQh-G0F0sRW_qew] on which it already exists\"\r\n      } ]\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nWhere the new addition is this section:\r\n\r\n```\r\n  \"allocation_delay\" : \"59.9s\",\r\n  \"allocation_delay_ms\" : 59910,\r\n  \"remaining_delay\" : \"38.9s\",\r\n  \"remaining_delay_ms\" : 38991,\r\n```\r\n\r\nWhich shows the configured delay as well as the remaining delay until\r\nthe shard can be considered \"assignable\". This data is only shown if the\r\nshard is unassigned.\r\n\r\nRelates to #17372","created_at":"2016-04-04T17:50:31Z","updated_at":"2016-04-07T18:34:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7e13b3f42a04644ccdf406490b6a5391e6e91735","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17515/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/78e6ff6e5e4d04783d3ad52d1c5512265334ded1","head":{"label":"dakrone:allocation-explain-show-delay","ref":"allocation-explain-show-delay","sha":"78e6ff6e5e4d04783d3ad52d1c5512265334ded1","user":{"login":"dakrone","id":19060,"avatar_url":"https://avatars.githubusercontent.com/u/19060?v=3","gravatar_id":"","url":"https://api.github.com/users/dakrone","html_url":"https://github.com/dakrone","followers_url":"https://api.github.com/users/dakrone/followers","following_url":"https://api.github.com/users/dakrone/following{/other_user}","gists_url":"https://api.github.com/users/dakrone/gists{/gist_id}","starred_url":"https://api.github.com/users/dakrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakrone/subscriptions","organizations_url":"https://api.github.com/users/dakrone/orgs","repos_url":"https://api.github.com/users/dakrone/repos","events_url":"https://api.github.com/users/dakrone/events{/privacy}","received_events_url":"https://api.github.com/users/dakrone/received_events","type":"User","site_admin":false},"repo":{"id":3037278,"name":"elasticsearch","full_name":"dakrone/elasticsearch","owner":{"login":"dakrone","id":19060,"avatar_url":"https://avatars.githubusercontent.com/u/19060?v=3","gravatar_id":"","url":"https://api.github.com/users/dakrone","html_url":"https://github.com/dakrone","followers_url":"https://api.github.com/users/dakrone/followers","following_url":"https://api.github.com/users/dakrone/following{/other_user}","gists_url":"https://api.github.com/users/dakrone/gists{/gist_id}","starred_url":"https://api.github.com/users/dakrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakrone/subscriptions","organizations_url":"https://api.github.com/users/dakrone/orgs","repos_url":"https://api.github.com/users/dakrone/repos","events_url":"https://api.github.com/users/dakrone/events{/privacy}","received_events_url":"https://api.github.com/users/dakrone/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dakrone/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/dakrone/elasticsearch","forks_url":"https://api.github.com/repos/dakrone/elasticsearch/forks","keys_url":"https://api.github.com/repos/dakrone/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dakrone/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dakrone/elasticsearch/teams","hooks_url":"https://api.github.com/repos/dakrone/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/dakrone/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/dakrone/elasticsearch/events","assignees_url":"https://api.github.com/repos/dakrone/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/dakrone/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/dakrone/elasticsearch/tags","blobs_url":"https://api.github.com/repos/dakrone/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dakrone/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dakrone/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/dakrone/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dakrone/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/dakrone/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/dakrone/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/dakrone/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/dakrone/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/dakrone/elasticsearch/subscription","commits_url":"https://api.github.com/repos/dakrone/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/dakrone/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/dakrone/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/dakrone/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/dakrone/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/dakrone/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dakrone/elasticsearch/merges","archive_url":"https://api.github.com/repos/dakrone/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dakrone/elasticsearch/downloads","issues_url":"https://api.github.com/repos/dakrone/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/dakrone/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/dakrone/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/dakrone/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dakrone/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/dakrone/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/dakrone/elasticsearch/deployments","created_at":"2011-12-22T23:14:00Z","updated_at":"2014-12-16T08:28:10Z","pushed_at":"2016-04-04T21:37:30Z","git_url":"git://github.com/dakrone/elasticsearch.git","ssh_url":"git@github.com:dakrone/elasticsearch.git","clone_url":"https://github.com/dakrone/elasticsearch.git","svn_url":"https://github.com/dakrone/elasticsearch","homepage":"http://elasticsearch.org","size":188616,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"90f300bb719e5758b012ef8f7e17dff13c1be356","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}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2016-04-07T18:33:10Z","pushed_at":"2016-04-07T18:16:31Z","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":303617,"stargazers_count":15870,"watchers_count":15870,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5315,"mirror_url":null,"open_issues_count":1094,"forks":5315,"open_issues":1094,"watchers":15870,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17515"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17515"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17515/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17515/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/78e6ff6e5e4d04783d3ad52d1c5512265334ded1"}}}}