mansikhara commented on code in PR #238:
URL: 
https://github.com/apache/cassandra-analytics/pull/238#discussion_r4020091351


##########
cassandra-analytics-common/src/main/java/org/apache/cassandra/spark/data/ReplicationFactor.java:
##########
@@ -108,11 +114,44 @@ public static ReplicationFactor simpleStrategy(int rf)
     private final ReplicationStrategy replicationStrategy;
     @NotNull
     private final Map<String, Integer> options;
+    /**
+     * Per-datacenter count of transient (witness) replicas, parsed from the 
{@code <replicas>/<transient>} form.
+     * A datacenter absent from this map has no transient replicas. Always 
empty for untracked keyspaces using the
+     * plain {@code <replicas>} form, which keeps behaviour identical for 
those keyspaces.
+     */
+    @NotNull
+    private final Map<String, Integer> transientOptions;
 
+    /**
+     * Lenient parse: a replication value that cannot be parsed is logged and 
its datacenter omitted. Retained for
+     * callers that tolerate a partial replication factor.
+     *
+     * @param options the raw replication map, including the {@code class} 
entry
+     */
     public ReplicationFactor(@NotNull Map<String, String> options)
+    {
+        this(options, false);
+    }
+
+    /**
+     * Strict parse: a replication value that cannot be parsed raises {@link 
IllegalArgumentException} naming the
+     * offending datacenter, rather than silently omitting it. Prefer this 
when a partial replication factor would
+     * produce a misleading failure later.
+     *
+     * @param options the raw replication map, including the {@code class} 
entry
+     * @return the parsed replication factor
+     * @throws IllegalArgumentException when any replication value cannot be 
parsed
+     */
+    public static ReplicationFactor parseStrict(@NotNull Map<String, String> 
options)
+    {
+        return new ReplicationFactor(options, true);
+    }
+
+    private ReplicationFactor(@NotNull Map<String, String> options, boolean 
strict)
     {
         this.replicationStrategy = 
ReplicationFactor.ReplicationStrategy.getEnum(options.get("class"));
         this.options = new LinkedHashMap<>(options.size());

Review Comment:
   Done!



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