Repository navigation
Conversation
|
@tavplubix I know you had added the I ran into another edge case for |
|
Workflow [PR], commit [142fedf] Summary: ✅
AI ReviewSummaryThis PR teaches PR Metadata
Findings❌ Blockers
Tests
LLVM Coverage ReportMeasured on commit 142fedf.
Changed lines: Changed C/C++ lines covered: 37/37 (100.00%) · Uncovered code |
e84f86d to
5bf5c2d
Compare
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units307 translation units recompiled, 2271 s compile time in total, 307 of them have a recent master baseline. |
5bf5c2d to
094cfe6
Compare
|
I have pushed an update, please see my inline comment. I have also expanded the stateless test for scenario when the table is created with custom disk settings (type=local with custom path, and type=object_storage with custom path). |
`FuzzerLogParser.parse_failure` took the first line of the server log matching one of its failure patterns, no matter where in the line the match was. A query the server logs is data, and both a test comment and a fuzzed query may contain any text, so a line such as ... <Error> executeQuery: Code: 394. DB::Exception: Query was cancelled. ... (in query: -- Consuming the rowless chunk is `Logical error: 'max_rows > 0'` in debug and sanitizer builds. Every was reported as the failure. In the `Stress test (amd_msan)` run of ClickHouse#115707 that hid the real failure, `Logical error: 'Can't determine table for parallel replicas'` (issue ClickHouse#113292), behind a `max_rows > 0` name that names no failure at all, and the same mis-titled name was also recorded for ClickHouse#116247. The name goes to the CI database and to automatically created fuzzer issues, so such a match splits one failure into per-quote names and buries the failure that actually happened. Skip a match that is preceded on its line by `(in query:` or `(query:` and keep searching. Only the part of the line before the match is checked, so a real failure that quotes the query it happened on keeps its name. The query id of the failed query and the `Format string:` line are now taken from the failure that was found rather than searched for again, so they cannot come from a different, quoting line either. Matching a stack trace string no longer goes through `echo '<string>' | rg`: a log line contains single quotes, which terminated the shell quoting, so the quotes were dropped from the failure name (and the log content reached the shell). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Should we just change the setting? #116246 (comment) |
|
Refer to my comment: #116246 (comment) , the test |
…() throws an exception. When DatabaseAtomic::commitCreateTable() throws an exception, such as due to a transient KEEPER_EXCEPTION in case of Replicated database, the catch block is only cleaning up the tmp metadata directory for the table from disk. We should also cleanup the data directory for the table in case an exception is thrown in this function. Following test cases are added to demonstrate the fix with the help of a SYSTEM FAILPOINT (database_atomic_commit_create_table_failure): 1. Functional test for Atomic database. 2. Integration test for Replicated database.
…itCreateTable() throws an exception. Add a new function, DatabaseCatalog::removeTableDataFromDisk, and move the code from DatabaseCatalog::dropTableFinally that handles table data cleanup from disk into this new function, and reuse this function in the catch block of DatabaseAtomic::commitCreateTable. This way, the semantics of cleaning table data from disk is consistent between DatabaseCatalog::dropTableFinally and DatabaseAtomic::commitCreateTable. Expand the stateless test to also add scenarios for custom table disks settings (type=local with custom path, type=object_storage with custom path).
use the CLICKHOUSE_DISKS_FILES env var instead of hardcoding the local disk path to /var/lib/clickhouse/disks/. Also add the no-shared-merge-tree tag to this test.
DatabaseAtomic::commitCreateTable for CREATE TABLE statements and not for ATTACH TABLE statements. For ATTACH TABLE, this can accidentally cleanup actual data for a table which was previously detached, for instance, with "ATTACH TABLE ... UUID <previously detached table uuid> ..." query.
d948a3b to
142fedf
Compare
|
Pushing a change as per the comment here: #116246 (comment) |
| // for instance, with the "ATTACH TABLE ... UUID <previously detached table uuid> ..." | ||
| // query). | ||
| if (!query.attach) | ||
| DatabaseCatalog::instance().removeTableDataFromDisk(table->getStorageID(), table); |
There was a problem hiding this comment.
This rollback is still only the filesystem half of a failed CREATE undo. Fresh StorageObjectStorage tables can already mutate external state before commitCreateTable runs: the constructor calls configuration->create(...) in src/Storages/ObjectStorage/StorageObjectStorage.cpp:198-202, and for Iceberg that path can write metadata files and register the table in the external catalog (src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp:880-916).
If commitCreateTable throws afterwards, this branch removes store/<uuid> but never runs the storage-owned rollback (StorageObjectStorage::drop), so the remote/catalog table survives and a retry can still fail with already exists. Can we keep removeTableDataFromDisk for the local UUID directory but also run a storage-specific rollback for fresh CREATEs here (drop() where that is safe, or an engine-specific equivalent for ReplicatedMergeTree)?
When DatabaseAtomic::commitCreateTable() throws an exception, such as due to a transient KEEPER_EXCEPTION in case of Replicated database, the catch block is only cleaning up the tmp metadata directory for the table from disk.
We should also cleanup the data directory for the table in case an exception is thrown in this function.
Following test cases are added to demonstrate the fix with the help of a SYSTEM FAILPOINT (database_atomic_commit_create_table_failure):
Patch Disclaimer:
This patch is completely handwritten by the author. As such, it is prone to human-error on part of the author.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Cleans up directory for table data when
DatabaseAtomic::commitCreateTable()throws an exception. Closes #116246.Workflow [PR]
Sync PR [sync-upstream/pr/116247]