lukasz-antoniak commented on code in PR #169:
URL:
https://github.com/apache/cassandra-analytics/pull/169#discussion_r3447994341
##########
cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/data/CassandraDataLayer.java:
##########
@@ -324,6 +334,76 @@ private int initBulkReader(@NotNull ClientConfig options)
throws ExecutionExcept
return effectiveNumberOfCores;
}
+ /**
+ * Checks if SSTable version-based bridge selection is disabled.
+ * Protected to allow test overrides without SparkContext.
+ *
+ * @return true if disabled, false if enabled
+ */
+ @VisibleForTesting
+ protected boolean isSSTableVersionBasedBridgeDisabled()
+ {
+ return BulkSparkConf.getDisableSSTableVersionBasedBridge();
+ }
+
+ /**
+ * Initializes SSTable versions from cluster gossip and determines bridge
version.
+ *
+ * @param cassandraVersion the Cassandra version
+ * @return the determined bridge version
+ */
+ @VisibleForTesting
+ protected CassandraVersion
initializeSSTableVersionsAndBridgeVersion(String cassandraVersion)
+ {
+ // Check if user has explicitly disabled SSTable version-based
selection via Spark configuration
+ boolean isSSTableVersionBasedBridgeDisabled =
isSSTableVersionBasedBridgeDisabled();
+
+ // Get SSTable versions from cluster only if SSTable version-based
selection is enabled
+ // If disabled, use an empty set (never null) so downstream code -
including executor-side
+ // validation and serialization - needs no null handling. On executors
an empty set is the
+ // signal that the feature was disabled on the driver.
+ if (isSSTableVersionBasedBridgeDisabled)
+ {
+ //Use a HashSet, because Kryo serializer reads back via
kryo.readObject(in, HashSet.class)
+ this.sstableVersionsOnCluster = new HashSet<>();
+ }
+ else
+ {
+ this.sstableVersionsOnCluster =
retrieveSSTableVersionsFromCluster();
Review Comment:
`HashSet` is not guaranteed here, compare comment above.
--
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]