tolbertam commented on code in PR #2007:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2007#discussion_r1934192173


##########
core/src/main/java/com/datastax/oss/driver/internal/core/session/PoolManager.java:
##########
@@ -221,18 +222,23 @@ private void init(CqlIdentifier keyspace) {
       stateEventFilter.start();
 
       Collection<Node> nodes = 
context.getMetadataManager().getMetadata().getNodes().values();
-      List<CompletionStage<ChannelPool>> poolStages = new 
ArrayList<>(nodes.size());
+      Map<Node, CompletionStage<ChannelPool>> poolStageByNode = new 
HashMap<>(nodes.size());

Review Comment:
   Making this change:
   
   ```diff
   --- 
a/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/InitialNodeListRefresh.java
   +++ 
b/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/InitialNodeListRefresh.java
   @@ -74,13 +74,8 @@ class InitialNodeListRefresh extends NodesRefresh {
                hostId);
          } else {
            EndPoint endPoint = nodeInfo.getEndPoint();
   -        DefaultNode node = findIn(contactPoints, endPoint);
   -        if (node == null) {
   -          node = new DefaultNode(endPoint, context);
   -          LOG.debug("[{}] Adding new node {}", logPrefix, node);
   -        } else {
   -          LOG.debug("[{}] Copying contact point {}", logPrefix, node);
   -        }
   +        DefaultNode node = new DefaultNode(endPoint, context);
   +        LOG.debug("[{}] Adding new node {}", logPrefix, node);
            if (tokenMapEnabled && tokenFactory == null && 
nodeInfo.getPartitioner() != null) {
              tokenFactory = 
tokenFactoryRegistry.tokenFactoryFor(nodeInfo.getPartitioner());
            }
   ```
   
   I'd probably change this code further to reutilize the node if the host id 
and token were the same.
   
   I see that connections are established for each node, and my test now fails 
(which is what I expected).
   
   I think if we were to change the logic such that we key pools by `EndPoint`, 
my test would now pass.
   
   Are you in ASF slack?  There's a 
[thread](https://the-asf.slack.com/archives/C05LPRVNZV1/p1738160135983149) for 
this issue here that Santosh Pingale started that maybe we can chat more 
interactively in there



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to