cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] ifesdjeen commented on a change in pull request #539: CASSANDRA-15733 jvm dtest builder should be provided to the factory and expose state
Date Fri, 17 Apr 2020 08:43:15 GMT
ifesdjeen commented on a change in pull request #539: CASSANDRA-15733 jvm dtest builder should
be provided to the factory and expose state
URL: https://github.com/apache/cassandra/pull/539#discussion_r410079877
 
 

 ##########
 File path: test/distributed/org/apache/cassandra/distributed/impl/AbstractCluster.java
 ##########
 @@ -241,26 +249,53 @@ public void uncaughtException(Thread thread, Throwable throwable)
         }
     }
 
-    protected AbstractCluster(File root, Versions.Version initialVersion, List<IInstanceConfig>
configs,
-                              ClassLoader sharedClassLoader)
+    protected AbstractCluster(AbstractBuilder builder)
     {
-        this.root = root;
-        this.sharedClassLoader = sharedClassLoader;
+        this.root = builder.getRoot();
+        this.sharedClassLoader = builder.getSharedClassLoader();
+        this.subnet = builder.getSubnet();
+        this.tokenSupplier = builder.getTokenSupplier();
+        this.nodeIdTopology = builder.getNodeIdTopology();
+        this.configUpdater = builder.getConfigUpdater();
         this.instances = new ArrayList<>();
         this.instanceMap = new HashMap<>();
-        this.initialVersion = initialVersion;
-        int generation = AbstractCluster.generation.incrementAndGet();
+        this.initialVersion = builder.getVersion();
+        this.filters = new MessageFilters();
 
-        for (IInstanceConfig config : configs)
+        int generation = AbstractCluster.generation.incrementAndGet();
+        for (int i = 0; i < builder.getNodeCount(); ++i)
         {
+            int nodeNum = i + 1;
+            InstanceConfig config = createInstanceConfig(nodeNum);
+
             I instance = newInstanceWrapperInternal(generation, initialVersion, config);
             instances.add(instance);
             // we use the config().broadcastAddressAndPort() here because we have not initialised
the Instance
             I prev = instanceMap.put(instance.broadcastAddress(), instance);
             if (null != prev)
                 throw new IllegalStateException("Cluster cannot have multiple nodes with
same InetAddressAndPort: " + instance.broadcastAddress() + " vs " + prev.broadcastAddress());
         }
-        this.filters = new MessageFilters();
+    }
+
+    public InstanceConfig newInstanceConfig()
+    {
+        return createInstanceConfig(size() + 1);
+    }
+
+    private InstanceConfig createInstanceConfig(int nodeNum)
 
 Review comment:
   I was thinking about specific code that we have right now, not about theoretical cluster
implementation that would change seed, tbh. I'm mostly concerned about us having to modify
this code in several places instead of one in the future, but since the goal of API was to
create a common interface and not to reduce the amount of duplication, I don't mind.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message