Skip to content

CASSANALYTICS-194: Parse <replicas>/<transient> replication factor fo… - #238

Open
mansikhara wants to merge 3 commits into
apache:mutation-tracking-supportfrom
mansikhara:mutation-tracking-support
Open

CASSANALYTICS-194: Parse <replicas>/<transient> replication factor fo…#238
mansikhara wants to merge 3 commits into
apache:mutation-tracking-supportfrom
mansikhara:mutation-tracking-support

Conversation

@mansikhara

Copy link
Copy Markdown

…r witness-enabled keyspaces

Cassandra accepts a replication factor of the form /, which witness replicas under mutation tracking reuse, so a witness-enabled keyspace declares 'datacenter1': '3/1' meaning three replicas of which one is a witness.

CqlUtils.extractReplicationFactor() passed each datacenter value to Integer.parseInt, so a bulk read against any such keyspace failed during job setup with an uncaught NumberFormatException.

Transient counts are now tracked per datacenter alongside the existing totals and exposed through getFullReplicationFactor(), getTransientReplicationFactor(), getFullReplicas(dc), getTransientReplicas(dc) and hasTransientReplicas(). getTotalReplicationFactor() keeps its existing meaning of all replicas including witnesses, so behaviour for untracked keyspaces is unchanged. Parsing applies the same constraints Cassandra enforces in locator.ReplicationFactor.validate. A new parseStrict factory reports an unparseable or empty replication map at parse time rather than dropping the datacenter and failing later with a misleading "DC not found in replication factor"; the lenient constructor is retained unchanged for CDC callers. The Kryo serializer and CassandraRing's hand-rolled JDK readObject/writeObject are updated so the new field survives serialization to Spark executors.

Prerequisite for CASSANALYTICS-164.

mkhara added 3 commits August 28, 2026 15:03
…r witness-enabled keyspaces

Cassandra accepts a replication factor of the form <replicas>/<transient>, which witness
replicas under mutation tracking reuse, so a witness-enabled keyspace declares
'datacenter1': '3/1' meaning three replicas of which one is a witness.

CqlUtils.extractReplicationFactor() passed each datacenter value to Integer.parseInt, so a
bulk read against any such keyspace failed during job setup with an uncaught
NumberFormatException.

Transient counts are now tracked per datacenter alongside the existing totals and exposed
through getFullReplicationFactor(), getTransientReplicationFactor(), getFullReplicas(dc),
getTransientReplicas(dc) and hasTransientReplicas(). getTotalReplicationFactor() keeps its
existing meaning of all replicas including witnesses, so behaviour for untracked keyspaces
is unchanged. Parsing applies the same constraints Cassandra enforces in
locator.ReplicationFactor.validate. A new parseStrict factory reports an unparseable or
empty replication map at parse time rather than dropping the datacenter and failing later
with a misleading "DC not found in replication factor"; the lenient constructor is retained
unchanged for CDC callers. The Kryo serializer and CassandraRing's hand-rolled JDK
readObject/writeObject are updated so the new field survives serialization to Spark
executors.

Prerequisite for CASSANALYTICS-164.

patch by Mansi Khara; reviewed by TBD for CASSANALYTICS-194
…r witness-enabled keyspaces

Cassandra accepts a replication factor of the form <replicas>/<transient>, which witness
replicas under mutation tracking reuse, so a witness-enabled keyspace declares
'datacenter1': '3/1' meaning three replicas of which one is a witness.

CqlUtils.extractReplicationFactor() passed each datacenter value to Integer.parseInt, so a
bulk read against any such keyspace failed during job setup with an uncaught
NumberFormatException.

Transient counts are now tracked per datacenter alongside the existing totals and exposed
through getFullReplicationFactor(), getTransientReplicationFactor(), getFullReplicas(dc),
getTransientReplicas(dc) and hasTransientReplicas(). getTotalReplicationFactor() keeps its
existing meaning of all replicas including witnesses, so behaviour for untracked keyspaces
is unchanged. Parsing applies the same constraints Cassandra enforces in
locator.ReplicationFactor.validate. A new parseStrict factory reports an unparseable or
empty replication map at parse time rather than dropping the datacenter and failing later
with a misleading "DC not found in replication factor"; the lenient constructor is retained
unchanged for CDC callers. The Kryo serializer and CassandraRing's hand-rolled JDK
readObject/writeObject are updated so the new field survives serialization to Spark
executors.

Prerequisite for CASSANALYTICS-164.

patch by Mansi Khara; reviewed by TBD for CASSANALYTICS-194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant