skoppu22 commented on code in PR #214:
URL: 
https://github.com/apache/cassandra-analytics/pull/214#discussion_r3365269670


##########
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:
   Here we are checking for replication_type value only. But the cluster need 
to have mutation_tracking.enabled to true for the feature to work at Cassandra 
side. Can you please explore what happens in Cassandra if a keyspace was 
created with replication_type = tracked, but then later admins changed 
mutation_tracking.enabled to false? Based on these findings we may need to 
check for mutation_tracking.enabled as well. 



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