Fix broken check_callback in test_restore_db_replica#96968
Merged
alexey-milovidov merged 3 commits intomasterfrom Feb 15, 2026
Merged
Fix broken check_callback in test_restore_db_replica#96968alexey-milovidov merged 3 commits intomasterfrom
alexey-milovidov merged 3 commits intomasterfrom
Conversation
…em.session_log` The `DELETE FROM system.session_log` cleanup at the start of test `02835_drop_user_during_session` creates a synchronous lightweight delete mutation. In ASan stress tests, `system.session_log` receives continuous writes from all concurrent test sessions, causing the mutation to take over 12 minutes. Even though the query gets cancelled (`is_cancelled: 1`), it remains stuck in `StorageMergeTree::waitForMutation`. Fix by making the cleanup DELETE non-blocking with `lightweight_deletes_sync = 0`. This is safe because the test user name includes the PID (`$$`), making collisions from PID reuse extremely unlikely during a single stress test run. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96926&sha=724c57e90613f66e2ef897f80a644ba21e98b470&name_0=PR&name_1=Stress%20test%20%28arm_asan%2C%20s3%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a TOCTOU race in the worker thread loop: after `tryPop` timed out (confirming the queue was empty), a context switch could allow the main thread to push the final block and call `finish()` before the worker checked `isFinished()`. The worker would then see the queue as finished and exit, leaving the last block unprocessed. This caused occasional loss of ~2000-3000 rows (one shard's portion of the last source block) in sharded dictionaries loaded in parallel. The fix replaces `isFinished()` with `isFinishedAndEmpty()`, which atomically verifies both that the queue is marked finished AND that no items remain. If items were pushed between the `tryPop` timeout and this check, the worker correctly retries and processes them. Closes #84468 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `check_callback` compared the raw query result (with trailing newline) against the expected table name (without newline), so the callback always returned False. This made `query_with_retry` exhaust all retries uselessly instead of returning early when the table appeared. Also increase `retry_count` from 10 to 30 to give more time for the Replicated database to initialize after node restart, especially in ASan builds. #85664 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
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.
Summary
check_callbackintest_query_after_restore_db_replicathat compared raw query result (with trailing\n) against the expected table name (without\n), causing the callback to always returnFalseand making retries uselessretry_countfrom 10 to 30 to give more time for the Replicated database to initialize after node restart, especially in ASan buildsCloses #85664
Test plan
test_restore_db_replica/test.py::test_query_after_restore_db_replicaChangelog category (leave one):
🤖 Generated with Claude Code