{"record":{"id":"4c3832c50d804a1e","repo":"risingwavelabs/risingwave","slug":"table-doesn-t-belong-to-any-compaction-group-s","errorCode":null,"errorMessage":"table {} doesn't belong to any compaction group, skip truncating","messagePattern":"table (.+?) doesn't belong to any compaction group, skip truncating","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/hummock/manager/commit_epoch.rs","lineNumber":225,"sourceCode":"                    .compaction_config();\n                group_id_to_config.insert(*cg_id, compaction_group);\n            }\n        }\n\n        let group_id_to_sub_levels =\n            rewrite_commit_sstables_to_sub_level(commit_sstables, &group_id_to_config);\n\n        // build group_id to truncate tables\n        let mut group_id_to_truncate_tables: HashMap<CompactionGroupId, HashSet<TableId>> =\n            HashMap::new();\n        for table_id in &truncate_tables {\n            if let Some(compaction_group_id) = table_compaction_group_mapping.get(table_id) {\n                group_id_to_truncate_tables\n                    .entry(*compaction_group_id)\n                    .or_default()\n                    .insert(*table_id);\n            } else {\n                bail!(\n                    \"table {} doesn't belong to any compaction group, skip truncating\",\n                    table_id\n                );\n            }\n        }\n\n        let time_travel_delta = version.pre_commit_epoch(\n            &tables_to_commit,\n            new_compaction_groups,\n            group_id_to_sub_levels,\n            &new_table_ids,\n            new_table_watermarks,\n            change_log_delta,\n            vector_index_delta,\n            group_id_to_truncate_tables,\n        );\n\n        if should_mark_next_time_travel_version_snapshot(&time_travel_delta) {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/hummock/manager/commit_epoch.rs#L207-L243","documentation":"During commit_epoch, when the caller requests table truncation alongside the commit, every listed table must be mapped to a compaction group. If a table id has no entry in table_compaction_group_mapping, commit_epoch aborts with this bail rather than silently skipping truncation for that table.","triggerScenarios":"commit_epoch invoked with truncate-tables/retention request where one of the listed table ids is missing from the group mapping fetched from the compaction group manager (e.g. table just dropped, or mapping not yet assigned).","commonSituations":"Race between dropping a table and a commit that still lists it for truncation; meta state where table-group assignment was lost; clients (frontend/risectl) caching stale table ids after the table was removed.","solutions":["Check whether the table was dropped or reassigned and remove it from the truncation list","Refresh the compaction-group mapping (list hummock compaction groups) and retry the commit with valid tables","Retry the operation — transient races with group re-assignment may resolve","If the mapping is persistently missing for a live table, this is an internal inconsistency: inspect meta tables and report a bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Caller-side: filter out tables with no compaction group before requesting truncation\nlet valid: Vec<_> = table_ids.into_iter().filter(|t| group_mapping.contains_key(t)).collect();\n","typeGuard":"fn all_tables_mapped(tables: &[TableId], mapping: &HashMap<TableId, CompactionGroupId>) -> bool {\n    tables.iter().all(|t| mapping.contains_key(t))\n}\n","tryCatchPattern":"match commit_epoch(new_epoch, ssts, truncate_tables).await {\n    Err(e) if e.to_string().contains(\"doesn't belong to any compaction group\") => {\n        tracing::warn!(\"stale table in truncation list; refresh mapping and retry: {e}\");\n    }\n    other => other?,\n}\n","preventionTips":["Re-read the table→group mapping right before requesting truncation","Handle table drops before/after truncation requests atomically","Avoid caching table ids for truncation across long-running jobs","Alert on persistently unmapped live tables (meta inconsistency)"],"tags":["rust","hummock","compaction-group","commit-epoch"],"backgroundTag":"entity-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"}