v.20.5Improvement

OPTIMIZE FINAL Forces Merge Despite Concurrent Operations

OPTIMIZE FINAL will force merge even if concurrent merges are performed. This closes #11309 and closes #11322. #11346 (alexey-milovidov).
OPTIMIZE FINAL now forces a merge of all parts even if concurrent merges are running.

Why it matters

This feature addresses the issue where OPTIMIZE FINAL could be skipped or delayed due to ongoing concurrent merges, ensuring that users can reliably compact data to a single part when needed. It improves control over data merging and compaction behavior.

How to use it

To use this feature, run the OPTIMIZE FINAL command on your table as usual. The operation will force the merge of all parts even if other merges are currently happening, guaranteeing completion.

Example:
OPTIMIZE TABLE <table_name> FINAL;