|
@@ -58,7 +58,7 @@ class BulkPrimaryExecutionContext {
|
|
|
private ItemProcessingState currentItemState;
|
|
|
private DocWriteRequest<?> requestToExecute;
|
|
|
private BulkItemResponse executionResult;
|
|
|
- private int retryCounter;
|
|
|
+ private int updateRetryCounter;
|
|
|
|
|
|
BulkPrimaryExecutionContext(BulkShardRequest request, IndexShard primary) {
|
|
|
this.request = request;
|
|
@@ -84,7 +84,7 @@ class BulkPrimaryExecutionContext {
|
|
|
: "moving to next but current item wasn't completed (state: " + currentItemState + ")";
|
|
|
currentItemState = ItemProcessingState.INITIAL;
|
|
|
currentIndex = findNextNonAborted(currentIndex + 1);
|
|
|
- retryCounter = 0;
|
|
|
+ updateRetryCounter = 0;
|
|
|
requestToExecute = null;
|
|
|
executionResult = null;
|
|
|
assert assertInvariants(ItemProcessingState.INITIAL);
|
|
@@ -105,9 +105,9 @@ class BulkPrimaryExecutionContext {
|
|
|
return executionResult;
|
|
|
}
|
|
|
|
|
|
- /** returns the number of times the current operation has been retried */
|
|
|
- public int getRetryCounter() {
|
|
|
- return retryCounter;
|
|
|
+ /** returns the number of times the current update operation has been retried */
|
|
|
+ public int getUpdateRetryCounter() {
|
|
|
+ return updateRetryCounter;
|
|
|
}
|
|
|
|
|
|
/** returns true if the request needs to wait for a mapping update to arrive from the master */
|
|
@@ -178,8 +178,19 @@ class BulkPrimaryExecutionContext {
|
|
|
assert assertInvariants(ItemProcessingState.WAIT_FOR_MAPPING_UPDATE);
|
|
|
}
|
|
|
|
|
|
+ public void resetForUpdateRetry() {
|
|
|
+ assert assertInvariants(ItemProcessingState.EXECUTED);
|
|
|
+ updateRetryCounter++;
|
|
|
+ resetForExecutionRetry();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void resetForMappingUpdateRetry() {
|
|
|
+ assert assertInvariants(ItemProcessingState.WAIT_FOR_MAPPING_UPDATE);
|
|
|
+ resetForExecutionRetry();
|
|
|
+ }
|
|
|
+
|
|
|
/** resets the current item state, prepare for a new execution */
|
|
|
- public void resetForExecutionForRetry() {
|
|
|
+ private void resetForExecutionRetry() {
|
|
|
assert assertInvariants(ItemProcessingState.WAIT_FOR_MAPPING_UPDATE, ItemProcessingState.EXECUTED);
|
|
|
currentItemState = ItemProcessingState.INITIAL;
|
|
|
requestToExecute = null;
|
|
@@ -292,7 +303,7 @@ class BulkPrimaryExecutionContext {
|
|
|
assert Arrays.asList(expectedCurrentState).contains(currentItemState)
|
|
|
: "expected current state [" + currentItemState + "] to be one of " + Arrays.toString(expectedCurrentState);
|
|
|
assert currentIndex >= 0 : currentIndex;
|
|
|
- assert retryCounter >= 0 : retryCounter;
|
|
|
+ assert updateRetryCounter >= 0 : updateRetryCounter;
|
|
|
switch (currentItemState) {
|
|
|
case INITIAL:
|
|
|
assert requestToExecute == null : requestToExecute;
|