bianca-stanciu29 commented on code in PR #223:
URL: 
https://github.com/apache/cassandra-analytics/pull/223#discussion_r3844644062


##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/cloudstorage/coordinated/CassandraClusterInfoGroup.java:
##########
@@ -95,7 +95,29 @@ public class CassandraClusterInfoGroup implements 
ClusterInfo, MultiClusterSuppo
      */
     public static CassandraClusterInfoGroup fromBulkSparkConf(BulkSparkConf 
conf)
     {
-        return fromBulkSparkConf(conf, clusterId -> new 
CassandraClusterInfo(conf, clusterId));
+        return fromBulkSparkConf(conf, clusterId -> createClusterInfo(conf, 
clusterId));
+    }
+
+    /**
+     * Selects the {@link CassandraClusterInfo} concrete type based on the
+     * {@link BulkSparkConf#sidecarBehindLoadBalancer} flag. Kept centralized 
so the
+     * driver-side factory and the executor-side broadcast reconstruction stay 
in lockstep.
+     */
+    private static CassandraClusterInfo createClusterInfo(BulkSparkConf conf, 
String clusterId)
+    {
+        if (conf.sidecarBehindLoadBalancer)
+        {
+            LOGGER.info("Using CoordinatedCassandraClusterInfo for 
load-balanced Sidecar. clusterId={}", clusterId);
+            return new CoordinatedCassandraClusterInfo(conf, clusterId);
+        }
+        return new CassandraClusterInfo(conf, clusterId);
+    }
+
+    private static CassandraClusterInfo 
createClusterInfo(BroadcastableClusterInfo bci)
+    {
+        return bci.getConf().sidecarBehindLoadBalancer
+               ? new CoordinatedCassandraClusterInfo(bci)

Review Comment:
   Done, same rename applied here, this now calls 
CassandraClusterInfo.create(...).



-- 
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