Check for query cancellation during vector similarity index building#102010
Merged
alexey-milovidov merged 2 commits intomasterfrom Apr 9, 2026
Merged
Check for query cancellation during vector similarity index building#102010alexey-milovidov merged 2 commits intomasterfrom
alexey-milovidov merged 2 commits intomasterfrom
Conversation
The stress test (arm_tsan) hits a hung check failure because USearch's HNSW graph construction does not respect query cancellation. When `KILL QUERY` is issued, threads stuck inside USearch `add` keep running indefinitely, especially under TSan where each operation is very slow. Add a periodic cancellation check (every 128 rows) before calling USearch `add`. This lets `KILL QUERY` interrupt index building without adding measurable overhead to every single vector insertion. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102000&sha=9190a5549402d12fff136f61209c5405f2aa896c&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [384235f] Summary: ❌
AI ReviewSummaryThis PR adds a query-cancellation check before each vector insertion in ClickHouse Rules
Final Verdict
|
Each row is submitted as a separate task to the thread pool, so the previous `row % 128 == 0` guard meant only ~1 in 128 tasks ever checked for cancellation. Remove the modulo guard and check before every `add` call — the check just reads an atomic flag and is cheap. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
murphy-4o
reviewed
Apr 8, 2026
murphy-4o
approved these changes
Apr 8, 2026
Contributor
LLVM Coverage Report
Changed lines: 100.00% (7/7) · Uncovered code |
1 task
Member
Author
|
Flaky check - unfortunately, needs #102148 |
This was referenced Apr 10, 2026
Merged
This was referenced Apr 10, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 16, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 17, 2026
…lickHouse#101994, ClickHouse#102158, ClickHouse#101952, ClickHouse#102148, ClickHouse#102008, ClickHouse#102010) # Conflicts: # src/Common/AsynchronousMetrics.cpp
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 17, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 17, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 17, 2026
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 18, 2026
…lickHouse#101994, ClickHouse#102158, ClickHouse#101952, ClickHouse#102148, ClickHouse#102008, ClickHouse#102010) # Conflicts: # src/Formats/FormatSettings.h
Onyx2406
added a commit
to Onyx2406/ClickHouse
that referenced
this pull request
Apr 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stress test (arm_tsan) hits a hung check failure because USearch's HNSW graph construction does not respect query cancellation. When
KILL QUERYis issued, threads stuck inside USearchaddkeep running indefinitely, especially under TSan where each operation is very slow.Add a cancellation check before calling USearch
add. This letsKILL QUERYinterrupt index building.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102000&sha=9190a5549402d12fff136f61209c5405f2aa896c&name_0=PR&name_1=Stress%20test%20%28arm_tsan%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