Mark caught LOGICAL_ERROR exception as logged in BackupDataFileNameGenerator gtest#106668
Conversation
…rowsOnZeroChecksum The test deliberately exercises the zero-checksum guard in `getBackupDataFileName`, which throws `DB::Exception(LOGICAL_ERROR, ...)`. On non-debug, non-sanitizer builds (e.g. `Unit tests (amd_llvm_coverage)`) the test passes, but `Exception::~Exception()` then logs the exception through `ForcedCriticalErrorsLogger` because `LOGICAL_ERROR` is treated as an "important" error code unless `markAsLogged` has been called. The resulting `Code: 49. DB::Exception: Backup checksum should not be zero (test.bin). (LOGICAL_ERROR)` line plus its full stack trace ends up on the gtest binary's stderr after the test's `[ OK ]` line. When an unrelated test in the same `unit_tests_dbms` binary later hangs (e.g. `SchedulerWorkloadResourceManager.DropNotEmptyQueueLong` per the report linked below), the wrapping `gdb -batch ... -ex run` runner times out, kills the binary mid-suite, and `gtest.json` is never written. The Praktika `from_gtest` parser then has nothing to parse and falls back to log-scraping, which surfaces the leaked `Backup checksum should not be zero` stack trace as a fake `-FunctionsStress` failure in CIDB. Sixteen hits across `Unit tests (amd_llvm_coverage)` on PRs ClickHouse#100177, ClickHouse#105784, ClickHouse#96100 over the past 60 days follow this pattern; the underlying contributor is the chronic `SchedulerWorkloadResourceManager` / `FunctionsStress` family hang, not the backup test. Replace `EXPECT_THROW(..., Exception)` with an equivalent `try` block that calls `markAsLogged` on the caught exception, mirroring the pattern already used in `executeQuery.cpp` (commit 64a4caa "Mark fuzzer exceptions as logged to prevent ForcedCriticalErrorsLogger") to suppress the stray stack trace. Verified locally: built `unit_tests_dbms` in release mode (`-O3 -DNDEBUG`, `ENABLE_TESTS=1`, no sanitizer) and confirmed the pre-fix binary prints a 17-frame stack trace to stderr on this test, while the post-fix binary runs the test silently with `[ OK ]` and no trace. Related: ClickHouse#100177 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
cc @jkartseva — could you review this? Test-only change in |
|
Workflow [PR], commit [f428aac] Summary: ❌
AI ReviewSummaryThis PR replaces Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 7/7 (100.00%) | Lost baseline coverage: none · Uncovered code Newly covered by added/modified tests: 324 line(s), 20 function(s) across 105 file(s) · Details Top files
|
|
CI ledger for HEAD
CI fully finished at 2026-06-07 12:13:43Z. Mergeable Check + PR aggregator failures are downstream of the chronic STID 2651-3359 stateless test crash. |
Fix #107053 (need review) |
7be48ac

Related: #100177
BackupDataFileNameGeneratorTest.ThrowsOnZeroChecksumdeliberately throwsDB::Exception(LOGICAL_ERROR, ...)fromgetBackupDataFileNameto validate the zero-checksum guard. On non-debug, non-sanitizer builds (e.g.Unit tests (amd_llvm_coverage)) the test passes, butException::~Exceptionthen logs the exception with a stack trace viaForcedCriticalErrorsLoggerbecauseLOGICAL_ERRORis "important" unlessmarkAsLoggedwas called. The trace ends up on the gtest binary's stderr, after the test's[ OK ]line.When an unrelated test in the same
unit_tests_dbmsbinary later hangs and thegdb -batch ... -ex runrunner times out and kills the binary mid-suite,gtest.jsonis never written. Praktika'sfrom_gtestparser falls back to log-scraping, which then surfaces the strayBackup checksum should not be zero (test.bin). (LOGICAL_ERROR)trace as a fake-FunctionsStressfailure in CIDB. 16 such hits acrossUnit tests (amd_llvm_coverage)on PRs #100177, #105784, #96100 in the last 60 days — all attributable to the underlyingSchedulerWorkloadResourceManager/FunctionsStresschronic hang family, not the backup test.Replace
EXPECT_THROW(..., Exception)with an equivalenttryblock that callsmarkAsLoggedon the caught exception, mirroring the pattern from commit64a4caa39242("Mark fuzzer exceptions as logged to preventForcedCriticalErrorsLogger") insrc/Interpreters/executeQuery.cpp. Verified locally with a release-modeunit_tests_dbms(-O3 -DNDEBUG,ENABLE_TESTS=1, no sanitizer): the pre-fix binary prints a 17-frame stack trace to stderr on this test, while the post-fix binary runs the test silently with[ OK ]and no trace.CI report containing the trace: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100177&sha=6e1a7cdc1170bb75bbcc76d5c46ba23c6cc38855&name_0=PR&name_1=Unit%20tests%20%28amd_llvm_coverage%29
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Version info
26.7.1.406