{"record":{"id":"1926967013e952c6","repo":"apache/cassandra","slug":"growth-of-2f-in-token-ownership-standard-devia-192696","errorCode":null,"errorMessage":"Growth of %.2f%% in token ownership standard deviation after allocation above warning threshold of %d%%","messagePattern":"Growth of %\\.2f%% in token ownership standard deviation after allocation above warning threshold of (.+?)%%","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java","lineNumber":134,"sourceCode":"    Collection<Token> allocate(InetAddressAndPort endpoint)\n    {\n        StrategyAdapter strategy = getOrCreateStrategy(endpoint);\n        Collection<Token> tokens = strategy.createAllocator().addUnit(endpoint, numTokens);\n        tokens = strategy.adjustForCrossDatacenterClashes(tokens);\n\n        SummaryStatistics os = strategy.replicatedOwnershipStats();\n        NodeId nodeId = metadata.directory.peerId(endpoint);\n        updateTokensForNode(nodeId, tokens);\n\n        SummaryStatistics ns = strategy.replicatedOwnershipStats();\n        logger.info(\"Selected tokens {}\", tokens);\n        logger.debug(\"Replicated node load in datacenter before allocation {}\", statToString(os));\n        logger.debug(\"Replicated node load in datacenter after allocation {}\", statToString(ns));\n\n        double stdDevGrowth = ns.getStandardDeviation() - os.getStandardDeviation();\n        if (stdDevGrowth > TokenAllocation.WARN_STDEV_GROWTH)\n        {\n            logger.warn(String.format(\"Growth of %.2f%% in token ownership standard deviation after allocation above warning threshold of %d%%\",\n                                      stdDevGrowth * 100, (int)(TokenAllocation.WARN_STDEV_GROWTH * 100)));\n        }\n\n        return tokens;\n    }\n\n    static String statToString(SummaryStatistics stat)\n    {\n        return String.format(\"max %.2f min %.2f stddev %.4f\", stat.getMax() / stat.getMean(), stat.getMin() / stat.getMean(), stat.getStandardDeviation());\n    }\n\n    SummaryStatistics getAllocationRingOwnership(String datacenter, String rack)\n    {\n        return getOrCreateStrategy(datacenter, rack).replicatedOwnershipStats();\n    }\n\n    SummaryStatistics getAllocationRingOwnership(InetAddressAndPort endpoint)\n    {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java#L116-L152","documentation":"A logger.warn, not an exception: TokenAllocation.allocate() compares ownership distribution standard deviation before and after allocating new tokens and warns when the growth exceeds WARN_STDEV_GROWTH (10%). It means the newly allocated tokens increased load imbalance among replicated nodes in the datacenter beyond the tolerated amount.","triggerScenarios":"Calling TokenAllocation.tokens()/allocate() (used by NetworkTopologyStrategy token allocation when a node bootstraps with allocate_tokens_for_local_replication_factor or similar) where post-allocation ownership stdev grows >10% versus pre-allocation.","commonSituations":"Bootstrapping a node into a datacenter with pre-existing ownership skew; allocating tokens for a node into a rack that is already over-loaded; misuse of replication factor settings causing wrong replicated-load baseline.","solutions":["Check cluster balance with `nodetool tablehistograms` / ownership before adding the node; rebalance first if already skewed.","Use allocate_tokens_for_local_replication_factor in cassandra.yaml so allocation accounts for the full RF.","Ensure rackId/DC configuration of the bootstrapping node is correct so allocation targets the right rack.","If the warning is expected (deliberate imbalance), it can be acknowledged; it does not abort bootstrap."],"exampleFix":"// before: bootstrap without RF-aware allocation\ninitial_token:\nauto_bootstrap: true\n// after: cassandra.yaml\nallocate_tokens_for_local_replication_factor: 5  // allocation minimizes stdev growth for RF=5","handlingStrategy":"validation","validationCode":"// verify pre-allocation balance with nodetool or OwnershipStats\nOwnershipStats os = TokenAllocation.replicatedOwnership(metadata, snitch, ks, rf);\nif (os.getStandardDeviation() > 0.10) log.warn(\"Cluster already imbalanced; consider rebalancing first\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set allocate_tokens_for_local_replication_factor in cassandra.yaml.","Keep rack/DC assignments accurate before bootstrapping.","Monitor ownership distribution (nodetool info / ownership) regularly.","Remember this is advisory: bootstrap still proceeds."],"tags":["token-allocation","load-balancing","bootstrap"],"backgroundTag":"load-imbalance-warning","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}