Search in sources :

Example 1 with RetryState

use of com.mongodb.internal.async.function.RetryState in project mongo-java-driver by mongodb.

the class CommandOperationHelper method executeRetryableWriteAsync.

static <T, R> void executeRetryableWriteAsync(final AsyncWriteBinding binding, final String database, final ReadPreference readPreference, final FieldNameValidator fieldNameValidator, final Decoder<T> commandResultDecoder, final CommandCreator commandCreator, final CommandWriteTransformerAsync<T, R> transformer, final Function<BsonDocument, BsonDocument> retryCommandModifier, final SingleResultCallback<R> callback) {
    RetryState retryState = initialRetryState(true);
    binding.retain();
    AsyncCallbackSupplier<R> asyncWrite = CommandOperationHelper.<R>decorateWriteWithRetries(retryState, funcCallback -> {
        logRetryExecute(retryState);
        boolean firstAttempt = retryState.isFirstAttempt();
        if (!firstAttempt && binding.getSessionContext().hasActiveTransaction()) {
            binding.getSessionContext().clearTransactionContext();
        }
        withAsyncSourceAndConnection(binding::getWriteConnectionSource, true, funcCallback, (source, connection, releasingCallback) -> {
            int maxWireVersion = connection.getDescription().getMaxWireVersion();
            SingleResultCallback<R> addingRetryableLabelCallback = firstAttempt ? releasingCallback : addingRetryableLabelCallback(releasingCallback, maxWireVersion);
            if (retryState.breakAndCompleteIfRetryAnd(() -> !canRetryWrite(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()), addingRetryableLabelCallback)) {
                return;
            }
            BsonDocument command;
            try {
                command = retryState.attachment(AttachmentKeys.command()).map(previousAttemptCommand -> {
                    assertFalse(firstAttempt);
                    return retryCommandModifier.apply(previousAttemptCommand);
                }).orElseGet(() -> commandCreator.create(source.getServerDescription(), connection.getDescription()));
                // attach `maxWireVersion`, `retryableCommandFlag` ASAP because they are used to check whether we should retry
                retryState.attach(AttachmentKeys.maxWireVersion(), maxWireVersion, true).attach(AttachmentKeys.retryableCommandFlag(), isRetryWritesEnabled(command), true).attach(AttachmentKeys.commandDescriptionSupplier(), command::getFirstKey, true).attach(AttachmentKeys.command(), command, false);
                logRetryExecute(retryState);
            } catch (Throwable t) {
                addingRetryableLabelCallback.onResult(null, t);
                return;
            }
            connection.commandAsync(database, command, fieldNameValidator, readPreference, commandResultDecoder, binding.getSessionContext(), binding.getServerApi(), binding.getRequestContext(), transformingWriteCallback(transformer, connection, addingRetryableLabelCallback));
        });
    }).whenComplete(binding::release);
    asyncWrite.get(exceptionTransformingCallback(errorHandlingCallback(callback, LOGGER)));
}
Also used : AsyncReadBinding(com.mongodb.internal.binding.AsyncReadBinding) ServerDescription(com.mongodb.connection.ServerDescription) MongoClientException(com.mongodb.MongoClientException) Function(com.mongodb.Function) MongoSocketException(com.mongodb.MongoSocketException) ConnectionDescription(com.mongodb.connection.ConnectionDescription) Arrays.asList(java.util.Arrays.asList) MongoNotPrimaryException(com.mongodb.MongoNotPrimaryException) OperationHelper.canRetryRead(com.mongodb.internal.operation.OperationHelper.canRetryRead) MongoNodeIsRecoveringException(com.mongodb.MongoNodeIsRecoveringException) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoException(com.mongodb.MongoException) ConnectionSource(com.mongodb.internal.binding.ConnectionSource) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) ReadBinding(com.mongodb.internal.binding.ReadBinding) Assertions.assertFalse(com.mongodb.assertions.Assertions.assertFalse) MongoServerException(com.mongodb.MongoServerException) String.format(java.lang.String.format) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) PRIVATE(com.mongodb.internal.VisibleForTesting.AccessModifier.PRIVATE) RetryState(com.mongodb.internal.async.function.RetryState) List(java.util.List) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) ResourceSupplierInternalException(com.mongodb.internal.operation.OperationHelper.ResourceSupplierInternalException) ReadPreference.primary(com.mongodb.ReadPreference.primary) RetryingSyncSupplier(com.mongodb.internal.async.function.RetryingSyncSupplier) ReadPreference(com.mongodb.ReadPreference) RetryingAsyncCallbackSupplier(com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier) MongoCommandException(com.mongodb.MongoCommandException) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) WriteBinding(com.mongodb.internal.binding.WriteBinding) Assertions(com.mongodb.assertions.Assertions) MongoConnectionPoolClearedException(com.mongodb.MongoConnectionPoolClearedException) VisibleForTesting(com.mongodb.internal.VisibleForTesting) AsyncWriteBinding(com.mongodb.internal.binding.AsyncWriteBinding) AsyncConnectionSource(com.mongodb.internal.binding.AsyncConnectionSource) FieldNameValidator(org.bson.FieldNameValidator) OperationHelper.canRetryWrite(com.mongodb.internal.operation.OperationHelper.canRetryWrite) BsonDocumentCodec(org.bson.codecs.BsonDocumentCodec) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) Nullable(com.mongodb.lang.Nullable) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) AttachmentKeys(com.mongodb.internal.operation.retry.AttachmentKeys) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) BsonDocument(org.bson.BsonDocument) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) RetryState(com.mongodb.internal.async.function.RetryState)

Example 2 with RetryState

use of com.mongodb.internal.async.function.RetryState in project mongo-java-driver by mongodb.

the class FindOperation method execute.

@Override
public BatchCursor<T> execute(final ReadBinding binding) {
    RetryState retryState = initialRetryState(retryReads);
    Supplier<BatchCursor<T>> read = decorateReadWithRetries(retryState, () -> {
        logRetryExecute(retryState);
        return withSourceAndConnection(binding::getReadConnectionSource, false, (source, connection) -> {
            retryState.breakAndThrowIfRetryAnd(() -> !canRetryRead(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()));
            if (serverIsAtLeastVersionThreeDotTwo(connection.getDescription())) {
                try {
                    return createReadCommandAndExecute(retryState, binding, source, namespace.getDatabaseName(), getCommandCreator(binding.getSessionContext()), CommandResultDocumentCodec.create(decoder, FIRST_BATCH), transformer(), connection);
                } catch (MongoCommandException e) {
                    throw new MongoQueryException(e);
                }
            } else {
                retryState.markAsLastAttempt();
                validateFindOptions(connection, binding.getSessionContext().getReadConcern(), collation, allowDiskUse);
                QueryResult<T> queryResult = connection.query(namespace, asDocument(connection.getDescription(), binding.getReadPreference()), projection, skip, limit, batchSize, isSecondaryOk() || binding.getReadPreference().isSecondaryOk(), isTailableCursor(), isAwaitData(), isNoCursorTimeout(), isPartial(), isOplogReplay(), decoder, binding.getRequestContext());
                return new QueryBatchCursor<>(queryResult, limit, batchSize, getMaxTimeForCursor(), decoder, source, connection);
            }
        });
    });
    return read.get();
}
Also used : AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) MongoCommandException(com.mongodb.MongoCommandException) MongoQueryException(com.mongodb.MongoQueryException) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) RetryState(com.mongodb.internal.async.function.RetryState)

Example 3 with RetryState

use of com.mongodb.internal.async.function.RetryState in project mongo-java-driver by mongodb.

the class ListIndexesOperation method execute.

@Override
public BatchCursor<T> execute(final ReadBinding binding) {
    RetryState retryState = initialRetryState(retryReads);
    Supplier<BatchCursor<T>> read = decorateReadWithRetries(retryState, () -> {
        logRetryExecute(retryState);
        return withSourceAndConnection(binding::getReadConnectionSource, false, (source, connection) -> {
            retryState.breakAndThrowIfRetryAnd(() -> !canRetryRead(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()));
            if (serverIsAtLeastVersionThreeDotZero(connection.getDescription())) {
                try {
                    return createReadCommandAndExecute(retryState, binding, source, namespace.getDatabaseName(), getCommandCreator(), createCommandDecoder(), transformer(), connection);
                } catch (MongoCommandException e) {
                    return rethrowIfNotNamespaceError(e, createEmptyBatchCursor(namespace, decoder, source.getServerDescription().getAddress(), batchSize));
                }
            } else {
                retryState.markAsLastAttempt();
                return new QueryBatchCursor<>(connection.query(getIndexNamespace(), asQueryDocument(connection.getDescription(), binding.getReadPreference()), null, 0, 0, batchSize, binding.getReadPreference().isSecondaryOk(), false, false, false, false, false, decoder, binding.getRequestContext()), 0, batchSize, decoder, source);
            }
        });
    });
    return read.get();
}
Also used : OperationHelper.cursorDocumentToBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToBatchCursor) OperationHelper.createEmptyBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyBatchCursor) OperationHelper.cursorDocumentToAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToAsyncBatchCursor) AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) OperationHelper.createEmptyAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyAsyncBatchCursor) MongoCommandException(com.mongodb.MongoCommandException) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) RetryState(com.mongodb.internal.async.function.RetryState)

Example 4 with RetryState

use of com.mongodb.internal.async.function.RetryState in project mongo-java-driver by mongodb.

the class ListIndexesOperation method executeAsync.

@Override
public void executeAsync(final AsyncReadBinding binding, final SingleResultCallback<AsyncBatchCursor<T>> callback) {
    RetryState retryState = initialRetryState(retryReads);
    binding.retain();
    AsyncCallbackSupplier<AsyncBatchCursor<T>> asyncRead = CommandOperationHelper.<AsyncBatchCursor<T>>decorateReadWithRetries(retryState, funcCallback -> {
        logRetryExecute(retryState);
        withAsyncSourceAndConnection(binding::getReadConnectionSource, false, funcCallback, (source, connection, releasingCallback) -> {
            if (retryState.breakAndCompleteIfRetryAnd(() -> !canRetryRead(source.getServerDescription(), connection.getDescription(), binding.getSessionContext()), releasingCallback)) {
                return;
            }
            if (serverIsAtLeastVersionThreeDotZero(connection.getDescription())) {
                createReadCommandAndExecuteAsync(retryState, binding, source, namespace.getDatabaseName(), getCommandCreator(), createCommandDecoder(), asyncTransformer(), connection, (result, t) -> {
                    if (t != null && !isNamespaceError(t)) {
                        releasingCallback.onResult(null, t);
                    } else {
                        releasingCallback.onResult(result != null ? result : emptyAsyncCursor(source), null);
                    }
                });
            } else {
                retryState.markAsLastAttempt();
                connection.queryAsync(getIndexNamespace(), asQueryDocument(connection.getDescription(), binding.getReadPreference()), null, 0, 0, batchSize, binding.getReadPreference().isSecondaryOk(), false, false, false, false, false, decoder, binding.getRequestContext(), new SingleResultCallback<QueryResult<T>>() {

                    @Override
                    public void onResult(final QueryResult<T> result, final Throwable t) {
                        if (t != null) {
                            releasingCallback.onResult(null, t);
                        } else {
                            releasingCallback.onResult(new AsyncQueryBatchCursor<T>(result, 0, batchSize, 0, decoder, source, connection), null);
                        }
                    }
                });
            }
        });
    }).whenComplete(binding::release);
    asyncRead.get(errorHandlingCallback(callback, LOGGER));
}
Also used : ReadPreference(com.mongodb.ReadPreference) AsyncReadBinding(com.mongodb.internal.binding.AsyncReadBinding) ServerDescription(com.mongodb.connection.ServerDescription) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) CommandOperationHelper.logRetryExecute(com.mongodb.internal.operation.CommandOperationHelper.logRetryExecute) CommandCreator(com.mongodb.internal.operation.CommandOperationHelper.CommandCreator) OperationHelper.cursorDocumentToBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToBatchCursor) MongoCommandException(com.mongodb.MongoCommandException) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) CommandReadTransformer(com.mongodb.internal.operation.CommandOperationHelper.CommandReadTransformer) BsonString(org.bson.BsonString) CommandOperationHelper.createReadCommandAndExecuteAsync(com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecuteAsync) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) ConnectionDescription(com.mongodb.connection.ConnectionDescription) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) SHARD_ROUTER(com.mongodb.connection.ServerType.SHARD_ROUTER) BsonInt64(org.bson.BsonInt64) AsyncConnectionSource(com.mongodb.internal.binding.AsyncConnectionSource) CommandOperationHelper.isNamespaceError(com.mongodb.internal.operation.CommandOperationHelper.isNamespaceError) CursorHelper.getCursorDocumentFromBatchSize(com.mongodb.internal.operation.CursorHelper.getCursorDocumentFromBatchSize) OperationHelper.canRetryRead(com.mongodb.internal.operation.OperationHelper.canRetryRead) OperationHelper.createEmptyBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyBatchCursor) QueryResult(com.mongodb.internal.connection.QueryResult) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoNamespace(com.mongodb.MongoNamespace) ConnectionSource(com.mongodb.internal.binding.ConnectionSource) CommandOperationHelper.createReadCommandAndExecute(com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecute) ReadBinding(com.mongodb.internal.binding.ReadBinding) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) OperationHelper.cursorDocumentToAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToAsyncBatchCursor) CommandOperationHelper.rethrowIfNotNamespaceError(com.mongodb.internal.operation.CommandOperationHelper.rethrowIfNotNamespaceError) CommandOperationHelper.decorateReadWithRetries(com.mongodb.internal.operation.CommandOperationHelper.decorateReadWithRetries) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) Decoder(org.bson.codecs.Decoder) TimeUnit(java.util.concurrent.TimeUnit) CommandReadTransformerAsync(com.mongodb.internal.operation.CommandOperationHelper.CommandReadTransformerAsync) RetryState(com.mongodb.internal.async.function.RetryState) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) Codec(org.bson.codecs.Codec) ReadPreference.primary(com.mongodb.ReadPreference.primary) OperationHelper.createEmptyAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyAsyncBatchCursor) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) ServerVersionHelper.serverIsAtLeastVersionThreeDotZero(com.mongodb.internal.operation.ServerVersionHelper.serverIsAtLeastVersionThreeDotZero) QueryResult(com.mongodb.internal.connection.QueryResult) OperationHelper.cursorDocumentToAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.cursorDocumentToAsyncBatchCursor) AsyncBatchCursor(com.mongodb.internal.async.AsyncBatchCursor) OperationHelper.createEmptyAsyncBatchCursor(com.mongodb.internal.operation.OperationHelper.createEmptyAsyncBatchCursor) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) CommandOperationHelper.initialRetryState(com.mongodb.internal.operation.CommandOperationHelper.initialRetryState) RetryState(com.mongodb.internal.async.function.RetryState)

Example 5 with RetryState

use of com.mongodb.internal.async.function.RetryState in project mongo-java-driver by mongodb.

the class MixedBulkWriteOperation method executeAsync.

public void executeAsync(final AsyncWriteBinding binding, final SingleResultCallback<BulkWriteResult> callback) {
    // see the comment in `execute(WriteBinding)` explaining the manual tracking of attempts
    RetryState retryState = new RetryState();
    BulkWriteTracker.attachNew(retryState, retryWrites);
    binding.retain();
    AsyncCallbackSupplier<BulkWriteResult> retryingBulkWrite = this.<BulkWriteResult>decorateWriteWithRetries(retryState, funcCallback -> {
        logRetryExecute(retryState);
        withAsyncSourceAndConnection(binding::getWriteConnectionSource, true, funcCallback, (source, connection, releasingCallback) -> {
            ConnectionDescription connectionDescription = connection.getDescription();
            int maxWireVersion = connectionDescription.getMaxWireVersion();
            // attach `maxWireVersion` ASAP because it is used to check whether we can retry
            retryState.attach(AttachmentKeys.maxWireVersion(), maxWireVersion, true);
            BulkWriteTracker bulkWriteTracker = retryState.attachment(AttachmentKeys.bulkWriteTracker()).orElseThrow(Assertions::fail);
            SessionContext sessionContext = binding.getSessionContext();
            WriteConcern writeConcern = getAppliedWriteConcern(sessionContext);
            if (!retryState.isFirstAttempt() && !isRetryableWrite(retryWrites, writeConcern, source.getServerDescription(), connectionDescription, sessionContext)) {
                Throwable prospectiveFailedResult = retryState.exception().orElse(null);
                if (retryState.breakAndCompleteIfRetryAnd(() -> !(prospectiveFailedResult instanceof MongoWriteConcernWithResponseException), releasingCallback)) {
                    return;
                }
                bulkWriteTracker.batch().ifPresent(bulkWriteBatch -> {
                    assertTrue(prospectiveFailedResult instanceof MongoWriteConcernWithResponseException);
                    bulkWriteBatch.addResult((BsonDocument) ((MongoWriteConcernWithResponseException) prospectiveFailedResult).getResponse());
                    BulkWriteTracker.attachNext(retryState, bulkWriteBatch);
                });
            }
            if (validateWriteRequestsAndCompleteIfInvalid(connectionDescription, bypassDocumentValidation, writeRequests, writeConcern, releasingCallback)) {
                return;
            }
            if (writeConcern.isAcknowledged() || serverIsAtLeastVersionThreeDotSix(connectionDescription)) {
                try {
                    if (!bulkWriteTracker.batch().isPresent()) {
                        BulkWriteTracker.attachNew(retryState, BulkWriteBatch.createBulkWriteBatch(namespace, source.getServerDescription(), connectionDescription, ordered, writeConcern, bypassDocumentValidation, retryWrites, writeRequests, sessionContext));
                    }
                } catch (Throwable t) {
                    releasingCallback.onResult(null, t);
                    return;
                }
                logRetryExecute(retryState);
                executeBulkWriteBatchAsync(retryState, binding, connection, maxWireVersion, releasingCallback);
            } else {
                retryState.markAsLastAttempt();
                executeLegacyBatchesAsync(binding, connection, releasingCallback);
            }
        });
    }).whenComplete(binding::release);
    retryingBulkWrite.get(exceptionTransformingCallback(errorHandlingCallback(callback, LOGGER)));
}
Also used : LoopState(com.mongodb.internal.async.function.LoopState) WriteRequest(com.mongodb.internal.bulk.WriteRequest) CommandOperationHelper.addRetryableWriteErrorLabel(com.mongodb.internal.operation.CommandOperationHelper.addRetryableWriteErrorLabel) MongoBulkWriteException(com.mongodb.MongoBulkWriteException) MongoWriteConcernWithResponseException(com.mongodb.internal.connection.MongoWriteConcernWithResponseException) ProtocolHelper(com.mongodb.internal.connection.ProtocolHelper) ConnectionDescription(com.mongodb.connection.ConnectionDescription) BsonArray(org.bson.BsonArray) OperationHelper.validateWriteRequests(com.mongodb.internal.operation.OperationHelper.validateWriteRequests) OperationHelper.withSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withSourceAndConnection) MongoException(com.mongodb.MongoException) AsyncCallbackSupplier(com.mongodb.internal.async.function.AsyncCallbackSupplier) Set(java.util.Set) Collectors(java.util.stream.Collectors) AsyncCallbackRunnable(com.mongodb.internal.async.function.AsyncCallbackRunnable) ServerVersionHelper.serverIsAtLeastVersionThreeDotSix(com.mongodb.internal.operation.ServerVersionHelper.serverIsAtLeastVersionThreeDotSix) SingleResultCallback(com.mongodb.internal.async.SingleResultCallback) REPLACE(com.mongodb.internal.bulk.WriteRequest.Type.REPLACE) RetryState(com.mongodb.internal.async.function.RetryState) List(java.util.List) Assertions.notNull(com.mongodb.assertions.Assertions.notNull) Optional(java.util.Optional) RetryingSyncSupplier(com.mongodb.internal.async.function.RetryingSyncSupplier) InsertRequest(com.mongodb.internal.bulk.InsertRequest) RetryingAsyncCallbackSupplier(com.mongodb.internal.async.function.RetryingAsyncCallbackSupplier) CommandOperationHelper.logRetryExecute(com.mongodb.internal.operation.CommandOperationHelper.logRetryExecute) CommandOperationHelper.exceptionTransformingCallback(com.mongodb.internal.operation.CommandOperationHelper.exceptionTransformingCallback) ErrorHandlingResultCallback.errorHandlingCallback(com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback) BsonString(org.bson.BsonString) Supplier(java.util.function.Supplier) BsonDocument(org.bson.BsonDocument) LOGGER(com.mongodb.internal.operation.OperationHelper.LOGGER) Connection(com.mongodb.internal.connection.Connection) NoOpFieldNameValidator(com.mongodb.internal.validator.NoOpFieldNameValidator) WriteBinding(com.mongodb.internal.binding.WriteBinding) Assertions(com.mongodb.assertions.Assertions) WriteConcernResult(com.mongodb.WriteConcernResult) AsyncCallbackLoop(com.mongodb.internal.async.function.AsyncCallbackLoop) AsyncWriteBinding(com.mongodb.internal.binding.AsyncWriteBinding) DeleteRequest(com.mongodb.internal.bulk.DeleteRequest) SessionContext(com.mongodb.internal.session.SessionContext) FieldNameValidator(org.bson.FieldNameValidator) OperationHelper.validateWriteRequestsAndCompleteIfInvalid(com.mongodb.internal.operation.OperationHelper.validateWriteRequestsAndCompleteIfInvalid) INSERT(com.mongodb.internal.bulk.WriteRequest.Type.INSERT) MongoNamespace(com.mongodb.MongoNamespace) UpdateRequest(com.mongodb.internal.bulk.UpdateRequest) OperationHelper.isRetryableWrite(com.mongodb.internal.operation.OperationHelper.isRetryableWrite) CommandOperationHelper.transformWriteException(com.mongodb.internal.operation.CommandOperationHelper.transformWriteException) Assertions.isTrueArgument(com.mongodb.assertions.Assertions.isTrueArgument) Assertions.assertTrue(com.mongodb.assertions.Assertions.assertTrue) OperationHelper.withAsyncSourceAndConnection(com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection) BulkWriteResult(com.mongodb.bulk.BulkWriteResult) Nullable(com.mongodb.lang.Nullable) WriteConcern(com.mongodb.WriteConcern) UPDATE(com.mongodb.internal.bulk.WriteRequest.Type.UPDATE) AsyncConnection(com.mongodb.internal.connection.AsyncConnection) AttachmentKeys(com.mongodb.internal.operation.retry.AttachmentKeys) ConnectionDescription(com.mongodb.connection.ConnectionDescription) MongoWriteConcernWithResponseException(com.mongodb.internal.connection.MongoWriteConcernWithResponseException) BsonDocument(org.bson.BsonDocument) WriteConcern(com.mongodb.WriteConcern) SessionContext(com.mongodb.internal.session.SessionContext) BulkWriteResult(com.mongodb.bulk.BulkWriteResult) RetryState(com.mongodb.internal.async.function.RetryState)

Aggregations

RetryState (com.mongodb.internal.async.function.RetryState)12 MongoCommandException (com.mongodb.MongoCommandException)9 ConnectionDescription (com.mongodb.connection.ConnectionDescription)8 Assertions.notNull (com.mongodb.assertions.Assertions.notNull)7 ErrorHandlingResultCallback.errorHandlingCallback (com.mongodb.internal.async.ErrorHandlingResultCallback.errorHandlingCallback)7 SingleResultCallback (com.mongodb.internal.async.SingleResultCallback)7 AsyncCallbackSupplier (com.mongodb.internal.async.function.AsyncCallbackSupplier)7 AsyncConnection (com.mongodb.internal.connection.AsyncConnection)7 Connection (com.mongodb.internal.connection.Connection)7 LOGGER (com.mongodb.internal.operation.OperationHelper.LOGGER)7 OperationHelper.withAsyncSourceAndConnection (com.mongodb.internal.operation.OperationHelper.withAsyncSourceAndConnection)7 OperationHelper.withSourceAndConnection (com.mongodb.internal.operation.OperationHelper.withSourceAndConnection)7 Supplier (java.util.function.Supplier)7 BsonDocument (org.bson.BsonDocument)7 ReadPreference (com.mongodb.ReadPreference)6 ReadPreference.primary (com.mongodb.ReadPreference.primary)6 ServerDescription (com.mongodb.connection.ServerDescription)6 AsyncBatchCursor (com.mongodb.internal.async.AsyncBatchCursor)6 AsyncConnectionSource (com.mongodb.internal.binding.AsyncConnectionSource)6 AsyncReadBinding (com.mongodb.internal.binding.AsyncReadBinding)6