Skip to content

Commit 9b788cf

Browse files
committed
Refactoring: remove the broken shouldAttemptToRetryWriteAndAddRetryableLabel method
1 parent c7c4a0e commit 9b788cf

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

driver-core/src/main/com/mongodb/internal/operation/ClientBulkWriteOperation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
import static com.mongodb.internal.operation.AsyncOperationHelper.withAsyncSourceAndConnection;
131131
import static com.mongodb.internal.operation.BulkWriteBatch.logWriteModelDoesNotSupportRetries;
132132
import static com.mongodb.internal.operation.CommandOperationHelper.commandWriteConcern;
133+
import static com.mongodb.internal.operation.CommandOperationHelper.getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel;
133134
import static com.mongodb.internal.operation.CommandOperationHelper.initialRetryState;
134-
import static com.mongodb.internal.operation.CommandOperationHelper.shouldAttemptToRetryWriteAndAddRetryableLabel;
135135
import static com.mongodb.internal.operation.CommandOperationHelper.transformWriteException;
136136
import static com.mongodb.internal.operation.OperationHelper.isRetryableWrite;
137137
import static com.mongodb.internal.operation.SyncOperationHelper.cursorDocumentToBatchCursor;
@@ -321,7 +321,7 @@ private Integer executeBatch(
321321
// The server does not have a chance to add "RetryableWriteError" label to `e`,
322322
// and if it is the last attempt failure, `RetryingSyncSupplier` also may not have a chance
323323
// to add the label. So we do that explicitly.
324-
shouldAttemptToRetryWriteAndAddRetryableLabel(retryState, mongoException);
324+
getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel(retryState, mongoException);
325325
resultAccumulator.onBulkWriteCommandErrorWithoutResponse(mongoException);
326326
throw mongoException;
327327
}
@@ -386,7 +386,7 @@ private void executeBatchAsync(
386386
// The server does not have a chance to add "RetryableWriteError" label to `e`,
387387
// and if it is the last attempt failure, `RetryingSyncSupplier` also may not have a chance
388388
// to add the label. So we do that explicitly.
389-
shouldAttemptToRetryWriteAndAddRetryableLabel(retryState, mongoException);
389+
getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel(retryState, mongoException);
390390
resultAccumulator.onBulkWriteCommandErrorWithoutResponse(mongoException);
391391
c.completeExceptionally(mongoException);
392392
} else {

driver-core/src/main/com/mongodb/internal/operation/CommandOperationHelper.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,11 @@ static boolean loggingShouldAttemptToRetryWriteAndAddRetryableLabel(final RetryS
186186
return decision;
187187
}
188188

189-
static boolean shouldAttemptToRetryWriteAndAddRetryableLabel(final RetryState retryState, final Throwable attemptFailure) {
190-
return getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel(retryState, attemptFailure) != null;
191-
}
192-
193189
/**
194190
* @return {@code null} if the decision is {@code true}. Otherwise, returns the {@link Throwable} that must not be retried.
195191
*/
196192
@Nullable
197-
private static Throwable getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel(final RetryState retryState, final Throwable attemptFailure) {
193+
static Throwable getWriteAttemptFailureNotToBeRetriedOrAddRetryableLabel(final RetryState retryState, final Throwable attemptFailure) {
198194
Throwable failure = attemptFailure instanceof ResourceSupplierInternalException ? attemptFailure.getCause() : attemptFailure;
199195
boolean decision = false;
200196
MongoException exceptionRetryableRegardlessOfCommand = null;

0 commit comments

Comments
 (0)