Skip to content

Pin test 04630 to the local disk: it corrupts shared S3 keys in stress runs - #113978

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-04630-stale-packed-pin-local-disk
Aug 9, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-04630-stale-packed-pin-local-disk

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Test 04630_merge_over_stale_packed_tmp_dir (added in #111652) copies a packed part directory with plain cp to simulate a stale tmp_merge_ directory left by an interrupted merge. Stress jobs flip the default MergeTree storage_policy to (cached) S3 or Azure in the server config (tests/docker_scripts/stress_runner.sh) without passing the corresponding flag to clickhouse-test, so the no-object-storage tag does not protect them and the test runs with the table on a remote disk.

On a remote disk, cp duplicates the metadata files without incrementing the blob reference counts. When the merge reclaims the stale directory, it deletes blobs still referenced by the live part, and every later read of that part fails with The specified key does not exist, tripping the stress check's global no-such-key detector. This has failed the stress checks on every run since the test merged (2026-08-07): 15+ unrelated PRs plus master, all with t_merge_over_stale_packed in the failure context.

The fix pins storage_policy = 'default' at CREATE TABLE, which overrides the config-level <merge_tree> default, so the part directory is always a genuine local copy and the reclaim removes only local files. The test's purpose — merge reclaiming a stale packed tmp_merge_ directory on the local filesystem — is unchanged. Verified locally: the test passes.

Example failure on an unrelated PR (#111990): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111990&sha=279101c71314bcf8e46a083cbf950ecb2143aa44&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29

Related: #111652

Changelog category (leave one):

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

…s runs

The test copies a packed part directory with plain cp to simulate a stale
tmp_merge directory. Stress jobs flip the default MergeTree storage_policy
to (cached) S3 or Azure in the server config without passing the
corresponding flag to clickhouse-test, so the no-object-storage tag does
not protect them. On a remote disk, cp duplicates the metadata files
without incrementing the blob reference counts, and reclaiming the stale
directory deletes blobs still referenced by the live part - every later
read of it fails with 'The specified key does not exist', tripping the
stress check's no-such-key detector. Pin storage_policy = 'default' so the
part directory is always a genuine local copy.

Seen on every stress run since the test merged, e.g.
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111990&sha=279101c71314bcf8e46a083cbf950ecb2143aa44&name_0=PR&name_1=Stress%20test%20%28arm_tsan%29
(PR: #111990)

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

clickhouse-gh Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2d0a98f]

Summary: ✅


AI Review

Summary

This PR hard-pins 04630_merge_over_stale_packed_tmp_dir.sh to the built-in default storage policy so the test keeps using a real local part directory even when stress jobs flip the global MergeTree default to S3 or Azure. I did not find a correctness issue in the patch: tracing the stress-runner config and storage-policy resolution shows that storage_policy = 'default' resolves to the built-in single-disk local policy, which removes the object-storage blob-sharing failure mode described in the PR.

Missing context / blind spots
  • ⚠️ The stress shards that exercise the reported failure mode were still pending at review time, so I could only validate the fix by code tracing and existing config semantics, not from a completed PR stress report.
Final Verdict

✅ No review findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 8, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2d0a98fac with master 8cb46d93b (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: compile time of recompiled translation units.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 690.64 MiB 687.62 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units ⚠️

7023 translation units recompiled, 6598 s compile time in total, 6 of them have a recent master baseline.

Translation units without a recent master baseline:

  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Passes/PassBuilder.cpp: 25.2 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp: 16.2 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 14.6 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/vm/plugin_modules.cpp: 13.7 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient.cpp: 12.8 s
  • contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient1.cpp: 12.3 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/AttributorAttributes.cpp: 11.5 s
  • contrib/rocksdb-cmake/__/rocksdb/db/db_impl/db_impl.cc: 10.3 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Passes/PassBuilderPipelines.cpp: 9.5 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp: 9.5 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/api/wasmedge.cpp: 9.2 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/vm/vm.cpp: 9.1 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/CodeGen/CodeGenPrepare.cpp: 9.1 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/host/wasi/wasimodule.cpp: 9.1 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp: 9.1 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp: 8.5 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp: 8.4 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp: 8.4 s
  • contrib/wasmedge-cmake/__/wasmedge/lib/host/wasi/wasifunc.cpp: 8.1 s
  • contrib/llvm-project-cmake/__/llvm-project/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp: 8.0 s
  • ... and 99 more

Job report

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The only red on 2710bb3f, Stress test (amd_asan_ubsan), is unrelated to this test-only change: it is the known type-equality chassert in HashJoin buildAdditionalFilter (mixed JOIN ON over a dictionary, STID 2508-2e0c), tracked in #113931 with the fix in #113534 (open, not yet on master). Merged master to re-run CI.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge it, but we don't allow modifying table data in stateless tests at all.
It should be an integration test.

@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 9, 2026
Merged via the queue into master with commit 8257b64 Aug 9, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-04630-stale-packed-pin-local-disk branch August 9, 2026 18:03
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 9, 2026
alexey-milovidov added a commit that referenced this pull request Aug 10, 2026
…tegration

Conflict: master pinned `storage_policy` to `default` in
`04630_merge_over_stale_packed_tmp_dir.sh` (the local-disk workaround from
#113978), while this branch removes
the stateless test entirely. Resolved by keeping the deletion — the scenario now
lives in the integration test `test_packed_io::test_merge_over_stale_packed_tmp_dir`,
which controls the disk configuration directly, so the pin is no longer needed.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 10, 2026
Four of the five red checks on the previous head are resolved by fixes that
landed on master after this branch last moved:

- Stress test (amd_tsan), Bad cast from ColumnString to ColumnNullable:
  fixed by ClickHouse#113925.
- Stress test (arm_asan_ubsan), S3_ERROR No such key in
  04630_merge_over_stale_packed_tmp_dir: fixed by ClickHouse#113978, which pins that
  test to the local disk.
- Stateless tests (amd_tsan, parallel), 04722_count_substrings_cancellation:
  the test was removed from master in d5bc955.
- Bugfix validation (unit tests), inconclusive on submodule drift between the
  merge-base and the checkout: the merge takes master's submodule pins, so the
  two trees agree again.
pull Bot pushed a commit to sonvt1710/ClickHouse that referenced this pull request Aug 16, 2026
…test

Stateless tests must not modify table data on disk: the suite runs against
arbitrary server configurations (object storage, shared merge tree, encrypted
disks), where direct manipulation of part directories is either impossible or
corrupts shared state. The scenario moves to
`test_packed_io::test_merge_over_stale_packed_tmp_dir` unchanged: a merge must
reclaim a stale `tmp_merge_` directory left by an interrupted attempt and must
not seed any data from it.

See ClickHouse#113978 (review)
Related: ClickHouse#113978
Related: ClickHouse#111652

Co-Authored-By: Claude Fable 5 <[email protected]>
pull Bot pushed a commit to erickirt/ClickHouse that referenced this pull request Aug 23, 2026
…gration tests

Stateless tests must not modify the server's data on disk: the suite runs
against arbitrary server configurations (object storage, shared merge tree,
encrypted disks), where the local part layout either does not exist or does
not mean what the test assumes, and modifying it corrupts shared state.

37 stateless tests move to integration tests, grouped by scenario:
- test_broken_projections (extended): 02254, 04511
- test_broken_tmp_txn_version_startup (extended): 04104, 04492, 04493, 04507
- test_lost_part (extended): 02369, 02370, 04215
- test_corrupted_part_files (new): 02253, 02255, 02444, 04151, 04235, 04323, 04506
- test_mutations_with_tampered_parts (new): 04401, 04412, 04426, 04427, 04428, 04431
- test_attach_tampered_detached_parts (new): 04063, 04246, 04402, 04403, 04404, 04425
- test_backups_from_disk (new): 04054, 04495, 02864, 03001_restore..., 03214, 03231,
  replacing helpers/install_predefined_backup.sh; the canned backups move along
- test_server_metadata_files (new): 03001_matview..., 04329, 04545

The conversions are faithful: every .reference output became an exact
assertion, the explanatory comments are preserved, and DETACH/ATTACH stayed
DETACH/ATTACH except where the original explicitly emulated a server restart
(02255, 04215). Notable: 02444's `rm -f "$path/*.bin"` never expanded the
glob (quoting bug), so its corruption was an accidental no-op; the converted
test applies it for real and the assertions still hold.

See ClickHouse#113978 (review)
Related: ClickHouse#114056
Related: ClickHouse#114057

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants