{"record":{"id":"f5883cecd8f994ad","repo":"apache/cassandra","slug":"your-replication-factor-for-keyspace-is-high","errorCode":null,"errorMessage":"Your replication factor {} for keyspace {} is higher than the number of nodes {} for datacenter {}","messagePattern":"Your replication factor (.+?) for keyspace (.+?) is higher than the number of nodes (.+?) for datacenter (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java","lineNumber":409,"sourceCode":"            Multimap<String, InetAddressAndPort> dcsNodes = directory.allDatacenterEndpoints();\n            for (Entry<String, String> e : this.configOptions.entrySet())\n            {\n                String dc = e.getKey();\n                ReplicationFactor rf = getReplicationFactor(dc);\n                Guardrails.minimumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);\n                Guardrails.maximumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);\n                int nodeCount = dcsNodes.containsKey(dc) ? dcsNodes.get(dc).size() : 0;\n                // nodeCount==0 on many tests\n                if (rf.fullReplicas > nodeCount && nodeCount != 0)\n                {\n                    String msg = \"Your replication factor \" + rf.fullReplicas\n                                 + \" for keyspace \"\n                                 + keyspaceName\n                                 + \" is higher than the number of nodes \"\n                                 + nodeCount\n                                 + \" for datacenter \"\n                                 + dc;\n                    ClientWarn.instance.warn(msg);\n                    logger.warn(msg);\n                }\n            }\n        }\n    }\n\n    @Override\n    public boolean hasSameSettings(AbstractReplicationStrategy other)\n    {\n        return super.hasSameSettings(other) && ((NetworkTopologyStrategy) other).datacenters.equals(datacenters);\n    }\n}\n","sourceCodeStart":391,"sourceCodeEnd":422,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java#L391-L422","documentation":"NetworkTopologyStrategy.maybeWarnOnOptions (via shouldWarnOnHigherReplicationFactorThanNodesInDC) warns when a keyspace's NetworkTopologyStrategy replication_factor for a datacenter exceeds the number of nodes actually present in that DC. The message goes both to the client (ClientWarn) and the server log. Extra replicas beyond node count silently cap at node count, so the warning points out configuration that does not do what the user expects.","triggerScenarios":"CREATE/ALTER KEYSPACE WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'} when dc1 currently has fewer than 3 nodes; evaluated when strategy options are validated during schema operations.","commonSituations":"Bootstrap in progress: RF set for planned capacity before nodes arrive; typo'd DC name mapping RF onto a near-empty DC; copied prod schema with RF=3 applied to a 1-node dev/staging DC.","solutions":["Lower RF to the current node count, or bootstrap the planned nodes first.","ALTER KEYSPACE ... WITH replication = {'class':'NetworkTopologyStrategy','dc1':'1'} then run a full repair to converge.","Check nodetool status per DC to confirm actual node counts and DC names match the strategy keys.","If nodes are planned, bootstrap them; the warning clears once nodeCount >= RF.","Run repair after RF changes so data is fully replicated on the intended nodes."],"exampleFix":"// before\nALTER KEYSPACE myks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'3'}; -- dc1 has 1 node\n// after\nALTER KEYSPACE myks WITH replication = {'class':'NetworkTopologyStrategy','dc1':'1'};\n-- then: nodetool repair -full myks","handlingStrategy":"validation","validationCode":"// before ALTER KEYSPACE, verify RF fits the DC\nMap<String,Integer> nodesPerDc = nodetoolStatusPerDc();\nfor (var e : requestedRfByDc.entrySet()) {\n    int have = nodesPerDc.getOrDefault(e.getKey(), 0);\n    if (e.getValue() > have)\n        throw new IllegalArgumentException(\"RF \" + e.getValue() + \" > \" + have + \" nodes in DC \" + e.getKey());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run nodetool status and compare per-DC counts against strategy RF before schema changes.","Check for client warnings (ClientWarn) when applying schema via drivers/cqlsh.","Use dev/staging RF values distinct from prod; template them per environment.","Verify DC name spelling in replication options matches cassandra-rackdc.properties."],"tags":["replication","topology","configuration","keyspace"],"backgroundTag":"replication-factor-exceeds-nodes","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}