Skip to content

Fix server crash on startup (in the Upgrade Check) related to transactions (experimental) when loading mutations with outdated TID - #96238

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-loadMutations-outdated-tid-crash
Feb 7, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-loadMutations-outdated-tid-crash

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 6, 2026 •

Copy link
Copy Markdown
Member

During upgrade checks, the server could crash in StorageMergeTree::loadMutations with a LOGICAL_ERROR exception: "Trying to get CSN for too old TID".

This happened because TransactionLog::assertTIDIsNotOutdated was called for mutation entries whose TID had been garbage-collected from the transaction log (i.e., tail_ptr had advanced past TID.start_csn). In upgrade scenarios, the old binary could advance tail_ptr during stress testing, and when the new binary started and loaded mutations, uncommitted mutation entries with outdated TIDs would trigger the assertion.

The assertion was unnecessary here: if a mutation has no CSN (entry.csn == 0) and TransactionLog::getCSN returns nothing, the mutation was not committed regardless of whether the TID is outdated. The correct action in both cases is to remove the uncommitted mutation file, which the code already does on the next line.

Changelog category (leave one):

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

See https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96109&sha=2646faac0046ba91a49626371ca4a24ff30ea4f7&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29
#96109

Version info

  • Merged into: 26.2.1.348

During upgrade checks, the server could crash in `StorageMergeTree::loadMutations`
with a `LOGICAL_ERROR` exception: "Trying to get CSN for too old TID".

This happened because `TransactionLog::assertTIDIsNotOutdated` was called for
mutation entries whose TID had been garbage-collected from the transaction log
(i.e., `tail_ptr` had advanced past `TID.start_csn`). In upgrade scenarios, the
old binary could advance `tail_ptr` during stress testing, and when the new binary
started and loaded mutations, uncommitted mutation entries with outdated TIDs
would trigger the assertion.

The assertion was unnecessary here: if a mutation has no CSN (`entry.csn == 0`)
and `TransactionLog::getCSN` returns nothing, the mutation was not committed
regardless of whether the TID is outdated. The correct action in both cases is
to remove the uncommitted mutation file, which the code already does on the
next line.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [856f7c2]

Summary: ❌

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, 3/4) failure
test_restore_external_engines/test.py::test_restore_table FAIL cidb
test_restore_external_engines/test.py::test_restore_table_null FAIL cidb
Stress test (amd_debug) failure
Logical error: Unexpected return type from A. Expected B. Got C. Action: (STID: 1611-3d1e) FAIL cidb, issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants