{"record":{"id":"25a1a9689f401884","repo":"apache/cassandra","slug":"can-t-join-the-ring-because-in-write-survey-mode-a","errorCode":null,"errorMessage":"Can't join the ring because in write_survey mode and bootstrap hasn't completed","messagePattern":"Can't join the ring because in write_survey mode and bootstrap hasn't completed","errorType":"console","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":1007,"sourceCode":"                Gossiper.instance.mergeNodeToGossip(metadata.myNodeId(), metadata);\n            }\n        }\n        else if (isSurveyMode)\n        {\n            // if isSurveyMode then verify the node is in the right state to join the ring\n            // or that it has already done so\n            if (ClusterMetadata.current().myNodeState() == JOINED)\n            {\n                // note: this has always been a no-op, starting a previously joined node in\n                // survey mode is meaningless as bootstrapping and joining the ring is already\n                // complete and a full joined node being restarted in survey mode does not prevent\n                // it participating in reads. This exists only for backwards compatibilty.\n                logger.info(\"Leaving write survey mode and joining ring at operator request\");\n                isSurveyMode = false;\n            }\n            else if (!SystemKeyspace.bootstrapComplete())\n            {\n                logger.warn(\"Can't join the ring because in write_survey mode and bootstrap hasn't completed\");\n                throw new IllegalStateException(\"Cannot join the ring until bootstrap completes\");\n            }\n            else if (readyToFinishJoiningRing())\n            {\n                logger.info(\"Leaving write survey mode and joining ring at operator request\");\n                exitWriteSurveyMode();\n                isSurveyMode = false;\n                daemon.start();\n            }\n            else\n            {\n                logger.warn(\"Can't join the ring because in write_survey mode and bootstrap hasn't completed\");\n                throw new IllegalStateException(\"Cannot join the ring until bootstrap completes\");\n            }\n        }\n        else if (isBootstrapMode())\n        {\n            // bootstrap is not complete hence node cannot join the ring","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L989-L1025","documentation":"StorageService refuses to join the ring because the node is in write_survey mode (start_native_transport with write_survey enabled) and SystemKeyspace.bootstrapComplete() is false — the node has never finished bootstrapping, so it may not accept ring membership. Throws IllegalStateException(\"Cannot join the ring until bootstrap completes\"); the WARN is logged first.","triggerScenarios":"Operator calls joinRing() (leave survey mode) on a write_survey node whose bootstrap never completed — typically the node was started with write_survey:true, never fully joined, and someone then requests joinRing().","commonSituations":"Write_survey mode intended only for evaluating write load without serving reads; operator forgets the node was never bootstrapped and tries to promote it; config flip of write_survey in cassandra.yaml then immediate joinRing.","solutions":["If the node was only surveyed and never bootstrapped, wipe data (or use a fresh data dir), remove write_survey, and do a normal bootstrap restart.","If bootstrap genuinely should have completed, check system.local/system.peers for bootstrap_complete and complete the interrupted bootstrap first.","Set write_survey:false in cassandra.yaml and restart before joining the ring.","Use 'nodetool status' and logs to confirm bootstrap progress; wait for completion before joinRing()."],"exampleFix":"// before (cassandra.yaml)\nauto_bootstrap: true\n# node never completed bootstrap, write_survey: true, joinRing called\n// after\ndefault: remove write_survey: true from cassandra.yaml, wipe data dir, restart to bootstrap normally","handlingStrategy":"validation","validationCode":"// before joinRing()\nboolean ok = !isSurveyMode() || SystemKeyspace.bootstrapComplete();\nif (!ok) throw new IllegalStateException(\"Complete bootstrap (or re-bootstrap without write_survey) first\");","typeGuard":null,"tryCatchPattern":"try { storageService.joinRing(); }\ncatch (IllegalStateException e) { /* write_survey + incomplete bootstrap: rebootstrap node */ }","preventionTips":["Do not enable write_survey on nodes that must join the ring later without re-bootstrap.","Check system.local bootstrap_complete before joinRing.","Remove write_survey from cassandra.yaml after survey evaluation."],"tags":["cassandra","bootstrap","write-survey","illegal-state"],"backgroundTag":"invalid-state-transition","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"}