sarankk commented on code in PR #214:
URL:
https://github.com/apache/cassandra-analytics/pull/214#discussion_r3502225986
##########
cassandra-analytics-common/src/main/java/org/apache/cassandra/spark/utils/CqlUtils.java:
##########
@@ -296,4 +299,33 @@ public static boolean isTimeRangeFilterSupported(String
compactionStrategy)
{
return compactionStrategy == null ||
compactionStrategy.endsWith("TimeWindowCompactionStrategy");
}
+
+ /**
+ * Extracts replication type from create schema statement
+ *
+ * @param schemaStr full cluster schema string as returned by Sidecar
+ * @param keyspace name of the keyspace to check
+ * @return {@code true} if keyspace is tracked {@code false} otherwise
+ */
+ public static String extractReplicationType(@NotNull String schemaStr,
@NotNull String keyspace)
+ {
+ String createKeyspaceSchema = extractKeyspaceSchema(schemaStr,
keyspace);
+ Matcher matcher =
REPLICATION_TYPE_PATTERN.matcher(createKeyspaceSchema);
+ if (matcher.find())
+ {
+ return matcher.group(1);
+ }
+ return null;
+ }
+
+ /**
+ * Returns {@code true} if {@code replication_type = 'tracked'} in create
statement otherwise {@code false}
+ *
+ * @param replicationType replication type extracted from create statement
+ * @return {@code true} if replication type is tracked {@code false}
otherwise
+ */
+ public static boolean isTracked(String replicationType)
+ {
+ return TRACKED_REPLICATION_TYPE.equalsIgnoreCase(replicationType);
Review Comment:
@skoppu22 I looked into this more, in Cassandra side during imports through
coordinated transfer Cassandra is only checking replication type so far, it is
not checking the cluster level flag. If replication type is tracked, regardless
of whether cluster level flag is enabled or disabled Cassandra takes the
coordinated transfer route, we should be good to use the `TrackedStreamSession`.
The scenario of what if the cluster level mutation tracking flag is turned
off after creating a tracked keyspace, needs further discussion and we can
leave that out of this PR
--
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]