Skip to content

Convert test 04630_merge_over_stale_packed_tmp_dir to an integration test - #114057

Merged
alexey-milovidov merged 12 commits into
masterfrom
convert-04630-to-integration
Aug 16, 2026
Merged

alexey-milovidov merged 12 commits into
masterfrom
convert-04630-to-integration

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Related: #113978
Related: #111652

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. Modifying table data on disk is not allowed in stateless tests at all: the stateless suite runs against arbitrary server configurations (object storage, shared merge tree, encrypted disks), where direct filesystem manipulation is either meaningless or destructive — this test corrupted shared S3 blob reference counts in stress runs (#113978 (review)) before it was pinned to the local disk in #113978.

This PR moves the scenario to the integration test test_packed_io::test_merge_over_stale_packed_tmp_dir, where the cluster environment is fully controlled and the part directory can be copied safely inside the container. The test logic and all assertions are unchanged: the merge must reclaim the leftover tmp_merge_all_1_2_1 directory (verified via the Removing stale temporary directory log message and the directory being gone), must not seed any data from it into the new part, and the resulting packed part must pass CHECK TABLE. Verified locally: the new integration test passes.

A style check preventing new stateless tests from modifying the server's data directory is added separately in #114056.

Changelog category (leave one):

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

Version info

  • Merged into: 26.8.1.1486 (included in 26.8 and later)

…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 #113978 (review)
Related: #113978
Related: #111652

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

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [73f0f86]

Summary: ✅


AI Review

Summary

This PR removes 04630_merge_over_stale_packed_tmp_dir from the stateless suite and moves the same stale-tmp_merge_ reclaim scenario into test_packed_io::test_merge_over_stale_packed_tmp_dir, while keeping the local-disk storage_policy = 'default' precondition explicit. I did not find any remaining correctness or coverage regressions in the current code; the prior ownership concern is addressed because the cp -r now runs under the container's configured uid instead of root.

Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 9, 2026
alexey-milovidov added a commit that referenced this pull request Aug 9, 2026
…ateless tests

The check (`server_data_manipulation_in_stateless_tests`) flags stateless `.sh`
tests that fetch a server-side filesystem path from a system table
(`system.parts`, `system.detached_parts`, `system.projection_parts`,
`system.tables`, `system.disks`, `system.server_settings` with `name = 'path'`)
and also run file-modifying shell commands. With all offenders converted to
integration tests in this PR, the exclusion list holds only one documented
false positive and one test whose conversion is pending in
#114057.

Folds in #114056.

Co-Authored-By: Claude Fable 5 <[email protected]>
…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.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and pushed. The conflict was in 04630_merge_over_stale_packed_tmp_dir.sh: master pinned its storage_policy to default (the local-disk workaround from #113978) while this branch deletes the test — resolved by keeping the deletion, since the integration test controls the disk configuration directly and does not need the pin.

The new test already passed in the previous run: test_packed_io/test.py::test_merge_over_stale_packed_tmp_dir — OK in Integration tests (amd_msan, 4/8).

Both stress failures on 808c8255 are pre-existing on master and unrelated to this test-only change:

Code Review reported ERROR (the job itself failed, no findings were produced); it will be retried in the run for the merge commit.

…stale_packed_tmp_dir`

The test copies a part directory with plain `cp`, which is only valid on a
local disk. Pin the policy explicitly so the precondition is encoded in the
test instead of relying on the module's implicit default `MergeTree` policy
staying local.
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Addressed the review (pinned storage_policy = 'default' in the integration test) and merged master.

Both stress failures on d4a0bc6 are unrelated to this test-only PR and reproduce fleet-wide:

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (4b61b18) for a fresh CI run; the PR diff is unchanged (test-only move).

Both stress failures on 27e696f are the same known hang, unrelated to this PR:

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (be448743731f) for a fresh CI run; the PR diff is unchanged (test-only move).

All three stress reds on 4b61b18b are unrelated:

@clickhouse-gh

clickhouse-gh Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 73f0f8631 with master 98ee3b2b4 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 694.45 MiB 691.43 MiB -3.02 MiB (-0.43%)

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

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

Job report

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (d9c3888859de) for a fresh CI run; the PR diff is unchanged (test-only move).

All three reds on be448743 are unrelated to this pull request, which only moves a test between suites:

@alexey-milovidov alexey-milovidov self-assigned this Aug 16, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 16, 2026
Merged via the queue into master with commit 2a53991 Aug 16, 2026
181 checks passed
@alexey-milovidov
alexey-milovidov deleted the convert-04630-to-integration branch August 16, 2026 00:30
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 16, 2026
alexey-milovidov added a commit that referenced this pull request Aug 21, 2026
…`05019`

Two stateless tests that landed on `master` since the last merge are reported by
`server_data_manipulation_in_stateless_tests`:

- `04630_text_index_serialization_version_compatibility.sh` is a false positive:
  it runs `clickhouse-local` against its own `--path` under `CLICKHOUSE_TMP` and
  removes only that scratch directory. `clickhouse-local` is not the server, so
  the file-level gate now ignores the paths it reports, together with the rest of
  a query that continues on the following lines. Whatever precedes the invocation
  on the line is kept, so a real server-side fetch on the same line still counts.
  This also covers `03525_filesystem_caches_clickhouse_local.sh`, whose exclusion
  entry is dropped; the entry for `04630_merge_over_stale_packed_tmp_dir.sh` is
  dropped too because #114057 merged
  and deleted that test.
- `05019_window_view_attach_wrapped_interval.sh` is a real violation: it rewrites
  the table metadata `.sql` with `sed -i`. Converted to
  `test_server_metadata_files/test.py::test_window_view_attach_wrapped_interval`,
  which edits the metadata through `helpers/database_disk.py` so it also works
  with a remote database disk, and additionally asserts that a full-definition
  `ATTACH` of the unsafe interval is still rejected.

Regression probes added for the `clickhouse-local` rule (44 tests pass).
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