@@ -210,6 +210,10 @@ private Integer executeBatch(
210
210
BatchEncoder batchEncoder = new BatchEncoder ();
211
211
Supplier <ExhaustiveBulkWriteCommandOkResponse > retryingBatchExecutor = decorateWriteWithRetries (
212
212
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.
213
217
() -> withSourceAndConnection (binding ::getWriteConnectionSource , true , (connectionSource , connection ) -> {
214
218
ConnectionDescription connectionDescription = connection .getDescription ();
215
219
boolean effectiveRetryWrites = isRetryableWrite (retryWritesSetting , effectiveWriteConcern , connectionDescription , sessionContext );
@@ -328,9 +332,6 @@ private BsonDocumentWrapper<?> createBulkWriteCommand(
328
332
final List <? extends ClientNamespacedWriteModel > unexecutedModels ,
329
333
final BatchEncoder batchEncoder ,
330
334
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.
334
335
return new BsonDocumentWrapper <>(
335
336
BULK_WRITE_COMMAND_NAME ,
336
337
new Encoder <String >() {
0 commit comments