mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
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 #102017 (cited #106425, #104561, #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: https://github.com/ClickHouse/ClickHouse/pull/102017 Related: https://github.com/ClickHouse/ClickHouse/pull/106563 Related: https://github.com/ClickHouse/ClickHouse/pull/101576 Co-Authored-By: Claude Opus 4.8 <[email protected]>