Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 14bb86e

Browse files
committedSep 10, 2024·
Improve code comments in ClientBulkWriteOperation
JAVA-5528
1 parent ec88c02 commit 14bb86e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ private Integer executeBatch(
210210
BatchEncoder batchEncoder = new BatchEncoder();
211211
Supplier<ExhaustiveBulkWriteCommandOkResponse> retryingBatchExecutor = decorateWriteWithRetries(
212212
retryState, operationContext,
213+
// Each batch re-selects a server and re-checks out a connection because this is simpler,
214+
// and it is allowed by https://jira.mongodb.org/browse/DRIVERS-2502.
215+
// If connection pinning is required, {@code binding} handles that,
216+
// and `ClientSession`, `TransactionContext` are aware of that.
213217
() -> withSourceAndConnection(binding::getWriteConnectionSource, true, (connectionSource, connection) -> {
214218
ConnectionDescription connectionDescription = connection.getDescription();
215219
boolean effectiveRetryWrites = isRetryableWrite(retryWritesSetting, effectiveWriteConcern, connectionDescription, sessionContext);
@@ -328,9 +332,6 @@ private BsonDocumentWrapper<?> createBulkWriteCommand(
328332
final List<? extends ClientNamespacedWriteModel> unexecutedModels,
329333
final BatchEncoder batchEncoder,
330334
final Runnable ifCommandIsRetryable) {
331-
// BULK-TODO This implementation must limit the number of `models` it includes in a batch if needed.
332-
// Each batch re-selects a server and re-checks out a connection because this is simpler and it is allowed,
333-
// see https://mongodb.slack.com/archives/C035ZJL6CQN/p1722265720037099?thread_ts=1722264610.664109&cid=C035ZJL6CQN.
334335
return new BsonDocumentWrapper<>(
335336
BULK_WRITE_COMMAND_NAME,
336337
new Encoder<String>() {

0 commit comments

Comments
 (0)
Please sign in to comment.