Skip to content

Remove cross-version-fragile OPTIMIZE FINAL from test_split_topology_rolling_upgrade - #110184

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-split-topology-optimize-hang
Jul 13, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-split-topology-optimize-hang

Conversation

@groeneai

@groeneai groeneai commented Jul 12, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

test_split_topology_rolling_upgrade failed on the Integration tests (amd_tsan, 1/6) run with code 341 at the setup step optimize table ts final:

Code: 341. DB::Exception: Received from 172.16.2.10:9000. DB::Exception:
Log entry log-0000000003 is not precessed on local replica, most likely
because the replica was shut down.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110152&sha=729886a3f8576eae108e6bd09bc29c4922a39212&name_0=PR&name_1=Integration%20tests%20%28amd_tsan%2C%201%2F6%29

Root cause: the setup does one insert then optimize table ts final. A single insert produces one part, so FINAL is a no-op merge, but it still enqueues a MERGE_PARTS replication log entry. The mixed-version cluster (two 26.5 replicas + the build under test) cannot always reproduce that merge byte-identically across versions, so the entry can block replica sync for minutes and, when a replica restarts, surface as code 341.

The assertions (order by a limit 10, order by a desc limit 10, count() group by a) are part-layout-independent, and the existing system sync replica ts loop already guarantees every replica sees the same 1M rows. Removing the OPTIMIZE removes the flakiness without weakening the test.

This mirrors #110129, which removed the identical no-op OPTIMIZE FINAL from the sibling test_backward_compatability in the same file.

Version info

  • Merged into: 26.7.1.841 (included in 26.7 and later)

…rolling_upgrade

A single insert is one part, so OPTIMIZE FINAL is a no-op merge whose
MERGE_PARTS log entry the 26.5 replicas cannot reproduce byte-identically
across versions. It can hang for minutes and occasionally raises code 341
(log entry not processed, replica shut down), as seen on the amd_tsan
Integration run. The assertions are part-layout-independent and the
existing system sync replica loop already guarantees convergence.

Mirrors the sibling fix in ClickHouse#110129 which removed the same no-op OPTIMIZE
FINAL from test_backward_compatability.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Not locally reproducible (needs mixed-version 26.5+current Docker cluster). Failure evidenced in CIDB: line 201 optimize table ts final -> Code 341 "Log entry not processed on local replica, replica shut down" on Integration tests (amd_tsan, 1/6), PR #110152 @ 729886a.
b Root cause explained? Single insert -> one part -> OPTIMIZE FINAL is a no-op merge that still enqueues a MERGE_PARTS replication log entry. The 26.5 replicas cannot reproduce that merge byte-identically across versions, so the entry blocks replica sync and, on a restart, raises code 341.
c Fix matches root cause? Yes. Removes the offending no-op OPTIMIZE; keeps system sync replica ts which guarantees convergence.
d Test intent preserved? Yes. The three assertions (order by a limit 10, ... desc limit 10, count() group by a) are part-layout-independent; the split-topology rolling-upgrade path is still exercised identically. No assertion weakened.
e Demonstrated both directions? The removed statement is the exact failing line in CI (fails-with). With it removed the setup no longer enqueues the fragile cross-version merge (passes-with).
f Fix general, not a narrow patch? N/A (test-setup fix, not a code bug). Mirrors the identical fix already merged in #110129 for the sibling test_backward_compatability in the same file.
g Generalizes across inputs? N/A (test-setup fix).
h Backward compatible? N/A (test-only change).
i Invariants preserved? N/A (test-only change).

Session id: cron:clickhouse-worker-slot-4:20260712-210600

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @nickitat - could you review? This removes a no-op cross-version OPTIMIZE FINAL from the split-topology test you added in #101434; same fix as the merged #110129 for its sibling test.

@clickhouse-gh

clickhouse-gh Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [295fea0]

Summary: ✅


AI Review

Summary

This PR removes OPTIMIZE TABLE ... FINAL from test_split_topology_rolling_upgrade after a single replicated insert in a mixed 26.5/current cluster. In the current test shape that OPTIMIZE is not needed to establish the asserted invariants, while it can enqueue a cross-version MERGE_PARTS entry and reproduce the CI flake described in the PR. I did not find a correctness regression or a coverage gap introduced by the change.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 12, 2026
@alexey-milovidov alexey-milovidov self-assigned this Jul 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 13, 2026
Merged via the queue into ClickHouse:master with commit 9a73f13 Jul 13, 2026
176 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 13, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…-topology-optimize-hang

Remove cross-version-fragile OPTIMIZE FINAL from test_split_topology_rolling_upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants