{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/45848785","id":45848785,"diff_hunk":"@@ -0,0 +1,180 @@\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+package org.elasticsearch.action.bulk;\n+\n+import org.elasticsearch.action.ActionListener;\n+import org.elasticsearch.client.Client;\n+\n+import java.util.Iterator;\n+import java.util.NoSuchElementException;\n+import java.util.concurrent.Callable;\n+import java.util.concurrent.ScheduledExecutorService;\n+import java.util.concurrent.ScheduledThreadPoolExecutor;\n+import java.util.concurrent.TimeUnit;\n+\n+/**\n+ * Encapsulates synchronous and asynchronous retry logic. It retries with an increasing backoff factor.\n+ */\n+class Retry {\n+    private static final int INITIAL_RETRY_PERIOD_MILLIS = 100;\n+\n+    static final int DEFAULT_MAX_RETRIES = 5;\n+\n+    private final Class<? extends Throwable> retryOnThrowable;\n+\n+    public static Retry on(Class<? extends Throwable> retryOnThrowable) {\n+        return new Retry(retryOnThrowable);\n+    }\n+\n+    Retry(Class<? extends Throwable> retryOnThrowable) {\n+        this.retryOnThrowable = retryOnThrowable;\n+    }\n+\n+    /**\n+     * Invokes #bulk(BulkRequest, ActionListener) on the provided client. Backos off on the provided exception and delegates results to the","path":"core/src/main/java/org/elasticsearch/action/bulk/Retry.java","position":50,"original_position":50,"commit_id":"208cb73b7cf84e265efd09e5b910e1c4081f1297","original_commit_id":"208cb73b7cf84e265efd09e5b910e1c4081f1297","user":{"login":"tlrx","id":642733,"avatar_url":"https://avatars.githubusercontent.com/u/642733?v=3","gravatar_id":"","url":"https://api.github.com/users/tlrx","html_url":"https://github.com/tlrx","followers_url":"https://api.github.com/users/tlrx/followers","following_url":"https://api.github.com/users/tlrx/following{/other_user}","gists_url":"https://api.github.com/users/tlrx/gists{/gist_id}","starred_url":"https://api.github.com/users/tlrx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlrx/subscriptions","organizations_url":"https://api.github.com/users/tlrx/orgs","repos_url":"https://api.github.com/users/tlrx/repos","events_url":"https://api.github.com/users/tlrx/events{/privacy}","received_events_url":"https://api.github.com/users/tlrx/received_events","type":"User","site_admin":false},"body":"> Backos off\r\n\r\nTypo ","created_at":"2015-11-25T10:06:03Z","updated_at":"2015-11-25T10:06:03Z","html_url":"https://github.com/elastic/elasticsearch/pull/14829#discussion_r45848785","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/45848785"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/14829#discussion_r45848785"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829","id":51075857,"html_url":"https://github.com/elastic/elasticsearch/pull/14829","diff_url":"https://github.com/elastic/elasticsearch/pull/14829.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/14829.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14829","number":14829,"state":"open","locked":false,"title":"BulkProcessor retries after request handling has been rejected due to a full thread pool","user":{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false},"body":"With this commit we introduce limited retries with a backoff logic to BulkProcessor\r\nwhen a bulk request has been rejeced with an EsRejectedExecutionException.\r\n\r\nThe handling is encapsulated entirely in BulkProcessor and currently no\r\nconfiguration parameters are exposed to the client.\r\n\r\nFixes #14620.","created_at":"2015-11-18T12:04:48Z","updated_at":"2015-11-25T10:06:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6c1b3ca0358ca220da69fdc217759e9ad05689f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14829/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/208cb73b7cf84e265efd09e5b910e1c4081f1297","head":{"label":"danielmitterdorfer:feature/14620","ref":"feature/14620","sha":"208cb73b7cf84e265efd09e5b910e1c4081f1297","user":{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false},"repo":{"id":45385894,"name":"elasticsearch","full_name":"danielmitterdorfer/elasticsearch","owner":{"login":"danielmitterdorfer","id":1699576,"avatar_url":"https://avatars.githubusercontent.com/u/1699576?v=3","gravatar_id":"","url":"https://api.github.com/users/danielmitterdorfer","html_url":"https://github.com/danielmitterdorfer","followers_url":"https://api.github.com/users/danielmitterdorfer/followers","following_url":"https://api.github.com/users/danielmitterdorfer/following{/other_user}","gists_url":"https://api.github.com/users/danielmitterdorfer/gists{/gist_id}","starred_url":"https://api.github.com/users/danielmitterdorfer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielmitterdorfer/subscriptions","organizations_url":"https://api.github.com/users/danielmitterdorfer/orgs","repos_url":"https://api.github.com/users/danielmitterdorfer/repos","events_url":"https://api.github.com/users/danielmitterdorfer/events{/privacy}","received_events_url":"https://api.github.com/users/danielmitterdorfer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielmitterdorfer/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch","forks_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/forks","keys_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/teams","hooks_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/events","assignees_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/tags","blobs_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/subscription","commits_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/merges","archive_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/downloads","issues_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/danielmitterdorfer/elasticsearch/releases{/id}","created_at":"2015-11-02T09:51:30Z","updated_at":"2015-11-02T09:52:06Z","pushed_at":"2015-11-23T16:55:28Z","git_url":"git://github.com/danielmitterdorfer/elasticsearch.git","ssh_url":"git@github.com:danielmitterdorfer/elasticsearch.git","clone_url":"https://github.com/danielmitterdorfer/elasticsearch.git","svn_url":"https://github.com/danielmitterdorfer/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":179855,"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":"37d762914623c830714c942b95e11d728262b115","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-11-25T09:57:45Z","pushed_at":"2015-11-25T10:05:00Z","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":223170,"stargazers_count":13689,"watchers_count":13689,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4537,"mirror_url":null,"open_issues_count":1227,"forks":4537,"open_issues":1227,"watchers":13689,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/14829"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/14829"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/14829/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/14829/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/208cb73b7cf84e265efd09e5b910e1c4081f1297"}}}}