Backport of 'Make ci_finished_builds engine swap work on ClickHouse 23.x' into 19.1

What does this MR do and why?

Backports !240798 (merged) (merged commit b4f205d5) to 19-1-stable-ee.

The master MR !240798 (merged) missed the 19.1 release cutoff and was slipped to 19.2. This backport lands the same fix into the 19.1 stable branch so it ships in the next 19.1 patch release alongside the previously opened 19.0 / 18.11 / 18.10 backports.

What the fix does

ClickHouse post-deployment migration 20260108073937_alter_ci_finished_builds_engine_with_version was failing in three ways on stable branches that run ClickHouse 23.x/24.x. The master fix:

  1. drop_tmp_table UNKNOWN_SETTING on CH 23.xSETTINGS max_table_size_to_drop = 0 is only valid as a query-level setting on CH 24.0+; on CH 23.x it raises Code: 115 UNKNOWN_SETTING. Worse, simply omitting it would fail DROP for any customer with >50 GB in tmp. Fixed by DETACHing every partition first (size check does not apply), then DROPping the empty table.
  2. Version-agnostic spec — replaces a hardcoded SETTINGS string comparison with not_to change { current_settings_clause } that works across all CH versions.
  3. supports_deduplicate_merge_projection_mode? gate threshold — corrected from minor >= 1 to minor >= 8 to match when the setting was actually introduced in CH 24.x.
  4. Self-healing create_tmp_table — calls drop_tmp_table first and removes IF NOT EXISTS so a stale tmp table from an interrupted prior run is cleaned up rather than silently corrupting state.

Single cherry-pick of b4f205d5. No conflicts.

References

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
  • Required labels have been applied to this merge request
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:test-on-omnibus-ee job has succeeded, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, request help in the #s_developer_experience Slack channel to confirm the failures are unrelated to the merge request.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Narendran

Merge request reports

Loading