Skip to content

clickhouse-test: reset enabled failpoints after no-parallel tests - #105942

Open
Diskein wants to merge 1 commit into
masterfrom
dk-ci-tests-cleanup-failpoints
Open

Diskein wants to merge 1 commit into
masterfrom
dk-ci-tests-cleanup-failpoints

Conversation

@Diskein

@Diskein Diskein commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Failpoints are server-wide and persist across tests. A test that enables a REGULAR failpoint and then errors before reaching its SYSTEM DISABLE FAILPOINT leaks state into every test that follows. For example, when a test enables smt_dont_merge_first_part and fails mid-test, every subsequent test running OPTIMIZE will see its parts spuriously marked as "already assigned to some background operation" because SharedMergeTreePartsCollector unconditionally inserts all_0_0_0 into the already_processing_parts_on_this_replica set when that failpoint is on.

After each no-parallel/sequential test, query system.fail_points for enabled entries and disable them. Skipped for parallel tests because failpoints cannot be used in parallel jobs.

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):

...

Failpoints are server-wide and persist across tests. A test that enables
a REGULAR failpoint and then errors before reaching its
`SYSTEM DISABLE FAILPOINT` leaks state into every test that follows. For
example, when a test enables `smt_dont_merge_first_part` and fails
mid-test, every subsequent test running OPTIMIZE will see its parts
spuriously marked as "already assigned to some background operation"
because `SharedMergeTreePartsCollector` unconditionally inserts
`all_0_0_0` into the `already_processing_parts_on_this_replica` set when
that failpoint is on.

After each no-parallel/sequential test, query `system.fail_points` for
enabled entries and disable them. Skipped for parallel tests because
another in-flight test on the same server may legitimately be using a
failpoint.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [726dbd7]

Summary: ✅


AI Review

Summary

This PR adds failpoint cleanup between no-parallel/sequential clickhouse-test cases to prevent leaked server-wide failpoints from contaminating later tests. The direction is correct, but one exception-handling path currently defeats the safeguard in transient failure scenarios.

Findings

⚠️ Majors

  • [tests/clickhouse-test:3738] _cleanup_failpoints catches Exception during failpoint enumeration (and again while disabling each failpoint), so ConnectionError/http.client.ImproperConnectionState never reaches _cleanup's liveness-aware handler. If the server is alive but cleanup hits a transient connection-state error, leaked failpoints remain enabled and can still poison following no-parallel tests.
    Suggested fix: let connection-state exceptions propagate from _cleanup_failpoints and keep the existing liveness check in _cleanup to decide whether to fail the current test or tolerate a dead server.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
  1. Do not swallow ConnectionError/http.client.ImproperConnectionState in _cleanup_failpoints; propagate them so failpoint-cleanup failures are not silently ignored while the server is alive.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label May 27, 2026
@Diskein
Diskein marked this pull request as ready for review May 27, 2026 13:03
Comment thread tests/clickhouse-test
"log_comment": f'{args.testcase_basename}-{args.testcase_database}',
},
).decode().split()
except Exception as e:

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.

_cleanup already tries to escalate connection failures from _cleanup_failpoints when the server is still alive, but this except Exception swallows those failures first, so that path is never reached.

Impact: a transient ConnectionError/ImproperConnectionState during failpoint enumeration is silently ignored, leaked failpoints stay enabled, and the next no-parallel test can still fail due to cross-test state contamination.

Please let connection-state exceptions propagate here (and keep the liveness check in _cleanup) so leaked failpoints are not silently ignored.

@hanfei1991 hanfei1991 self-assigned this Jun 1, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Jun 11, 2026
…lpoints count)

system.fail_points reflects process-global state, so the assertion

    SELECT count() FROM system.fail_points WHERE enabled = 1;  -- Expected: 0

is not a property of this test alone: any other test on the shared server
that leaves a failpoint enabled inflates the count. The test is no-parallel,
but that only prevents concurrent interference, not leftovers from the
parallel phase that runs before the sequential phase. Several parallel-phase
tests enable parallel_replicas_wait_for_unused_replicas (a REGULAR failpoint)
without disabling it (e.g. 04028_pr_move_global_in_to_prewhere,
03787_pr_group_by_read_mode_error, 04009_pr_aggr_in_order_coordination_mode,
04024_pr_read_in_order_through_join, 03810_pr_aggr_in_order_read_mode), so the
count was observed as 1/2/5 across CI runs (Fast test, 8 unrelated PRs in 30d).

Scope the count to the failpoints this test actually manipulates, which it
guarantees are disabled at that point. The reference stays 0 and the test
still verifies that its own failpoints start disabled, while no longer
depending on unrelated tests' global state.

Per review, the test now manipulates only failpoints used exclusively in
integration tests, so a public stateless run cannot leave any of them enabled
and thus cannot make this test fail before the failpoint under test fires:

- replicated_merge_tree_insert_retry_pause (only test_quorum_inserts)
- finish_set_quorum_failed_parts (PAUSEABLE_ONCE, only test_quorum_inserts)
- receive_timeout_on_table_status_response (ONCE, only
  test_parallel_replicas_failover)

Every failpoint the test enables is explicitly disabled after use, so no
non-ONCE state leaks out of the test.

The test is named 03916_system_fault_injection_points to reflect that it tests
system.fail_points. The style check forbids the substring "fail" in stateless
test file names, so "fault injection points" (what failpoints are) is used
instead.

Regression coverage for ClickHouse#103403
(querying system.fail_points must not consume ONCE / PAUSEABLE_ONCE points).
Complementary to ClickHouse#105942, which resets failpoints after no-parallel tests but
deliberately skips the parallel phase where these leaks originate.

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

clickhouse-gh Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Dear @hanfei1991, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@abashkeev abashkeev added the comp-testing Test content only (no production code). label Sep 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-testing Test content only (no production code). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants