Allowlist system.metric_log flush DEADLOCK_AVOIDED in upgrade-check log scrub#106616
Merged
alexey-milovidov merged 1 commit intoJun 6, 2026
Conversation
…utdown noise The upgrade-check post-restart `<Error>` scrub catches a transient lock-timeout emitted by `SystemLog<MetricLogElement>::flushImpl` when the background `MetricLog` flush loop races with shutdown work on `system.metric_log` during the upgrade restart sequence: ``` <Error> void DB::SystemLog<DB::MetricLogElement>::flushImpl(...) [LogElement = DB::MetricLogElement]: Failed to flush system log system.metric_log with N entries up to offset M: Code: 473. DB::Exception: WRITE locking attempt on "system.metric_log" has timed out! (60000ms) Possible deadlock avoided. Client should retry. Owner query ids: . (DEADLOCK_AVOIDED), Stack trace ... ``` Another worker (DROP/RENAME/DETACH on `system.metric_log`, or a parallel mutation/merge) holds the table-level write lock, the flush blocks for the 60s timeout, and then aborts with code 473 (`DEADLOCK_AVOIDED`). The 473 code is the engine's own "gave up to avoid a deadlock, not a crash" signal — losing a few `MetricLogElement` samples during shutdown is harmless; the upgrade-check stage is not asserting on metric continuity. CIDB confirms this is chronic CI noise, not a code regression: 4 hits across 4 distinct PRs in the last 30 days, 0 master, 100% on `Upgrade check (amd_release)`. Reported by @ alexey-milovidov on PR ClickHouse#102017 (cited ClickHouse#106425, ClickHouse#104561, ClickHouse#106202). The added regex requires BOTH the `SystemLog` flush wrapper for `metric_log` AND the `DEADLOCK_AVOIDED` error code together, mirroring the narrowing approach of the existing `rdk:FAIL.*Connect to.*failed: Connection refused` and `StorageKafka2.*Broker transport failure` filters. Real `metric_log` regressions (other flush errors) and unrelated `DEADLOCK_AVOIDED` hits on other system_log tables (`query_log`, `text_log`, etc.) still surface. Related: ClickHouse#102017 Related: ClickHouse#106563 Related: ClickHouse#101576 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
Pre-PR validation gate
Session id: cron:clickhouse-ci-task-worker:20260605-234100 |
1 task
Contributor
Author
Contributor
|
Workflow [PR], commit [03805a3] Summary: ✅ AI ReviewSummary
Final Verdict
|
Contributor
Author
CI Ledger — covered SHA: 03805a3
Gate satisfied: no queued/in_progress checks, Finish Workflow + Mergeable Check complete, ≥20-min CIDB ingestion buffer met (last activity 04:41Z, ~2.5h ago). waiting_ci → on_review. |
alexey-milovidov
approved these changes
Jun 6, 2026
This was referenced Jun 7, 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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
...
Documentation entry for user-facing changes
Modify your CI run
(default settings, no labels)
The upgrade-check post-restart
<Error>log scrub catches a transient lock-timeout emitted bySystemLog<MetricLogElement>::flushImplwhen the backgroundMetricLogflush loop races with shutdown work onsystem.metric_logduring the upgrade restart sequence. The signature, from CIDB:Another worker (DROP/RENAME/DETACH on
system.metric_log, or a parallel mutation/merge) holds the table-level write lock during the upgrade-test restart, the flush blocks for the 60s timeout, and then aborts with code 473 (DEADLOCK_AVOIDED). Code 473 is the engine's own "I gave up to avoid a deadlock, not a crash" signal — losing a fewMetricLogElementsamples during shutdown is harmless; the upgrade-check stage is not asserting on metric continuity.CIDB confirms this is chronic CI noise, not a code regression:
Upgrade check (amd_release)The added regex requires BOTH the
SystemLogflush wrapper formetric_logAND theDEADLOCK_AVOIDEDerror code together, mirroring the narrowing approach of the existingrdk:FAIL.*Connect to.*failed: Connection refusedandStorageKafka2.*Broker transport failurefilters. Realmetric_logregressions (other flush errors) and unrelatedDEADLOCK_AVOIDEDhits on other system_log tables (query_log,text_log, etc.) still surface.Related: #102017
Related: #106563
Related: #101576
Version info
26.6.1.461