Repository navigation
Cancel vector similarity index builds when a merge or mutation is cancelled - #123062
Conversation
…celled Building a `vector_similarity` index for one large block happens in a single step on the build pool threads. Those threads only checked `KILL QUERY` through a query context, which merges and mutations don't have, so `DROP TABLE SYNC` waited for the whole build. In a stress test run `flushAndPrepareForShutdown` waited about 15 minutes and the hung check fired. Merges and mutations now install their cancellation check on their thread group, and the index build calls `CurrentThread::checkIfNotCancelled` for every added vector. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122893&sha=b9ea0599debe81cc756eef94529577290f2b789b&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [2f51e73] Summary: ✅
AI ReviewSummaryThe PR routes merge/mutation cancellation into the Tests
Final Verdict
LLVM Coverage ReportMeasured on commit 2f51e73.
Changed lines: Changed C/C++ lines covered: 60/60 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units118 translation units recompiled, 779 s compile time in total, 118 of them have a recent master baseline. |
…up predicates The predicates only checked `merges_blocker`, so server shutdown (`MergeList::cancelAll`), `KILL MUTATION` and `SYSTEM STOP TTL MERGES` still did not interrupt a long vector similarity index build. Reuse `ctx->is_cancelled` for merges and the `checkOperationIsNotCanceled` condition for mutations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The index build schedules one pool task per row. After cancellation the merge thread kept enqueueing the remaining rows and then waited for all of them. With the thread fuzzer used in CI every scheduling round trip is slow, so `DROP TABLE SYNC` still waited 80 to 106 seconds. Now enqueueing stops at the first error, and the waiter rethrows it right away; the runner's destructor drops the rows that are still queued. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Edited by the nightly changelog CI job following .claude/skills/edit-changelog/SKILL.md. Changelog-revert: 123033 122902 Revert "Revert "Fix ALTER TABLE ... COMMENT COLUMN being silently discarded on a materialized view with an inner table"" Changelog-revert: 123588 123062 Revert "Cancel vector similarity index builds when a merge or mutation is cancelled" Changelog-revert: 123641 114184 Revert "Support JOIN with arbitrary ON condition (block nested loop)" Changelog-deleted-entry: 114184 [New Feature] [raw] * Implemented generic block nested loop join algorithm. `JOIN` now supports an arbitrary `ON` condition with no equality between the two tables, executing it as a block nested loop join — as slow as a `CROSS JOIN` with a filter — instead of failing with `INVALID_JOIN_ON_EXPRESSION`; the new setting `allow_block_nested_loop_join` turns it on/off. Close [#106352](#106352). [#114184](#114184) ([Vladimir Cherkasov](https://github.com/vdimir)). Changelog-deleted-entry: 123062 [Improvement] [section] * `DROP TABLE` and other operations that cancel merges and mutations no longer wait for an in-progress `vector_similarity` index build to finish. [#123062](#123062) ([Raúl Marín](https://github.com/Algunenano)).
…t storage `StorageObjectStorage::resolveHivePartitioningSamplePathIfDeferred` held `hive_partitioning_resolution_mutex` across `configuration->update` and `getPathSample`, i.e. across the listing of the storage. Every other query on the same table (`SELECT`, `DESCRIBE`, `INSERT ... SELECT`, `ALTER`) then waited in `std::mutex::lock`, where neither its own `KILL QUERY` nor `max_execution_time` can reach it, for as long as the first caller kept listing. With an unreachable endpoint that is the whole S3 retry budget (500 attempts with a 5 s backoff cap, ~41 min per retry loop). `Stress test (arm_asan_ubsan, s3)` hit it: a cancelled `DESC TABLE` waited 1513 s on the mutex behind a background mutation that kept listing `http://localhost:1/...` after `KILL MUTATION` (that half is fixed by ClickHouse#123062, which lets a killed or shut-down mutation stop its S3 retries). Now the listing runs without the lock, and the lock is taken only to check the resolved flag and to install the result, so the metadata update stays serialized with `alter`. The mutex never de-duplicated listings under an outage anyway: a failed or empty listing is not cached, so every waiter listed again after acquiring it. The new test lists an unreachable S3 endpoint from one query and checks that a `DESCRIBE` and a `SELECT` with `max_execution_time = 1` finish while the first query is still listing. On master both wait for the first query to hit its own 120 s limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A merge or mutation that builds a
vector_similarityindex over one large block does the whole build in a single step on the index build pool. The pool threads only checkedKILL QUERYthrough a query context, which background merges and mutations don't have. Cancelling the merge had no effect until the index build finished, soDROP TABLE SYNCcould wait for minutes. In a stress test run,flushAndPrepareForShutdownwaited about 15 minutes for such a merge and the hung check fired: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122893&sha=b9ea0599debe81cc756eef94529577290f2b789b&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29Merges and mutations now install their cancellation check on their thread group. The index build calls
CurrentThread::checkIfNotCancelledfor every added vector, so it stops as soon as the merge is cancelled. Locally,DROP TABLE SYNCduring such a merge took 1m54s before this change and 0.27 s after.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
DROP TABLEand other operations that cancel merges and mutations no longer wait for an in-progressvector_similarityindex build to finish.Workflow [PR]
Sync PR [sync-upstream/pr/123062]
Version info
26.10.1.1230-master(included in26.10and later)