{"record":{"id":"428d19a1003dbf2e","repo":"apache/cassandra","slug":"value-for-key-is-only-present-in-the-left-set","errorCode":null,"errorMessage":"Value for key {} is only present in the left set: {}","messagePattern":"Value for key (.+?) is only present in the left set: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/tcm/membership/Directory.java","lineNumber":950,"sourceCode":"        }\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;\n            this.endpoint = endpoint;\n        }\n","sourceCodeStart":932,"sourceCodeEnd":968,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/membership/Directory.java#L932-L968","documentation":"This is a diagnostic warning from Directory.dumpDiff, a comparison helper used when two ClusterMetadata directories are expected to be identical but are not. It logs every key (e.g. node id or endpoint mapping) that exists in the left directory but is missing from the right one. It is purely informational logging, not a thrown exception, emitted during CMS metadata verification.","triggerScenarios":"Directory.dumpDiff(this, other) is invoked after an equals() comparison fails between two Directory instances, e.g. when a CMS initialization/migration peer reports a directory that differs from the local one, and some node entries exist only in the initiator's directory.","commonSituations":"Node joins or removals committed on the initiator but not yet replicated to the comparing node; a node bootstrapped against a stale or diverging CMS state; split-brain or restored-from-snapshot metadata drift during cluster migration to TCM.","solutions":["Compare cluster metadata across nodes (nodetool CMS operations / ClusterMetadata dumps) and let the CMS replicate so both directories converge","Identify the missing node entries from the log and re-run the migration/initiation once all peer nodes are up and gossip-consistent","If drift is permanent (e.g. from a bad snapshot restore), follow the CMS recovery/re-bootstrap procedure for the diverging node"],"exampleFix":"// before: comparing against stale directory\nif (!initiatorDirectory.equals(metadata.directory)) { initiatorDirectory.dumpDiff(metadata.directory); }\n// after: ensure metadata is current before comparing\nClusterMetadata metadata = ClusterMetadata.current();\nif (!initiatorDirectory.equals(metadata.directory)) { initiatorDirectory.dumpDiff(metadata.directory); /* investigate log output, resync via CMS */ }","handlingStrategy":"validation","validationCode":"if (!expectedDirectory.equals(ClusterMetadata.current().directory)) {\n    logger.warn(\"Directory mismatch detected before operation\");\n    expectedDirectory.dumpDiff(ClusterMetadata.current().directory);\n    // abort or resync before proceeding\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify cluster metadata equality across nodes before initiating migrations","Keep all nodes joined and gossip-consistent; avoid running operations while a node is catching up","Monitor logs for dumpDiff warnings as early signals of metadata drift"],"tags":["logging","cluster-metadata","diagnostics","distributed-consistency"],"backgroundTag":"schema-validation-failed","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"}