Repository: risingwavelabs/risingwave
File: src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs (Rust)

Code before:
            return Err(Error::CompactionGroup(format!(
                "group-{} or group-{} is empty",
                group.group_id, next_group.group_id
            )));
        }

        if group
            .compaction_group_config
            .compaction_config
            .disable_auto_group_scheduling
            .unwrap_or(false)
            || next_group
                .compaction_group_config
                .compaction_config
                .disable_auto_group_scheduling
                .unwrap_or(false)
        {
            return Err(Error::CompactionGroup(format!(
                "group-{} or group-{} disable_auto_group_scheduling",
                group.group_id, next_group.group_id
            )));
        }

        // do not merge compaction groups with different compaction configs
        // different configs lead to different max_estimated_group_size calculations,
        // which can cause scheduling conflicts (continuous split/merge cycles)
        if group.compaction_group_config.compaction_config
            != next_group.compaction_group_config.compaction_config
        {
            return Err(Error::CompactionGroup(format!(
                "Cannot merge group {} and next_group {} with different compaction configs",
                group.group_id, next_group.group_id
            )));
        }

        // do not merge the compaction group which is creating
        if Self::check_is_creating_compaction_group(group, created_tables) {
            return Err(Error::CompactionGroup(format!(
                "Cannot merge creating group {} next_group {}",
                group.group_id, next_group.group_id
            )));
        }

        // do not merge high throughput group
        if !Self::check_is_low_write_throughput_compaction_group(
            table_write_throughput_statistic_manager,
            group,
            opts,
        ) {
            return Err(Error::CompactionGroup(format!(
                "Cannot merge high throughput group {} next_group {}",

Review comment (suggestion):
[nitpick] The config comparison check should include a comment explaining which specific config fields affect `max_estimated_group_size` calculations, as the current comment mentions this is the reason but doesn't specify which fields are involved.
```suggestion
        // Do not merge compaction groups with different compaction configs.
        // Different configs lead to different max_estimated_group_size calculations,
        // which can cause scheduling conflicts (continuous split/merge cycles).
        // The following fields in CompactionConfig affect max_estimated_group_size:
        //   - max_bytes_for_level_base
        //   - max_bytes_for_level_multiplier
        //   - max_compaction_bytes
        //   - sub_level_max_compaction_bytes
        // If any of these fields differ, the groups may have incompatible scheduling.
```

Code after:
            return Err(Error::CompactionGroup(format!(
                "group-{} or group-{} is empty",
                group.group_id, next_group.group_id
            )));
        }

        if group
            .compaction_group_config
            .compaction_config
            .disable_auto_group_scheduling
            .unwrap_or(false)
            || next_group
                .compaction_group_config
                .compaction_config
                .disable_auto_group_scheduling
                .unwrap_or(false)
        {
            return Err(Error::CompactionGroup(format!(
                "group-{} or group-{} disable_auto_group_scheduling",
                group.group_id, next_group.group_id
            )));
        }

        // Do not merge compaction groups with different compaction configs.
        // Different configs lead to different max_estimated_group_size calculations,
        // which can cause scheduling conflicts (continuous split/merge cycles).
        // The following fields in CompactionConfig affect max_estimated_group_size:
        //   - max_bytes_for_level_base
        //   - max_bytes_for_level_multiplier
        //   - max_compaction_bytes
        //   - sub_level_max_compaction_bytes
        // If any of these fields differ, the groups may have incompatible scheduling.
        if group.compaction_group_config.compaction_config
            != next_group.compaction_group_config.compaction_config
        {
            let left_config = group.compaction_group_config.compaction_config.as_ref();
            let right_config = next_group
                .compaction_group_config
                .compaction_config
                .as_ref();

            tracing::warn!(
                group_id = group.group_id,
                next_group_id = next_group.group_id,
                left_config = ?left_config,
                right_config = ?right_config,
                "compaction config mismatch detected while merging compaction groups"
            );

            return Err(Error::CompactionGroup(format!(
                "Cannot merge group {} and next_group {} with different compaction configs. left_config: {:?}, right_config: {:?}",