Repository navigation
Wait for Replicated database recovery on the replica digest instead of scanning text_log in two tests - #123816
Conversation
05293_keeper_map_replica_recovery_keeps_data and 04651_timeseries_recover_lost_replica detected the end of a forced Replicated database recovery by counting the line "All tables are created successfully" in system.text_log. The filter is on logger_name/message, not on the table key, so every count was a full scan of the server-wide log: 3 per run in 05293, 7 in 04651. In Stateless tests (arm_binary, AsyncInsert, s3 storage, parallel) on ClickHouse#123755 the log had 12-14M rows on the s3 disk and, with the randomized read settings, each scan took about 220 s, so 05293 hit the 600 s timeout while the recovery itself had finished in about 30 ms. 04651 failed 8 times in 30 days in the amd_tsan flaky check with "Test runs too long". DatabaseReplicated::recoverLostReplica rewrites the replica digest node as its last step, and both tests arm the recovery by setting that node to 42 right before DETACH/ATTACH DATABASE. Poll that node through system.zookeeper instead: one Keeper read per poll, independent of the log size and of the storage. The signal is later than the old log line, so the assertions that follow see at least as much finished state. 04651 keeps its three log-line checks and bounds them to rows written since the test started. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (3 nits, no code findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261004-033400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20261004-024800 |
|
Workflow [PR], commit [ce16473] Summary: ✅ AI ReviewSummaryThis PR replaces the expensive Findings
Final Verdict
|
| } | ||
|
|
||
| # The log checks read only this run's part of the server-wide text_log. | ||
| TEST_START=$(${CLICKHOUSE_CLIENT} -q "SELECT toUnixTimestamp(now())") |
There was a problem hiding this comment.
Starting TEST_START here still includes the initial DROP DATABASE IF EXISTS ${DB} cleanup window. If a previous failing run left test_rdb wedged, leftover DatabaseCatalog retries or DatabaseReplicated recovery messages written while that cleanup is tearing the old database down will satisfy the later event_time >= toDateTime(${TEST_START}) predicates, so the new log oracles are not actually scoped to the current recovery attempt. Please move TEST_START to after the initial cleanup/CREATE DATABASE, or make DB unique per run.
|
Good to merge! |
Related: #122917
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05293_keeper_map_replica_recovery_keeps_datahit the 600 s timeout inStateless tests (arm_binary, AsyncInsert, s3 storage, parallel): report. The recovery took about 30 ms. The time went into the test's own wait: it countedAll tables are created successfullyinsystem.text_logthree times, and each count is a full scan of the server-wide log, because the filter is not on the key. In that job the log had 12-14M rows on the s3 disk, and with the randomized read settings each scan took about 220 s. The same lane also had passing runs of 244 s and 198 s that day.04651_timeseries_recover_lost_replicauses the same helper. It failed 5 times in 30 days inamd_tsan, flaky checkwithTest runs too long (> 180s)(example).The change touches tests only. The last step of
recoverLostReplicarewrites the replica'sdigestnode, and both tests arm the recovery by setting that node to42. The tests now wait untilsystem.zookeepershows that node is no longer42, which is a small Keeper read per poll. 04651 keeps its three log-line checks but reads only the rows written since the test started (event_time >= <test start>).Validation:
async_insert=1.KeeperMapdata when aReplicateddatabase replica recovers #122917, the old and new 05293 fail with the same diff.recovered 0.Workflow [PR]
Sync PR [sync-upstream/pr/123816]
Version info
26.10.1.1670-master(included in26.10and later)