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
This commit is contained in:
Marcus Eriksson 2024-01-16 14:13:27 +01:00
parent 7f354571f3
commit 43eb2a4bde
1 changed files with 3 additions and 1 deletions

View File

@ -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);
}