Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.elasticsearch.index.reindex;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
import org.elasticsearch.action.admin.cluster.node.tasks.list.TaskGroup;
Expand All @@ -37,6 +38,7 @@
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasSize;
Expand Down Expand Up @@ -191,13 +193,15 @@ private ListTasksResponse rethrottleTask(TaskId taskToRethrottle, float newReque
assertThat(rethrottleResponse.getTasks(), hasSize(1));
response.set(rethrottleResponse);
} catch (ElasticsearchException e) {
if (e.getCause() instanceof IllegalArgumentException) {
// We want to retry in this case so we throw an assertion error
logger.info("caught unprepared task, retrying until prepared");
throw new AssertionError("Rethrottle request for task [" + taskToRethrottle.getId() + "] failed", e);
} else {
Throwable unwrapped = ExceptionsHelper.unwrap(e, IllegalArgumentException.class);
if (unwrapped == null) {
throw e;
}
// We want to retry in this case so we throw an assertion error
assertThat(unwrapped.getMessage(), equalTo("task [" + taskToRethrottle.getId()
+ "] has not yet been initialized to the point where it knows how to rethrottle itself"));
logger.info("caught unprepared task, retrying until prepared");
throw new AssertionError("Rethrottle request for task [" + taskToRethrottle.getId() + "] failed", e);
}
});

Expand Down