File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
core/src/main/java/com/datastax/oss/driver/internal/core/pool Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -489,9 +489,21 @@ private CompletionStage<Boolean> addMissingChannels() {
489489 channels .length * wantedCount - Arrays .stream (channels ).mapToInt (ChannelSet ::size ).sum ();
490490 LOG .debug ("[{}] Trying to create {} missing channels" , logPrefix , missing );
491491 DriverChannelOptions options = buildDriverOptions ();
492- for (int i = 0 ; i < missing ; i ++) {
493- CompletionStage <DriverChannel > channelFuture = channelFactory .connect (node , options );
494- pendingChannels .add (channelFuture );
492+ for (int shard = 0 ; shard < channels .length ; shard ++) {
493+ LOG .trace (
494+ "[{}] Missing {} channels for shard {}" ,
495+ logPrefix ,
496+ wantedCount - channels [shard ].size (),
497+ shard );
498+ for (int p = channels [shard ].size (); p < wantedCount ; p ++) {
499+ CompletionStage <DriverChannel > channelFuture ;
500+ if (node .getShardingInfo () != null ) {
501+ channelFuture = channelFactory .connect (node , shard , options );
502+ } else {
503+ channelFuture = channelFactory .connect (node , options );
504+ }
505+ pendingChannels .add (channelFuture );
506+ }
495507 }
496508 return CompletableFutures .allDone (pendingChannels )
497509 .thenApplyAsync (this ::onAllConnected , adminExecutor );
You can’t perform that action at this time.
0 commit comments