{"record":{"id":"fcec469b691a4f6c","repo":"risingwavelabs/risingwave","slug":"the-cluster-is-bootstrapping","errorCode":null,"errorMessage":"The cluster is bootstrapping","messagePattern":"The cluster is bootstrapping","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/meta/src/barrier/manager.rs","lineNumber":169,"sourceCode":"            ))\n            .context(\"failed to send update database barrier request\")?;\n        rx.await.context(\"failed to wait update database barrier\")?;\n        Ok(())\n    }\n\n    pub async fn get_hummock_version_id(&self) -> HummockVersionId {\n        self.hummock_manager.get_version_id().await\n    }\n}\n\nimpl GlobalBarrierManager {\n    /// Check the status of barrier manager, return error if it is not `Running`.\n    pub fn check_status_running(&self) -> MetaResult<()> {\n        let status = self.status.load();\n        match &**status {\n            BarrierManagerStatus::Starting\n            | BarrierManagerStatus::Recovering(RecoveryReason::Bootstrap) => {\n                bail!(\"The cluster is bootstrapping\")\n            }\n            BarrierManagerStatus::Recovering(RecoveryReason::Failover(e)) => {\n                Err(anyhow::anyhow!(e.clone()).context(\"The cluster is recovering\"))?\n            }\n            BarrierManagerStatus::Recovering(RecoveryReason::Adhoc) => {\n                bail!(\"The cluster is recovering-adhoc\")\n            }\n            BarrierManagerStatus::Running => Ok(()),\n        }\n    }\n\n    pub fn get_recovery_status(&self) -> PbRecoveryStatus {\n        (&**self.status.load()).into()\n    }\n}\n\nimpl GlobalBarrierManager {\n    #[expect(clippy::too_many_arguments)]","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/barrier/manager.rs#L151-L187","documentation":"check_status_running validates that the barrier manager is in Running state before serving commands. When the status is Starting or Recovering with RecoveryReason::Bootstrap, it reports 'The cluster is bootstrapping'. Any DDL/DML requiring barrier progress is rejected until bootstrap completes.","triggerScenarios":"Issuing SQL/API requests during initial cluster startup, before the barrier manager has finished bootstrapping and moved to Running.","commonSituations":"Clients connecting immediately after `risedev d` or cluster start; CI scripts that don't wait for readiness; retry loops hammering a fresh cluster.","solutions":["Wait for cluster readiness (health/ready endpoint or successful `SELECT 1`) before issuing statements","Add retry-with-backoff around DDL/DML during startup windows","Check meta node logs to confirm bootstrap finished; if stuck, investigate the initial barrier schedule","Increase startup wait in test harnesses"],"exampleFix":"// before\nrun_query(sql);\n// after\nwait_for_rw_ready(); // e.g. poll psql 'SELECT 1' until success\nrun_query(sql);","handlingStrategy":"retry","validationCode":"// poll readiness before DDL/DML\nwhile cluster_status() != BarrierManagerStatus::Running { sleep(Duration::from_millis(500)).await; }","typeGuard":null,"tryCatchPattern":"match err.to_string().as_str() {\n    \"The cluster is bootstrapping\" => retry_with_backoff(|| run_statement()),\n    _ => return Err(err),\n}","preventionTips":["Wait for the cluster readiness signal before connecting clients","Add startup grace periods in CI/test harnesses","Alert if bootstrap does not complete within expected time"],"tags":["rust","meta","barrier","bootstrap","startup"],"backgroundTag":"invalid-state-transition","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}