Skip to content

Fix test_copy_of_temporary_table_under_unrelated_name after the duplicate-UUID rule of #123902 - #125292

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-test-copy-of-temporary-table-unrelated-name
Oct 12, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-test-copy-of-temporary-table-unrelated-name

Conversation

@groeneai

@groeneai groeneai commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #123832
Related: #123902

Changelog category (leave one):

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

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

test_copy_of_temporary_table_under_unrelated_name (added in #123832, whose CI ran before #123902 was merged) fails on every master run: Integration tests (amd_tsan, 2/8), ClickHouse server is still running, but was expected to shutdown. #123902 removes, at load, a _tmp_replace_* metadata file whose UUID matches any table of the database, and its test 05325 expects the server to start in this case. The arm expected a UUID collision.

The arm now expects the start: t and u remain, u keeps its 100 rows, and the temporary file is removed. It asserts the #123902 message for this file, which is only logged if the copy rule of #123832 left the file alone.

Validation with CI amd_binary builds: the old arm fails on master 34e2636; the new arm passes there (15 of 15 module runs) and fails on the build of #123832 alone.


Workflow [PR]
Sync PR [sync-upstream/pr/125292]

Version info

  • Merged into: 26.10.1.2175-master (included in 26.10 and later)

…e#123902

The arm was added by ClickHouse#123832, whose CI ran before ClickHouse#123902 was merged.
ClickHouse#123902 makes `DatabaseOrdinary::loadTablesMetadata` remove a deferred
`_tmp_replace_*` metadata file whose UUID matches any table of the
database, whatever its name, and its test 05325 expects the server to
start in that case. So a copy of the temporary table's metadata under an
unrelated name (`u.sql`) is no longer a UUID collision: the server
starts, and the arm's `start_clickhouse(expected_to_fail=True)` failed on
every master run.

The arm now expects the start with `t` and `u` (which keeps the data),
the temporary file removed, and the message of the ClickHouse#123902 rule for this
file. That message can only be logged if the copy rule of ClickHouse#123832 left
the file alone, so the arm still checks that the copy rule only handles
destinations of the temporary table's own moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Oct 12, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex) and my own cold review of the diff: 0 findings from both. Coverage: the changed test module and its helpers, both load-time cleanup rules (DatabaseOnDisk::iterateMetadataFiles, DatabaseOrdinary::loadTablesMetadata), the startup flow, the sibling arms, and 05325_create_or_replace_leftover_tmp_metadata.

Session id: cron:clickhouse-review-slot-9:20261012-005300

@groeneai groeneai added the groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding label Oct 12, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. test_database_disk/test.py::test_copy_of_temporary_table_under_unrelated_name with the CI amd_binary of master 34e2636 fails 1 of 1 with the CI error (ClickHouse server is still running, but was expected to shutdown, test.py:174). In CI it failed in 4 of 4 master jobs, after the in-job retry, sanitizer and non-sanitizer builds alike.
b Root cause explained? Two merged PRs expect opposite outcomes for the same leftover. #123832 removes a _tmp_replace_* metadata file at load only when it is a copy of a destination of its own move, and its arm expected a copy named u.sql to stay a UUID collision. #123902, merged after #123832's last CI run, removes a deferred _tmp_replace_* file whose UUID matches any parsed table of the database. With both, the server logs Metadata file .../_tmp_replace_... refers to the same table (UUID ...) as .../u.sql ... Removing it. and starts, so the expected_to_fail=True start raises.
c Fix matches root cause? Yes. The start is the intended behaviour of #123902: its test 05325_create_or_replace_leftover_tmp_metadata asserts it for a _tmp_replace_* copy with an unrelated name hash. The arm is rewritten to the merged behaviour. No bound is widened and no tag is added.
d Test intent preserved / new tests added? Yes. The arm still checks that the copy rule only handles move destinations: the asserted #123902 message for this file can only be logged if the copy rule left the file alone, because a file the copy rule removes is erased from the list before the deferred _tmp_replace_* pass. It now also checks t and u, u's 100 rows, and that the temporary file is gone. Test-only change, so no new test is needed.
e Both directions demonstrated? Yes. Old arm on the master build: FAIL with the CI error and the #123902 message in the server log. New arm on the master build: PASS, plus 15 of 15 whole-module runs with random settings (75 passes). New arm on the build of #123832 alone (4b3a852852ce, no #123902): FAIL, Cannot start ClickHouse with Mapping for table with UUID=... already exists in clickhouse-server.err.log.
f Fix is general across code paths? N/A, test-only. The sibling arms (test_interrupted_rename_of_temporary_table[*], test_interrupted_drop_of_temporary_table) pass on master unchanged. No other test under tests/ expects a startup failure from a _tmp_replace_* duplicate.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A, test-only; no product input surface changes.
h Backward compatible? (maintainer-approved exception only) N/A, no src/ or setting change.
i Invariants and contracts preserved? Product code is untouched. The arm leaves the server running and drops its database, as the module's other arms expect: the module passes in file order in all 15 runs.

Session id: cron:clickhouse-impl-slot-6:20261012-002800

@groeneai
groeneai requested a review from tavplubix October 12, 2026 01:07
@clickhouse-gh

clickhouse-gh Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3e84b091]

Summary: ✅


AI Review

Summary

This PR updates test_copy_of_temporary_table_under_unrelated_name to the post-#123902 startup behavior, where a copied _tmp_replace_* metadata file under an unrelated name no longer causes a duplicate-UUID startup exception because the later duplicate-UUID cleanup pass removes the temporary-file leftover. The revised assertions still preserve the original intent from #123832: they prove the generic copy-destination cleanup did not remove the temporary file first, and that the surviving table is loaded as u with the expected data. I did not find correctness, coverage, or PR-metadata issues in the changed test or in the affected metadata-loading paths.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Oct 12, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 12, 2026
Merged via the queue into ClickHouse:master with commit b6bcfca Oct 12, 2026
173 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
otselnik added a commit to otselnik/ClickHouse that referenced this pull request Oct 12, 2026
Merge upstream `360bb0de656eb8f83cea4ca307f8480348494eb4`, including the
existing fix for the unrelated database-disk CI failure in PR ClickHouse#125292.

Related: ClickHouse#116257
Related: ClickHouse#125292
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 12, 2026
Picks up ClickHouse#125292, the fix for test_copy_of_temporary_table_under_unrelated_name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fm4v added a commit that referenced this pull request Nov 1, 2026
The merge queue is meant to fail fast, so its targeted checks stop at 3
failed tests (`--max-failures 3` for `clickhouse-test`, `--maxfail` for
pytest, with the sequential integration phase getting what remains of the
limit and dropped once it is reached), do not rerun the failed integration
tests, and stop at 20 minutes from their start, the budget of the
merge-queue flaky check, instead of 30. Reaching the time limit stops the
tests without failing the job, as before.

The merge-queue flaky check keeps its 20-minute limit and 5 failures.

The changed stateless tests and those `master` changed after the PR's last
CI run run only in the merge-queue flaky check, which already reruns them
since #126406; the targeted
integration check reruns the integration test modules `master` changed.

Related: #123832
Related: #125292
@clickhouse-gh clickhouse-gh Bot added comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-database-engines Database engine implementations (e.g., Atomic/Replicated) and database-level behavior. groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding 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.

3 participants