Repository navigation
Catch exceptions in MergeTreeTransaction::afterCommit to prevent std::terminate - #99494
alexey-milovidov wants to merge 1 commit into
Conversation
…td::terminate` The `afterCommit` method is `noexcept`, but it calls `appendCSNToVersionMetadata` and `setMutationCSN` which write to disk and can throw exceptions - particularly when fault injection triggers a `WriteFileOperation` failure. This causes `std::terminate` since exceptions cannot escape a `noexcept` function. Writing CSN to version metadata is an optimization - the CSN can be recovered from the transaction log in ZooKeeper on restart, as the existing comment states: "It's not a problem if server crash before CSN is written." Wrap the three disk-writing call sites in try-catch blocks and log warnings instead of terminating the server. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=9f55e660b5a692bc6a65ecb1935bf81ea840dfeb&name_0=MasterCI&name_1=BuzzHouse%20%28arm_asan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [52e27b1] Summary: ❌
AI ReviewSummaryThis PR wraps ClickHouse Rules
Final Verdict
|
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 80.56% (29/36, 0 noise lines excluded) |
It‘s wrong: the TID->CSN map can be cleaned up. btw, even write is successful, there is still a race the log can be cleaned before the metadata file has been synced. |
tiandiwonder
left a comment
There was a problem hiding this comment.
- rollback() should be handled too.
- better to have a regression. test.
| } | ||
| catch (...) | ||
| { | ||
| tryLogCurrentException("MergeTreeTransaction", "Failed to write creation CSN to version metadata"); |
There was a problem hiding this comment.
print part name for debug.
|
I've removed transactions from fuzzers: #99029 |
Summary
appendCSNToVersionMetadataandsetMutationCSNcalls inafterCommitwith try-catch blocks to preventstd::terminatewhen disk write fault injection triggers an exception in anoexceptfunctionFixes #85468
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=9f55e660b5a692bc6a65ecb1935bf81ea840dfeb&name_0=MasterCI&name_1=BuzzHouse%20%28arm_asan%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes