This is an automated email from the ASF dual-hosted git repository.

marcuse pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 43eb2a4bde Avoid trying to get replication factor for 
system_cluster_metadata before we have a CMS
43eb2a4bde is described below

commit 43eb2a4bdee169e0f9338afab4f70009604997b2
Author: Marcus Eriksson <marc...@apache.org>
AuthorDate: Tue Jan 16 14:13:27 2024 +0100

    Avoid trying to get replication factor for system_cluster_metadata before 
we have a CMS
    
    Patch by marcuse; reviewed by Sam Tunnicliffe for CASSANDRA-19269
---
 src/java/org/apache/cassandra/locator/MetaStrategy.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/java/org/apache/cassandra/locator/MetaStrategy.java 
b/src/java/org/apache/cassandra/locator/MetaStrategy.java
index ac9685227e..a16d4e68bb 100644
--- a/src/java/org/apache/cassandra/locator/MetaStrategy.java
+++ b/src/java/org/apache/cassandra/locator/MetaStrategy.java
@@ -60,7 +60,9 @@ public class MetaStrategy extends SystemStrategy
     @Override
     public ReplicationFactor getReplicationFactor()
     {
-        ClusterMetadata metadata = ClusterMetadata.current();
+        ClusterMetadata metadata = ClusterMetadata.currentNullable();
+        if (metadata == null || metadata.epoch.isEqualOrBefore(Epoch.FIRST))
+            return ReplicationFactor.fullOnly(1);
         int rf = 
metadata.placements.get(ReplicationParams.meta(metadata)).writes.forRange(entireRange).get().byEndpoint.size();
         return ReplicationFactor.fullOnly(rf);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to