Skip to content

Stop a cache-warm read of an already-removed part from failing the lost-S3-keys checks - #113243

Open
tiandiwonder wants to merge 1 commit into
masterfrom
fix-ci-lost-s3-keys-cache-warm
Open

tiandiwonder wants to merge 1 commit into
masterfrom
fix-ci-lost-s3-keys-cache-warm

Conversation

@tiandiwonder

Copy link
Copy Markdown
Contributor

Problem

The Lost s3 keys and S3_ERROR No such key thrown (in clickhouse-server.log or clickhouse-server.err.log) checks both failed on a job whose tests were all green, quoting the same line (same request id):

File name: test/ffx/avmoqhjkisdnuurkyppycsnrkkgjj,
local file name: data/5adcf7ee-.../all_1_1_0/columns_substreams.txt,
last error: Code: 900. DB::Exception: Received error from distributed cache:
            Code: 499. DB::Exception: The specified key does not exist.
Cache info: file segments: 1 (front: File segment: [0, 72], state: DOWNLOADING, downloaded size: 0,
            downloader id: None:cache-warm:10623:3931, caller id: None:cache-warm:10623:3931,
            background download: 1)

The reader is a background cache-warm task and the file segment is still DOWNLOADING with downloaded size: 0. From the job's server log, the blob was deleted 0.99 s before the read, legitimately, together with the part that owned it:

time event
07:21:55.773 keeper_retries_r2 removes all_1_1_0
07:21:55.817 deleteFileFromS3 deletes the shared blob test/ffx/avmoqhjkisdnuurkyppycsnrkkgjj
07:21:56.808 CacheWarmer::downloaderThread GETs that key → NoSuchKey
07:21:57.003 the distributed-cache fallback re-reads it directly → NoSuchKey again

Nothing is lost: cache warming is best effort, the segment never leaves DOWNLOADING, and CacheWarmer already treats a missing object as expected (it logs NO_SUCH_KEY at test level, noting the part was deleted and that this happens a lot in practice) — consistent with that, the warmer printed nothing here. The only cost is a red job.

Root cause

The checks grep line by line, but a ClickHouse exception log entry spans many lines: the message, the stack trace, then a trailing (version …) (…) line carrying whatever addMessage appended.

The entry that trips the checks is <Debug> ReadBufferFromDistributedCache: Failed to read from distributed cache. Will read from object storage directly. Error: … — a logger the ignore list already covers. But the addendum on its trailing line repeats the nested Code: 499 … The specified key does not exist, and that line carries no logger name, so none of the ignores matched it. Running the current master command over the job's 12 M-line server log leaves exactly this one line.

Two things this rules out: severity is not the trigger (all 17 lines mentioning the key are <Debug>/<Trace>, and the check is a plain text grep), and silencing the warmer would not help (the line is printed before the exception ever reaches it).

Solution

Ignore caller id: None:cache-warm, mirroring the existing caller id: None:DistribCache entry. FileSegment::getCallerId renders a caller with no query id as None:<thread name>:<tid>, and the distributed-cache client sends the same string as the query id when its calling thread has none, so every cache-warmer read is tagged this way whether it goes through the distributed cache or straight to object storage. The ignore is narrow: a genuinely lost blob still fails the queries that read the part, and those are reported.

Both copies of the scan are updated — ci/jobs/scripts/clickhouse_proc.py and check_logs_for_critical_errors in tests/docker_scripts/stress_tests.lib.

The ignore list and the command move to module level so the check can be exercised from ci/tests. ci/tests/test_no_such_key_ignores.py runs the real command against a fixture log: the verbatim line from the failing job must pass, a genuine <Error> executeQuery: … Code: 499 … must fail, each ignored substring must suppress a line naming it while the same line without it is still reported, and the -e tokens of the stress_tests.lib copy must equal the Python list so the two cannot drift.

Verified against the failing job's own clickhouse-server.log (2.1 GB decompressed): without the new ignore the check exits 1 quoting the byte-identical line from the CI report; with it the check is clean.

CI report: https://s3.amazonaws.com/clickhouse-test-reports-private/PRs/67155/1182039bb62ad84459632386c2147ca05f0672a1/stateless_tests_amd_asan_ubsan_distributed_cache_meta_in_keeper_s3_storage_parallel_1_2.html (job Stateless tests (amd_asan_ubsan, distributed cache, meta in keeper, s3 storage, parallel, 1/2) of ClickHouse/clickhouse-private#67155, where the failure was observed; it is pre-existing and not caused by that PR)

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

The `Lost s3 keys` and `S3_ERROR No such key thrown` checks failed on a job
whose tests were all green, both quoting the same line: a background
cache-warm read of a blob that had been deleted 0.99 s earlier together with
the part that owned it. The read is best effort - the file segment never
leaves `DOWNLOADING`, nothing is served from it, and `CacheWarmer` already
treats a missing object as expected - so nothing is lost.

The checks grep line by line, but an exception log entry spans many lines:
message, stack trace, then a trailing `(version ...) (...)` line carrying
whatever `addMessage` appended. `ReadBufferFromDistributedCache`, a logger the
ignore list already covers, logs its fallback to object storage at `<Debug>`,
and the addendum on its trailing line repeats the nested
`Code: 499 ... The specified key does not exist`. That line carries no logger
name, so no ignore matched it.

Ignore `caller id: None:cache-warm` instead, mirroring the existing
`caller id: None:DistribCache` entry. `FileSegment::getCallerId` renders a
caller with no query id as `None:<thread name>:<tid>`, and the distributed
cache client sends the same string as the query id when its calling thread has
none, so every warmer read is tagged this way whether it goes through the
distributed cache or straight to object storage. A genuinely lost blob still
fails the queries that read the part, and those are reported.

The ignore list and the command move to module level so `ci/tests` can run the
real check against a fixture log: the verbatim line from the failing job must
pass, a genuine `<Error> executeQuery` occurrence must fail, and the `-e`
tokens of the `stress_tests.lib` copy must equal the Python list so the two
cannot drift.

Co-Authored-By: Claude Opus 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6cf6dd4]

Summary: ❌

job_name test_name status info comment
CI Tests FAIL
ci/tests/test_lsan_ptrace_probe_filter.py::test_benign_probe_killed_by_sigkill_is_dropped FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_benign_probe_killed_by_sigint_is_dropped FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_benign_probe_killed_by_the_signals_seen_in_ci_is_dropped FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_benign_probe_killed_by_any_non_sigsys_signal_is_dropped FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_repeated_benign_pairs_are_dropped FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_correctly_reported_seccomp_block_is_kept_in_a_tagged_test FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_real_seccomp_block_is_kept_after_a_benign_pair FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_real_seccomp_block_is_kept_before_a_benign_pair FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_warning_without_a_child_exit_line_is_kept FAIL cidb
ci/tests/test_lsan_ptrace_probe_filter.py::test_warning_as_the_last_line_is_kept FAIL cidb
10 more test cases not shown

AI Review

Summary

This PR narrows the NoSuchKey health checks used by the functional and stress jobs so they stop flagging the known best-effort cache-warmer race, and it adds CI tests to keep the Python and shell ignore lists aligned. I traced the changed grep paths in both clickhouse_proc.py and stress_tests.lib, checked that the new regression file is exercised by the CI Tests job, and did not find a correctness or coverage gap in the current patch.

Missing context / blind spots
  • ⚠️ I could not rerun pytest ci/tests/test_no_such_key_ignores.py ci/tests/test_lost_s3_keys_check.py locally because this environment does not have pytest installed (/usr/bin/python3: No module named pytest). The PR already adds coverage in ci/tests/, and that suite is run by the dedicated CI Tests workflow job.
Final Verdict

✅ No findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant