{"record":{"id":"802d1c213da8220f","repo":"apache/cassandra","slug":"ownership-values-for-keyspaces-with-localstrategy","errorCode":null,"errorMessage":"Ownership values for keyspaces with LocalStrategy are meaningless","messagePattern":"Ownership values for keyspaces with LocalStrategy are meaningless","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":4257,"sourceCode":"\n    /**\n     * Calculates ownership. If there are multiple DC's and the replication strategy is DC aware then ownership will be\n     * calculated per dc, i.e. each DC will have total ring ownership divided amongst its nodes. Without replication\n     * total ownership will be a multiple of the number of DC's and this value will then go up within each DC depending\n     * on the number of replicas within itself. For DC unaware replication strategies, ownership without replication\n     * will be 100%.\n     *\n     * @throws IllegalStateException when node is not configured properly.\n     */\n    private LinkedHashMap<InetAddressAndPort, Float> getEffectiveOwnership(String keyspace)\n    {\n        ClusterMetadata metadata = ClusterMetadata.current();\n        ReplicationParams replicationParams = null;\n        AbstractReplicationStrategy strategy;\n        if (keyspace != null)\n        {\n            if (isLocalSystemKeyspace(keyspace))\n                throw new IllegalStateException(\"Ownership values for keyspaces with LocalStrategy are meaningless\");\n\n            KeyspaceMetadata keyspaceInstance = metadata.schema.getKeyspaces().getNullable(keyspace);\n            if (keyspaceInstance == null)\n                throw new IllegalArgumentException(\"The keyspace \" + keyspace + \", does not exist\");\n\n            if (keyspaceInstance.replicationStrategy instanceof LocalStrategy)\n                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)","sourceCodeStart":4239,"sourceCodeEnd":4275,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L4239-L4275","documentation":"When computing token ownership (describeOwnership / effective-ownership path), requesting ownership for a keyspace that uses LocalStrategy (system keyspaces like 'system', 'system_auth' internals) is rejected: LocalStrategy replicates to the local node only, so ownership percentages are meaningless. Thrown as IllegalStateException.","triggerScenarios":"Calling `nodetool <ks> describeownership` / StorageService.effectiveOwnership(keyspace) or describeLocalOwnership passing a local/system keyspace name (e.g. 'system', 'system_schema').","commonSituations":"Operators scripting ownership reports over all keyspaces from system tables; tooling iterating Schema keyspaces including local ones.","solutions":["Exclude local/system keyspaces (those with LocalStrategy) from ownership queries","Run ownership against user keyspaces only, e.g. `nodetool describeownership my_ks` ( Cassandra 4+)","Filter keyspaces before calling effectiveOwnership() in tooling","If you just need replica data, use `nodetool describecluster`/token metadata APIs instead of ownership"],"exampleFix":"// before\nnodetool describeownership system\n// after\nnodetool describeownership my_keyspace","handlingStrategy":"validation","validationCode":"KeyspaceMetadata ksm = Schema.instance.getKeyspaces().getNullable(ks).orElse(null);\nif (ksm != null && ksm.params.replication instanceof LocalReplicationStrategy)\n    throw new IllegalArgumentException(\"skip LocalStrategy keyspace: \" + ks);","typeGuard":null,"tryCatchPattern":"try { ss.effectiveOwnership(ks); } catch (IllegalStateException e) { if (e.getMessage().contains(\"LocalStrategy\")) { return null; } throw e; }","preventionTips":["Exclude system keyspaces from ownership tooling","Check replication strategy class before computing ownership","Use explicit user keyspace names in nodetool commands"],"tags":["ownership","system-keyspace","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"}