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


##########
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);

Review Comment:
   Renamed to LoadBalancedCassandraClusterInfo and moved it out of the 
cloudstorage.coordinated package into bulkwriter, since it isn't specific to 
coordinated writes. The concrete type is now selected via 
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