Skip to content

Pin part_loading_tree_rollback tests to the local default storage policy - #110999

Closed
groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/plt-rollback-tests-skip-object-storage
Closed

groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/plt-rollback-tests-skip-object-storage

Conversation

@groeneai

@groeneai groeneai commented Jul 19, 2026 •

Copy link
Copy Markdown
Collaborator

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

Fixes stress-test Cannot start clickhouse-server boot failures with Code: 246 CORRUPTED_DATA: Part all_5_6_1_0 intersects previous part all_1_5_4_1 and the transaction metadata of at least one of them could not be read for tables t_plt_reparent / t_plt_evict_reinsert.

Cause. The four part_loading_tree_rollback tests (04063, 04241, 04417, 04500, added in #100992) fabricate a rolled-back part by writing a raw txn_version.txt straight into the part directory with cp+printf. That is only valid on a local disk. On an object-storage / local_blob_storage disk a part-dir file must be DiskObjectStorageMetadata format, so the raw file fails to parse (CANNOT_PARSE_INPUT_ASSERTION_FAILED in DiskObjectStorageMetadata::deserialize), which #100992's new PartLoadingTree::add txn-metadata read classifies as Unreadable and turns into a fatal Code 246 at part load. The failed ATTACH leaves a detached, poisoned table whose .sql survives to the stress restart, so the next boot aborts.

The tests carry no-object-storage, but that tag only skips the object-storage runner modes (--s3-storage / --azure-blob-storage); it does not fire when the server's default disk is object-storage (as under stress), so the tests run there anyway.

Fix. Pin the four CREATE TABLEs to SETTINGS storage_policy = 'default', so the seeding part always lands on the built-in local default disk even when the MergeTree default policy is object-storage under stress. The raw txn_version.txt fabrication then parses and the PartLoadingTree::add regression keeps running (it is not turned into a skipped no-op). The stress config override (config.d/s3_storage_policy_for_merge_tree_by_default.xml) only sets <merge_tree><storage_policy>, so the built-in default policy is never remapped and the pin is reliable. Same pattern as the already-merged raw-filesystem test 04063_drop_detached_part_with_try_n_suffix.sh.

Deterministic; reproduced both directions locally (object-storage default disk: without the pin Code 246, with the pin the ATTACH succeeds and the assertions run; local disk unchanged).

Follow-ups for the author (@ tuanpach), not addressed here:

  1. Should no-object-storage also skip when the server default disk is object-storage? The runner-flag-only gate misses this whole class of raw part-fabrication tests.
  2. Should the load-time Unreadable txn-metadata case abort the entire server boot, or skip/quarantine the single affected part/table? A single unparseable txn_version.txt currently prevents startup.

These tests fabricate a rolled-back part by writing a raw txn_version.txt
directly into the part directory (cp + printf), which is only valid on a
local disk. On an object-storage disk a part-dir file must be
DiskObjectStorageMetadata format, so the raw file fails to parse and part
loading throws CORRUPTED_DATA (Code 246), which on a stress restart aborts
server startup (Cannot start clickhouse-server).

The no-object-storage tag only skips the object-storage runner modes
(--s3-storage/--azure-blob-storage); it does not fire when the server's
default disk is object-storage. Skip on any non-local disk instead.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Check Result
a Deterministic repro? Yes. run_repro.sh blob -> Code 246 every time; local -> OK. Fabrication is an exact copy of the tests' cp+printf.
b Root cause explained? Yes. #100992 added a read+parse of txn_version.txt at part load; the tests' raw file is not valid DiskObjectStorageMetadata on an object-storage disk -> parse fails -> Unreadable -> fatal Code 246; the poisoned detached table then breaks the stress restart boot.
c Fix matches root cause? Yes. The fabrication is local-disk-only by construction; the guard confines the tests to local disks (the invalidated precondition), not a symptom mask.
d Test intent preserved / new tests? Yes. On a local disk the test runs unchanged with all original assertions; on object storage it is skipped (untestable there). No assertion weakened.
e Both directions demonstrated? Yes. Without guard + object storage -> Code 246; with guard + object storage -> skip -> OK; with guard + local disk -> full test -> OK.
f General, not a narrow patch? Yes. The same raw-fabrication anti-pattern is in exactly these 4 part_loading_tree_rollback tests; the identical guard is applied to all 4. CIDB confirms only t_plt_reparent + t_plt_evict_reinsert fail.
g Generalizes across inputs? Yes. Keys on disk type != 'Local', covering all object-storage backends (s3, azure, local_blob_storage, cache-over-object-storage), not one specific policy.
h Backward compatible? N/A (test-only; no user-visible behavior, settings, or formats).
i Invariants/contracts preserved? Yes. No production code touched; guard uses only read-only system.parts / system.disks.

Session id: cron:clickhouse-author-slot-2:20260719-134600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review — 1 finding, adjudicated (click to expand)

An independent second model reviewed the diff before this PR was opened. Adjudication:

⚠️ Majors

  • generated-meta-file — "The diff includes unrelated workspace-provisioning metadata (.meta.json) that must not be committed." -> DISAGREE. .meta.json is an untracked worktree-provisioning artifact; it is not staged and not in the commit. git show --stat HEAD lists only the 4 test .sh files, and git ls-files .meta.json is empty (git status: ?? .meta.json). It cannot reach the PR since only the committed branch is pushed. No action.

❌ Blockers: none.
💡 Nits: none.

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @tuanpach — could you review? These are the 4 part_loading_tree_rollback tests from #100992; they fabricate a raw txn_version.txt in the part dir, which is only valid on a local disk, so on an object-storage default disk (under stress) part loading throws Code 246 and the restart boot fails. This skips them on non-local disks. The two follow-up questions in the description (the no-object-storage default-disk gap, and whether the load-time Unreadable case should abort boot) are for you to weigh.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jul 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8581ba3]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, WasmEdge, parallel, 2/3) FAIL
03748_default_minmax_indices_alter ERROR cidb
Server died FAIL cidb
Unknown error FAIL cidb

AI Review

Summary

This PR updates four part_loading_tree_rollback stateless tests so they always create their tables on the built-in local default storage policy. That addresses the stress-only failure mode where the server-wide MergeTree default points at object storage and the tests' raw txn_version.txt fabrication stops being a valid local-filesystem setup. The implementation itself looks consistent with that goal and preserves the intended PartLoadingTree::add coverage, but the PR title/description still describe the earlier skip-based approach instead of the final local-policy pinning.

PR Metadata

Changelog category: correct. CI Fix or Improvement matches a test-only CI stabilization change.

Changelog entry: not required for this category, so the placeholder is acceptable.

Findings

💡 Nits

  • [tests/queries/0_stateless/04063_part_loading_tree_rollback_reparent.sh:47] The code now fixes the issue by pinning the tables to storage_policy = 'default', but the PR title/body still describe the superseded "skip on non-local disk" approach. Please update the metadata so the PR contract matches the final patch.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 19, 2026
…of skipping

The four part_loading_tree_rollback tests (04063, 04241, 04417, 04500)
fabricate a rolled-back part by writing a raw txn_version.txt into the part
directory, which only parses on a local disk. The previous approach skipped
the test when the active part was not on a Local disk, but that turns the
PartLoadingTree::add regressions into OK no-ops on every stress run whose
MergeTree default policy is object storage.

Instead pin the CREATE TABLEs to the built-in local 'default' storage policy
(as 04063_drop_detached_part_with_try_n_suffix.sh already does). The built-in
'default' policy is not overridden by the stress-only
s3_storage_policy_for_merge_tree_by_default.xml (which only sets
merge_tree/storage_policy), so the seeding part is always local and the raw
txn_version.txt parses, keeping the coverage active in that environment
instead of dropping it.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
$CLICKHOUSE_CLIENT -q "
CREATE TABLE ${TABLE} (x UInt32)
ENGINE = MergeTree ORDER BY x
SETTINGS storage_policy = 'default'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The final fix here is different from what the PR metadata still describes. The title/body still say these tests are now skipped on non-local disks, but this change actually pins them to storage_policy = 'default' so the PartLoadingTree::add coverage keeps running under stress. Please update the title/description to match the implemented fix; otherwise reviewers are evaluating a superseded contract.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated the title and description to match the implemented fix. Title is now "Pin part_loading_tree_rollback tests to the local default storage policy", and the Description's Fix paragraph now states that the four CREATE TABLEs are pinned to SETTINGS storage_policy = 'default' so the seeding part stays on the built-in local default disk and the PartLoadingTree::add coverage keeps running under stress (not skipped), citing the 04063_drop_detached_part_with_try_n_suffix.sh precedent. The superseded "skip on non-local disks" wording is gone.

@groeneai groeneai changed the title Skip part_loading_tree_rollback tests on non-local disks Pin part_loading_tree_rollback tests to the local default storage policy Jul 19, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 8581ba3

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Stateless (amd_llvm_coverage, old analyzer, s3, DBReplicated, WasmEdge, parallel, 2/3) / 03748_default_minmax_indices_alter (+ Server died + Unknown error, same event) flaky / coverage-job server death (5 PRs, 0 master/30d; unrelated minmax-index test, victim of a coverage-build server death) a fix task is created (investigating at full effort, fixing PR link to follow here)

This PR is test-only (pins 4 part_loading_tree_rollback tests to storage_policy='default'); it touches no server source and cannot cause a server death in an unrelated minmax-index test. Not PR-caused.

Session id: cron:our-pr-ci-monitor:20260719-230000

@tuanpach tuanpach self-assigned this Jul 20, 2026
@tuanpach

Copy link
Copy Markdown
Member

@groeneai Check the CI failure.
Any PR fixing it.

@groeneai

Copy link
Copy Markdown
Collaborator Author

@tuanpach Checked it. The only red job is a server death on Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DBReplicated, WasmEdge, parallel, 2/3): the server stopped responding to the health check at 17:40:34 while 03748_default_minmax_indices_alter was running, so that ERROR plus the Server died and Unknown error rows are all the same single event (CI report).

It is not caused by this PR. The change is test-only (it pins 4 part_loading_tree_rollback tests to storage_policy = 'default') and touches no server source, so it cannot kill the server in an unrelated minmax-index test. That same coverage-job server death has hit 5 unrelated PRs in the last 30 days with 0 hits on master, so it is a pre-existing flake in that job config, not introduced here.

No fixing PR exists yet. I have a task investigating the crash stack from the job's clickhouse-server.err.log and will post the fixing-PR link on this thread as soon as it opens. The AI review on this PR is Approve.

@PedroTadim

Copy link
Copy Markdown
Member

#111055 supersedes this PR

@groeneai

Copy link
Copy Markdown
Collaborator Author

Closing out the finish-ledger line I left open here on 2026-07-19 for 03748_default_minmax_indices_alter.

I read the coverage job's clickhouse-server.err.log and the test is not the failing party. The job had exactly one abort, and its query belongs to a different test:

<Fatal> : Logical error: 'Arguments of 'multiply' have incorrect data types:
          'n' of type 'Int256', '0.123' of type 'Float64''.
BaseDaemon: ... (query: SELECT n * 0.123 FROM (SELECT * FROM tbl_03007_1))
            Received signal Aborted (6)

The handled exceptions right after it carry the owning test's comment tag, (comment: 03915_exchange_tables_race.sh-test_0rxix9kl). Stack is FunctionBinaryArithmetic<MultiplyImpl, NameMultiply>::executeImpl2 (FunctionBinaryArithmetic.h:3360) reached through IFunction::executeImplDryRun from the analyzer's constant-folding pass. 03748_default_minmax_indices_alter was simply in flight when the server went down, so the harness attributed server died to it. The same abort, same query, is in the other two coverage-job hits of this test (2026-07-16 and 2026-07-10), and in two of the three jobs 03915_exchange_tables_race shows up as a co-victim row in its own right.

Owner of that signature: issue #110133, fixed by #110048 (merged 2026-07-26), with #109747 open as the hardening half that stops the type mismatch from aborting during partial result evaluation.

The test's two other CI hits are unrelated to both this PR and to minmax indices: two amd_asan_ubsan, distributed plan hits are the job-wide host memory event (Code 241, current RSS: 41.95 GiB, maximum: 41.84 GiB), which took out 396 and 418 distinct tests respectively in those same jobs. On master the test is 0 failures in 22045 runs over 60 days.

So there is no fix to write for 03748_default_minmax_indices_alter and no fixing PR to link beyond #110048 and #109747 above. Nothing here was caused by this PR.

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 pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants