{"record":{"id":"0998cb048ca88371","repo":"apache/cassandra","slug":"non-system-keyspaces-don-t-have-the-same-replicati","errorCode":null,"errorMessage":"Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless","messagePattern":"Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":4282,"sourceCode":"                throw new IllegalStateException(\"Ownership values for keyspaces with LocalStrategy are meaningless\");\n\n            strategy = keyspaceInstance.replicationStrategy;\n            replicationParams = keyspaceInstance.params.replication;\n        }\n        else\n        {\n            Set<String> userKeyspaces = metadata.schema.getKeyspaces()\n                                                       .without(SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES)\n                                                       .names();\n\n            if (userKeyspaces.size() > 0)\n            {\n                keyspace = userKeyspaces.iterator().next();\n                AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy();\n                for (String keyspaceName : userKeyspaces)\n                {\n                    if (!Schema.instance.getKeyspaceInstance(keyspaceName).getReplicationStrategy().hasSameSettings(replicationStrategy))\n                        throw new IllegalStateException(\"Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless\");\n                }\n            }\n\n            if (keyspace == null)\n            {\n                keyspace = \"system_traces\";\n            }\n\n            Keyspace keyspaceInstance = Schema.instance.getKeyspaceInstance(keyspace);\n            if (keyspaceInstance == null)\n                throw new IllegalStateException(\"The node does not have \" + keyspace + \" yet, probably still bootstrapping. Effective ownership information is meaningless.\");\n            replicationParams = keyspaceInstance.getMetadata().params.replication;\n            strategy = keyspaceInstance.getReplicationStrategy();\n        }\n\n        if (replicationParams.isMeta())\n        {\n            LinkedHashMap<InetAddressAndPort, Float> ownership = Maps.newLinkedHashMap();","sourceCodeStart":4264,"sourceCodeEnd":4300,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L4264-L4300","documentation":"The all-keyspaces ownership report (effectiveOwnership with null/default keyspace) requires every user keyspace to share the same replication settings; otherwise summing per-node ownership across keyspaces yields misleading numbers. If any two user keyspaces differ (different class or RF), it throws IllegalStateException.","triggerScenarios":"Calling `nodetool ownership` / effectiveOwnership(null) when user keyspaces have mixed replication (e.g. one keyspace NetworkTopologyStrategy RF=3, another SimpleStrategy RF=1 or different DCs).","commonSituations":"Multi-tenant clusters where keyspaces intentionally have different replication; clusters created ad hoc by different teams; after migrating a keyspace from SimpleStrategy to NetworkTopologyStrategy.","solutions":["Pass an explicit keyspace to the ownership command so only that keyspace is analyzed","Unify replication settings across user keyspaces if a cluster-wide report is genuinely needed","Run per-keyspace ownership queries and aggregate externally","Recheck strategy class and RF for all keyspaces: cqlsh -e 'DESCRIBE KEYSPACES;'"],"exampleFix":"// before\nnodetool ownership  # mixed strategies -> meaningless\n// after\nnodetool ownership my_keyspace","handlingStrategy":"try-catch","validationCode":"Set<String> strategies = userKeyspaces.stream()\n    .map(ks -> Schema.instance.getKeyspaceInstance(ks).getReplicationStrategy().getClass().getName() + \"/RF\")\n    .collect(Collectors.toSet());\nif (strategies.size() > 1) throw new IllegalArgumentException(\"mixed replication; query per keyspace\");","typeGuard":null,"tryCatchPattern":"try { ss.effectiveOwnership(null); } catch (IllegalStateException e) { if (e.getMessage().contains(\"same replication settings\")) { return userKeyspaces.stream().collect(toMap(k -> k, k -> ownership(k))); } throw e; }","preventionTips":["Pass an explicit keyspace to ownership commands on heterogeneous clusters","Keep replication settings uniform only if you rely on cluster-wide ownership reports","Aggregate per-keyspace ownership externally"],"tags":["ownership","replication","nodetool"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}