The BulkWrite
command throws a ClientBulkWriteException
when there is a conflict issue. However, this exception does not include the TransientTransactionError
label, which is only present in the InnerException
.
As a result, the session.WithTransactionAsync
method does not automatically retry the operation, as it should.
Steps to Reproduce:
- Execute a
BulkWrite
operation inside asession.WithTransactionAsync
block. - Introduce a transient conflict error (e.g., a write conflict).
- Observe that the operation fails without retrying, even though retries are expected in this scenario.
Expected Behavior:
The ClientBulkWriteException
should include the TransientTransactionError
label to ensure session.WithTransactionAsync
retries the operation as intended.
Actual Behavior:
The TransientTransactionError
label is present only in the InnerException
, and the session.WithTransactionAsync
method does not retry the operation.
Environment Details:
- MongoDB Server version: [Your version here]
- Driver version: [Your driver version here]
- OS: [Your OS here]
Additional Notes:
This issue disrupts the expected behavior of transaction retries and can lead to manual intervention for handling retries.
Exception example:
"StackTrace" : [ "at MongoDB.Driver.Core.Operations.ClientBulkWriteOperation.EnsureCanProceedNextBatch(ConnectionId connectionId, BulkWriteRawResult bulkWriteResult)", "at MongoDB.Driver.Core.Operations.ClientBulkWriteOperation.ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)", "at MongoDB.Driver.OperationExecutor.ExecuteWriteOperationAsync[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)", "at MongoDB.Driver.MongoClient.ExecuteWriteOperationAsync[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)", "[Prop] ErrorLabels" : [ ], "ExceptionType" : "ClientBulkWriteException", "InnerExceptions" : [ { "StackTrace" : [ "at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)", "at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.SendMessageAndProcessResponseAsync(CommandRequestMessage message, Int32 responseTo, IConnection connection, CancellationToken cancellationToken)", "at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)", "at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)", "at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.ExecuteAsync[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)", "ExceptionType" : "MongoCommandException", "[Prop] ErrorLabels" : [ "TransientTransactionError" ]