{"record":{"id":"fc0df93d0f0ac0c4","repo":"risingwavelabs/risingwave","slug":"k-not-found-in-system-parameter-table","errorCode":null,"errorMessage":"{k} not found in system_parameter table","messagePattern":"(.+?) not found in system_parameter table","errorType":"exception","errorClass":"BackupError","httpStatus":null,"severity":"error","filePath":"src/meta/src/backup_restore/restore_impl/v2.rs","lineNumber":196,"sourceCode":"        new_storage_url: &str,\n        new_storage_dir: &str,\n        new_backup_url: &str,\n        new_backup_dir: &str,\n    ) -> BackupResult<()> {\n        let kvs = [\n            (\"state_store\", new_storage_url),\n            (\"data_directory\", new_storage_dir),\n            (\"backup_storage_url\", new_backup_url),\n            (\"backup_storage_directory\", new_backup_dir),\n        ];\n        for (k, v) in kvs {\n            let Some(model) = risingwave_meta_model::system_parameter::Entity::find_by_id(k)\n                .one(&self.meta_store.conn)\n                .await\n                .map_err(map_db_err)?\n            else {\n                return Err(BackupError::MetaStorage(\n                    anyhow::anyhow!(\"{k} not found in system_parameter table\").into(),\n                ));\n            };\n            let mut kv: risingwave_meta_model::system_parameter::ActiveModel = model.into();\n            kv.value = sea_orm::ActiveValue::Set(v.to_owned());\n            risingwave_meta_model::system_parameter::Entity::update(kv)\n                .exec(&self.meta_store.conn)\n                .await\n                .map_err(map_db_err)?;\n        }\n        Ok(())\n    }\n}\n\nasync fn ensure_all_meta_store_tables_are_empty(\n    db: &impl sea_orm::ConnectionTrait,\n) -> BackupResult<()> {\n    macro_rules! ensure_entity_empty {\n        ($($entity_mod:ident),* $(,)?) => {","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/backup_restore/restore_impl/v2.rs#L178-L214","documentation":"In restore overwrite, each persisted system parameter is applied by looking it up in the `system_parameter` table and updating its value. If the key `k` is absent from the table, the code raises a MetaStorage error rather than inserting, because overwrite assumes the restore already seeded the parameter rows.","triggerScenarios":"Restoring a backup whose system_parameter key (e.g. a newer config name) does not exist as a row in the restored meta database — typically a version skew where the backup contains a parameter name unknown to the running meta node.","commonSituations":"Restoring a backup from a newer RisingWave version into an older meta node; manually pruning the system_parameter table; fresh meta schema that did not initialize default parameter rows.","solutions":["Align versions: restore the backup into a meta node at the same or newer version than the backup was taken from.","Insert the missing key into the system_parameter table manually (with its default value) before/instead of failing.","Check the reported key name and confirm it is a valid system parameter for this cluster version."],"exampleFix":"// before: fail when row missing\nlet Some(model) = Entity::find_by_id(k).one(&conn).await? else {\n    return Err(...);\n};\n// after: upsert instead of failing\nlet kv = match Entity::find_by_id(k).one(&conn).await? {\n    Some(model) => { let mut m: ActiveModel = model.into(); m.value = Set(v.to_owned()); m }\n    None => ActiveModel { name: Set(k.clone()), value: Set(v.to_owned()), ..Default::default() },\n};","handlingStrategy":"try-catch","validationCode":"-- check the key exists before overwrite\nSELECT name FROM system_parameter WHERE name = 'backup_write_bandwidth_limit';","typeGuard":null,"tryCatchPattern":"match restore_result {\n    Err(e) if e.to_string().contains(\"not found in system_parameter table\") => {\n        // version skew: run meta node >= backup version, or insert default row for the key, then retry\n    }\n    other => other?,\n}","preventionTips":["Restore with a meta node version >= the version that took the backup.","Never manually delete rows from system_parameter.","After restore, diff system_parameter keys against known defaults for the version."],"tags":["backup","restore","system-parameters","meta-storage","version-skew"],"backgroundTag":"record-not-found","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"}