Skip to content

Fix assertHasValidVersionMetadata exception during ATTACH TABLE AS REPLICATED - #96863

Merged
alexey-milovidov merged 5 commits into
masterfrom
fix-attach-as-replicated-version-metadata
Feb 15, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
fix-attach-as-replicated-version-metadata

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Summary

When ATTACH TABLE ... AS REPLICATED runs with implicit_transaction = true, clearTransactionMetadata deletes txn_version.txt files from disk before the old detached table is destroyed. The old table's parts still hold in-memory version metadata with non-prehistoric creation_tid, so when the old storage is later cleaned up by checkDetachedTableNotInUse, the parts' destructors call removeIfNeeded → assertHasValidVersionMetadata, which tries to read the now-deleted files and fails in debug/sanitizer builds.

The fix ensures the old detached table instance is fully destroyed before any transaction metadata files are removed.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96756&sha=4d2b3ff87c423adaac21207a15037a57cd269954&name_0=PR&name_1=BuzzHouse%20%28amd_msan%29
#96756

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):

...

🤖 Generated with Claude Code

Version info

  • Merged into: 26.2.1.704

@clickhouse-gh

clickhouse-gh Bot commented Feb 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [87b40fc]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Feb 14, 2026
alexey-milovidov and others added 4 commits February 14, 2026 05:29
…ransaction`

Test verifies that parts created with `implicit_transaction` (which write
`txn_version.txt` metadata) do not cause `assertHasValidVersionMetadata`
exception when the table is detached and then attached as replicated.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add `no-encrypted-storage` tag because `implicit_transaction` requires
`allow_experimental_transactions` config, which is not loaded when
encrypted storage is enabled. Also add `--async_insert=0` because async
inserts are incompatible with `implicit_transaction`.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Feb 15, 2026
@alexey-milovidov
alexey-milovidov merged commit 55eacde into master Feb 15, 2026
131 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-attach-as-replicated-version-metadata branch February 15, 2026 07:38
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 15, 2026
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