Skip to content

Remove bad tests - #111968

Merged
alexey-milovidov merged 4 commits into
masterfrom
remove-bad-tests
Jul 30, 2026
Merged

alexey-milovidov merged 4 commits into
masterfrom
remove-bad-tests

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Changelog category (leave one):

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

See #111922 (comment)

@clickhouse-gh

clickhouse-gh Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3f88c37]

Summary: ✅


AI Review

Summary

This PR deletes the five part_loading_tree_rollback stateless tests and their references. I do not think it is ready to merge: in the current tree, removing them still drops the only regression coverage for the rollback-specific branches in MergeTreeData::PartLoadingTree::add, and the cited follow-up #111922 has already merged without adding an integration replacement.

Findings
  • ⚠️ Majors
    • [tests/queries/0_stateless/04063_part_loading_tree_rollback_reparent.sh:4] [dismissed by author -- https://github.com/Remove bad tests #111968#discussion_r3653151716] Deleting this family still removes the only coverage for the rollback-only logic in MergeTreeData::PartLoadingTree::add (read_txn_status on existing rolled-back parts, the existing_status == RollbackStatus::RolledBack eviction arms, the evict_and_reinsert ordering invariant, and the tmp-only intersection path in src/Storages/MergeTree/MergeTreeData.cpp:2088-2297). The remaining tests that touch txn_version.txt.tmp (04104, 04492, 04493, 04507, test_broken_tmp_txn_version_startup) only cover stale-metadata cleanup / attach paths; searching the current tests/ tree finds no surviving part_loading_tree_rollback or t_plt_* coverage, and #111922 only hardened these shell tests before they were deleted here.
    • Suggested fix: keep these tests until the promised integration rewrite lands, or land that integration replacement in this PR and delete the stateless versions only once the same PartLoadingTree::add branches are still exercised.
Tests
  • ⚠️ Add the smallest replacement integration coverage that still exercises the current rollback cases: an existing rolled-back containing/intersecting part, evict_and_reinsert with ordered reinsertion, and the tmp-only txn_version.txt.tmp rollback classification. Without that, this PR only removes regression evidence.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required action: do not delete this test family until equivalent integration coverage for the same PartLoadingTree::add rollback paths lands in the same PR.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 26, 2026
#!/usr/bin/env bash
# Tags: no-ordinary-database, no-replicated-database, no-shared-merge-tree, no-encrypted-storage, no-object-storage
#
# Regression test for the child re-parenting path in `PartLoadingTree::add`.

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.

Deleting this family without adding an integration replacement drops the only regression coverage I can find for the rollback-specific branches in MergeTreeData::PartLoadingTree::add. The remaining tests that touch txn_version.txt.tmp (04104, 04492, 04493, test_broken_tmp_txn_version_startup) only cover simpler stale-metadata startup/attach cases; they never build the intersecting/containing part shapes that exercise read_txn_status on an existing rolled-back part, the evict_and_reinsert re-parenting/order invariant, or the tmp-only intersection path added in src/Storages/MergeTree/MergeTreeData.cpp. If these stateless tests are not allowed to fabricate parts, the replacement needs to land as an integration test in the same PR; otherwise a future change can silently reintroduce those ATTACH/startup regressions with no coverage left to catch them.

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've asked @groeneai to rewrite them in #111922 (comment)

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@groeneai, investigate the failures in Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) and provide fixes in separate PRs. If a fix is already in progress, link it here.

This pull request only deletes five stateless test files, so none of the three reds can be caused by it:

  1. Logical error '!part.empty()' (STID: 5217-5b3d) + Server died. The assertion is chassert(!part.empty()) in ASTIdentifier, hit from RemoteQueryExecutor::processParallelReplicaPacketIfAny while processing a MergeTreeAllRangesAnnouncement/MergeTreeReadTaskRequest packet on the initiator. It is widespread: the same !part.empty() failure has appeared on master (pull_request_number = 0) and in dozens of unrelated pull requests every day over the last month (24 occurrences across 20 pull requests on 2026-07-26 alone). There is no open tracking issue for this particular stack — the only matching issue, Logical error '!part.empty()' (STID: 2735-47bf) #112049, was closed as a duplicate of Test 03915_exchange_tables_race regularly fails: race between EXCHANGE TABLES and SELECT causes logical error "Arguments of 'multiply' have incorrect data types" #110133, which is a different bug ("Arguments of multiply have incorrect data types"), so a new issue is needed for the ASTIdentifier assertion.

  2. 02465_limit_trivial_max_rows_to_read — result differs, the last value is 32 instead of 0 (rows read for a trivial LIMIT under parallel replicas). Also a pre-existing flake: it failed the same way in Bump contrib/thrift to Apache Thrift v0.24.0 #111278, Make part metadata rewrite durable to prevent data loss on power loss #111414 and Do not treat an equated INNER JOIN key as an ambiguous identifier #109366 over the last week.

I have merged master into the branch, so the next run will re-check on top of the latest commit.

@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov Thanks - you are right that none of the three can come from this PR (it changes only ten files under tests/queries/0_stateless/, five .sh plus five .reference). Investigated both; item 1 is already fixed in an open PR, item 2 has no owner yet and I am authoring it.

Item 1 - already fixed in #111689, and the !part.empty() name is a report-tool artifact

Fixing PR: #111689 ("Fix unknown-stream LOGICAL_ERROR in parallel replicas with projection short-circuit", Closes #110518). Open, head f494a22, no review submitted yet.

The failure is not an ASTIdentifier assertion. The stack under that row in result_pr.json for 3084113c is:

DB::abortOnFailedAssertion                                     Exception.cpp:60
DB::Exception::handleErrorCode                                 Exception.cpp:109
DB::ParallelReplicasReadingCoordinator::handleRequest           ParallelReplicasReadingCoordinator.cpp:1295
DB::RemoteQueryExecutor::processMergeTreeReadTaskRequest        RemoteQueryExecutor.cpp:870
DB::RemoteQueryExecutor::processPacket                         RemoteQueryExecutor.cpp:713
DB::RemoteQueryExecutor::processParallelReplicaPacketIfAny      RemoteQueryExecutor.cpp:1233
DB::RemoteSource::onAsyncJobReady                              RemoteSource.cpp:152

There is no ASTIdentifier frame. ParallelReplicasReadingCoordinator.cpp:1295 is throw Exception(LOGICAL_ERROR, "Got read request from replica {} for unknown stream {}."). Your description of the packet path (processParallelReplicaPacketIfAny on the initiator, while handling a read-task request) is exactly right; only the assertion attribution is off, because the row was misnamed.

Where the name came from: the Error: block of that row is the echoed query text of test 04367_lambda_arg_backquoted_dot_no_logical_error, whose comments contained the literal string Logical error '!part.empty()' and the sentence about splitting the lambda argument name on '.'. The log checker lifted that wording out of the echoed query and used it as the failure name. Measured across CIDB, that one label pooled 14 distinct STIDs / 157 rows since 2026-07-20, i.e. it was never a single failure:

label / STID rows coordinator frame ASTIdentifier frame real bug
!part.empty() (2735-47bf) 94 0 0 FunctionBinaryArithmetic<MultiplyImpl>::executeImpl2 in 197/197 rows = #110133
!part.empty() (5217-5b3d) 32 32 0 unknown-stream throw = #110518 / #111689 (this PR's row)
!part.empty() (5217-505b) 15 15 0 same unknown-stream family
!part.empty() (2508-3750) 4 0 4 the genuine ASTIdentifier one, AST fuzzer only
10 further STIDs 12 0 0 unrelated

So no new issue is needed for this row, and two things follow:

Your own #111435 already fixed the mislabel at the source, and your master merge here picked it up: b849a6c2 (the #111435 merge, 2026-07-26T22:07:49Z) is not an ancestor of 3084113c but is an ancestor of 32b08ca8. The relabelling is already visible in CIDB - across all rows carrying !part.empty(), 183 before that merge and 1 after, while rows named Got read request from replica A for unknown stream B. went from 50 to 8 for the same STID 5217-5b3d. So on the next run this row should surface under its real message.

The remaining reporter-side half (naming a logical error after query-echoed text in general) is my open #111708.

Your "widespread" characterisation is confirmed. For the real signature over the last 7 days:

check hits distinct PRs master
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) 76 67 3
ten Stress test (*) / AST fuzzer flavours 1 each 1 each 0

Daily 4 to 21 hits, 1 master hit on each of 2026-07-22, 07-26 and 07-27.

Mechanism, for the record: when the aggregate or normal projection short-circuit fires on the initiator with has_parent_parts == false, the optimizer replaces the initiator's ReadFromMergeTree with a prepared NullSource, so initializePipeline never runs and the only empty-stream announce path (ReadFromMergeTree.cpp:4091-4093) is bypassed. The coordinator therefore registers no stream, and a follower's read request hits the throw above. There is an asymmetry that makes it fatal rather than benign: the announce handler drops an unknown stream gracefully, the request handler throws. #111689 extracts that block into announceEmptyReadRangesToCoordinatorIfInitiator() and calls it from all four short-circuit branches; the throw itself is not weakened. Onset traced to #101434.

Server died on the same job is the abort above, not a third failure.

Item 2 - 02465_limit_trivial_max_rows_to_read: no owner, I am taking it

Confirmed: no open issue, no open fixing PR (the only two open PRs mentioning the test are this one and an unrelated PR of mine). Over 30 days CIDB has 4 hits on 4 unrelated PRs (#111968, #109366, #111414, #111278), 0 on master, all four exclusively on Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel).

One correction to the framing: the moved value is a row value, not a rows-read counter. The failing statement is SELECT a FROM t_max_rows_to_read LIMIT 1, and 0 vs 32 is the returned value of column a. In all 4 occurrences the wrong value is exactly 32, never anything else, which is a useful constraint: the table is 100 rows at index_granularity = 4, so 25 marks over 3 replicas puts a work-distribution boundary at mark 8, whose first row is 32. That statement has no ORDER BY, so under parallel replicas any row is a legal answer and whichever replica's segment arrives first wins - the test is asserting an unspecified result, and the always-32 value points at the second replica's first segment rather than at anything random.

I could not reproduce it locally: 145 runs against a 3-replica cluster on a debug build, including the full test file, a multi-part variant, sweeps over max_threads, max_parallel_replicas, parallel_replicas_local_plan, parallel_replicas_mark_segment_size and merge_tree_min_rows_for_concurrent_read, and 60 runs under concurrent load - all returned 0. So the fix will have to be reasoned from the distribution boundary rather than from a local repro, and I will not loosen max_rows_to_read = 20, which is what the test actually measures.

I will send that as its own PR and post the link here. Nothing is needed from you on it.

@groeneai

Copy link
Copy Markdown
Collaborator

Item 2 follow-up, as promised: #112199

I did reproduce it after all, with the exact CI value. It needed an object-storage server rather
than a local disk: on object storage both merge_tree_min_rows_for_concurrent_read_for_remote_filesystem
and its bytes counterpart default to 0, so minMarksForConcurrentRead collapses to
merge_tree_min_read_task_size = 8 marks per task and the second task starts at row 8 * 4 = 32.
On a local disk the same formula yields one task covering the whole part, which is why my earlier
145 local runs could only ever return 0. At the test's own settings the broken statement returned
32 on 1 of 2000 runs, and 7 of 200 with parallel_replicas_local_plan = 0, which the runner
randomizes.

The fix makes the asserted output invariant instead of pinning the reader: the statement projects
a constant, so every legal row selection produces the reference value. max_rows_to_read = 20 and
index_granularity = 4 are untouched, no setting is pinned, and the .reference file does not
change. I verified rather than assumed that the line still measures what it measured: read_rows
and SelectedMarks are identical before and after, the plan still shows
ReadFromRemoteParallelReplicas, and lowering max_rows_to_read to 3, 2 or 1 still raises
TOO_MANY_ROWS at exactly the old thresholds.

One residual is disclosed there and not fixed: the same statement has a second, unrelated failure
mode on the distributed plan variant, reporting current rows 24.00, 25.00 or 100.00. That is
per-replica limit accounting rather than row identity, and all three occurrences over 90 days are
confined to one open pull request that changes exactly that machinery.

@alexey-milovidov

alexey-milovidov commented Jul 28, 2026 •

Copy link
Copy Markdown
Member Author

Merged master again (the branch was 415 commits behind). The two reds on 32b08ca are both unrelated to this pull request, which only deletes ten files under tests/queries/0_stateless/, and both already have open fixes:

# Conflicts:
#	tests/queries/0_stateless/04063_part_loading_tree_rollback_reparent.sh
#	tests/queries/0_stateless/04241_part_loading_tree_rollback_contains.sh
#	tests/queries/0_stateless/04417_part_loading_tree_rollback_evict_reinsert_contains.sh
#	tests/queries/0_stateless/04500_part_loading_tree_rollback_tmp_metadata.sh
#	tests/queries/0_stateless/04624_part_loading_tree_rollback_startup_recovery.sh
@alexey-milovidov

Copy link
Copy Markdown
Member Author

Merged master again (the branch was 891 commits behind). This time the merge conflicted: master kept hardening the same five tests (b07aaf4f9c9, b547d8ce6c5, c9b1848f2a1, da4e1761ac0, fc58ad15543, 47763e4ae7b, a3260085869) and renamed 04595_part_loading_tree_rollback_startup_recovery to 04624_part_loading_tree_rollback_startup_recovery. I resolved every conflict in favour of this pull request's intent, i.e. deleted all five tests including the renamed one, so the diff against master is still exactly ten deleted files under tests/queries/0_stateless/ (800 lines) and git grep part_loading_tree_rollback finds nothing left in the tree.

The single red on 2f5fcfd9cba is unrelated to a test-file deletion: Fast test (arm_darwin) — Server died. The server aborted on an uncaught std::system_error, condition_variable wait failed: Invalid argument, thrown from std::condition_variable::wait inside DB::BackgroundSchedulePool::threadFunction, i.e. the macOS libsystem synchronisation-primitive problem tracked in #111579 (Apple case FB24027930), with the fix in flight in #112267 ("Work around Darwin pthread_rwlock losing wakeups under signals"). It is not specific to this branch: across the last ten days CIDB records this exact Fast test (arm_darwin) / Server died row on dozens of unrelated pull requests (e.g. #112458, #108584, #112200, #111528, #110105, #109710, #112025), several per day.

The only unresolved review thread is the AI Major about losing the rollback coverage, already dispositioned above — the rewrite is being done in #111922, not here.

pull Bot pushed a commit to peijunlin2008/ClickHouse that referenced this pull request Jul 30, 2026
The failure was reported with a CI report link, so record it here as well as in
the pull request description.

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111968&sha=3084113c10b2726a333dc26732034c039ac441ab&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29
Pull request the report belongs to:
ClickHouse#111968

No change to the tree: the fix and its test edit are in the previous commits.
@alexey-milovidov alexey-milovidov self-assigned this Jul 30, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 30, 2026
Merged via the queue into master with commit bd7a198 Jul 30, 2026
178 checks passed
@alexey-milovidov
alexey-milovidov deleted the remove-bad-tests branch July 30, 2026 21:35
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 30, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 7, 2026
Picks up @alexey-milovidov's ClickHouse#111968 (3084113, merged 2026-07-30), which
deleted the five part_loading_tree_rollback stateless tests. Those tests
were never in this branch's base (b361f3f, 2026-07-15); CI injected
them from master when it built refs/pull/111169/merge, and their poisoned
detached-table metadata is what made Stress test (amd_msan) fail server
startup, which in turn got this PR ejected from the merge queue.

The tree produced by this merge contains none of them.
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.

3 participants