{"record":{"id":"7b2b2dc85bea0d31","repo":"apache/cassandra","slug":"values-for-key-differ","errorCode":null,"errorMessage":"Values for key {} differ: {} != {}","messagePattern":"Values for key (.+?) differ: (.+?) != (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/java/org/apache/cassandra/tcm/membership/Directory.java","lineNumber":947,"sourceCode":"        {\n            logger.warn(\"Versions differ: {} != {}\", versions, other.versions);\n            dumpDiff(logger, versions, other.versions);\n        }\n        if (!Objects.equals(addresses, other.addresses))\n        {\n            logger.warn(\"Addresses differ: {} != {}\", addresses, other.addresses);\n            dumpDiff(logger, addresses, other.addresses);\n        }\n    }\n\n    public static <K, V> void dumpDiff(Logger logger, Map<K, V> l, Map<K, V> r)\n    {\n        for (K k : Sets.intersection(l.keySet(), r.keySet()))\n        {\n            V lv = l.get(k);\n            V rv = r.get(k);\n            if (!Objects.equals(lv, rv))\n                logger.warn(\"Values for key {} differ: {} != {}\", k, lv, rv);\n        }\n        for (K k : Sets.difference(l.keySet(), r.keySet()))\n            logger.warn(\"Value for key {} is only present in the left set: {}\", k, l.get(k));\n        for (K k : Sets.difference(r.keySet(), l.keySet()))\n            logger.warn(\"Value for key {} is only present in the right set: {}\", k, r.get(k));\n\n    }\n\n    public static class RemovedNode implements Comparable<RemovedNode>\n    {\n        public final Epoch removedIn;\n        public final NodeId id;\n        public final InetAddressAndPort endpoint;\n\n        public RemovedNode(Epoch removedIn, NodeId id, InetAddressAndPort endpoint)\n        {\n            this.removedIn = removedIn;\n            this.id = id;","sourceCodeStart":929,"sourceCodeEnd":965,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/membership/Directory.java#L929-L965","documentation":"WARN log from the static Directory.dumpDiff(Logger, Map, Map) helper, emitted for each key present in both maps whose values are not Objects.equals. It provides per-key detail after a map-level divergence warning (peers, states, addresses, versions, etc.), showing exactly which entries differ. Keys present in only one map are logged by separate calls. Not an exception.","triggerScenarios":"Any dumpDiff call on a diverging map where a shared key holds different values in left vs right map — e.g. a NodeId mapped to different NodeState, address, or version in the two snapshots being compared.","commonSituations":"Debugging exactly which nodes drive a Peers/States/Versions differ warning; post-mortem analysis of cluster metadata divergence; dtest failure output pinpointing the divergent node IDs.","solutions":["Read the logged key to identify the specific node whose entry diverged, then trace the transformation that changed it","Replay or re-commit the corresponding TCM transformation on the stale view so the shared key's value converges","If the value should legitimately differ (different snapshot epochs), compare snapshots at the same epoch","Escalate to the Cassandra community if convergence fails without a partition, as it may indicate a metadata replication bug"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-compute divergent keys to act on them programmatically\nSet<K> divergent = new HashSet<>(left.keySet());\ndivergent.retainAll(right.keySet());\ndivergent.removeIf(k -> java.util.Objects.equals(left.get(k), right.get(k)));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the per-key diff output to drive targeted convergence rather than blanket restarts","Resolve the owning map-level divergence (peers/states/versions) first; per-key diffs are symptoms","Diff maps captured at the same epoch only","Automate alerting on divergent keys so they are fixed before they affect placement decisions"],"tags":["cassandra","tcm","diagnostics","map-diff"],"backgroundTag":"internal-invariant-violation","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"}