Revert "Fix several optimizations after lightweight deletes"#102125
Conversation
|
Workflow [PR], commit [c8fbcb3] Summary: ⏳
AI ReviewSummaryThis PR reverts the previous lightweight-delete optimization fix and removes the corresponding stateless regression tests. I found two blocker-level issues: the revert reintroduces a correctness regression where optimization eligibility can remain permanently disabled after masked parts are merged away, and it removes existing coverage for that exact scenario. PR template metadata is also missing required changelog fields. PR Metadata
Exact replacement text suggestion:
Findings❌ Blockers
Tests
ClickHouse Rules
Final Verdict
|
| && metadata->minmax_count_projection | ||
| && !reading.getMergeTreeData().hasLightweightDeletedMask(); | ||
| bool can_use_minmax_projection = allow_implicit_projections && metadata->minmax_count_projection | ||
| && !reading.getMergeTreeData().has_lightweight_delete_parts.load(); |
There was a problem hiding this comment.
This reintroduces the sticky lightweight-delete flag regression.
has_lightweight_delete_parts is set to true when any part with lightweight delete appears, but it is not decremented/recomputed on normal part replacement paths. After OPTIMIZE ... FINAL merges away all masked parts, this check can still stay true, so minmax_count_projection remains disabled permanently until reload/restart.
Please restore an exact runtime accounting (e.g. counter of active masked parts updated on add/remove/swap/commit paths) instead of a sticky bool.
| @@ -1,78 +0,0 @@ | |||
| -- Verify that minmax_count_projection is re-enabled after all lightweight-deleted parts are merged away. | |||
There was a problem hiding this comment.
This removes a focused regression test that verifies recovery after lightweight-delete parts are merged away.
Given this PR reverts behavior in has_lightweight_delete_parts, deleting this test eliminates the guard for the exact bug scenario (OPTIMIZE ... FINAL should re-enable projection/trivial-count optimizations once masked parts disappear).
Per ClickHouse review rules, existing tests should not be removed to mask a behavior regression. Please keep the test (or replace it with equivalent coverage).

Reverts #101212
Version info
26.4.1.688