Skip to content

Split flaky and targeted checks: thread fuzzer for new tests, per-worker lock for targeted - #102038

Closed
fm4v wants to merge 3 commits into
masterfrom
nik/flaky-check-improvements
Closed

fm4v wants to merge 3 commits into
masterfrom
nik/flaky-check-improvements

Conversation

@fm4v

@fm4v fm4v commented Apr 8, 2026 •

Copy link
Copy Markdown
Member

Split the flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR, with thread fuzzer enabled and parallel-with-self (shared queue). Ensures new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests, with per-worker partitioning (same test assigned to same worker, no self-overlap) and no thread fuzzer.

Add stateless test configs to flaky check jobs so tests run under the same environment as the main CI pipeline:

  • amd_tsan: s3 storage
  • amd_debug: DatabaseReplicated

Restore original thread fuzzer parameters that were reduced in commits 06c945a and 9790435.

Add --no-self-parallel flag to clickhouse-test to disable per-worker partitioning in --flaky-check mode.

PRs with failed flaky check due to tests running in parallel with themselves: CIDB query

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f4177d3]


AI Review

Summary

This PR restructures flaky/targeted CI test jobs, adds --no-self-parallel to clickhouse-test, restores stronger thread-fuzzer settings, and adjusts targeted workflows. High-level verdict: there is one blocker in tests/clickhouse-test where worker shedding can silently skip pending tests in per-worker-queue mode, causing partial flaky/targeted runs to report success.

Missing context
  • ⚠️ No fresh CI run logs/results were provided in this review context to confirm whether this behavior is already manifested on this PR.
Findings

❌ Blockers

  • [tests/clickhouse-test:4513-4529, 3985-3996] In --no-self-parallel mode each worker owns a private queue, but memory-pressure shedding still tells a worker to exit before taking the next test. Remaining tests in that worker queue are never redistributed, so the job can finish green after running only a subset.
    Suggested fix: when args.no_self_parallel is enabled, either disable shedding, or requeue the worker’s remaining tests to a shared queue before exit, or mark the run as SKIPPED/ERROR when shedding occurs.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ⚠️ --no-self-parallel + shedding can silently reduce executed test set.
Compilation time ✅
No large/binary files ✅
Performance & Safety

The concern is reliability/safety of CI signal rather than runtime performance: under memory pressure the new queueing mode may under-execute planned test iterations without surfacing partial execution.

Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Prevent silent test loss in --no-self-parallel mode when worker shedding is triggered (disable shedding there, requeue pending tests, or fail/skip explicitly).

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 8, 2026
Comment thread ci/jobs/functional_tests.py Outdated
if is_flaky_check:
# Hard 45-minute wall-clock limit for the test runner.
FLAKY_CHECK_TIME_LIMIT = 45 * 60 # 45 min
FLAKY_CHECK_TIME_LIMIT = 35 * 60 # 35 min

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 comment and constant disagree: the comment still says 45-minute, but FLAKY_CHECK_TIME_LIMIT is now 35 * 60.

Please update the comment text here (and the matching earlier comment near --max-failures) to 35-minute so maintainers are not misled when tuning flaky-check behavior.

@fm4v fm4v changed the title Improve flaky check: remove thread fuzzer for ASan, add stateless configs, fix targeted stale tests Improve flaky check: remove thread fuzzer, add stateless configs, fix targeted stale tests Apr 8, 2026
fm4v added a commit that referenced this pull request Apr 9, 2026
During flaky check (--test-runs), the test queue contains multiple copies
of each test. Multiple worker processes pop from a shared queue and nothing
prevented two workers from running the same test simultaneously, causing
failures when tests use shared resources (tables with fixed names, etc.).

Add a shared dict + lock to track currently-running tests. When a worker
pops a test that is already running on another worker, it puts the test
back at the end of the queue and tries the next one. A sleep prevents
tight spinning when all remaining tests are locked.

#102038
fm4v added a commit that referenced this pull request Apr 9, 2026
During flaky check (--test-runs), the test queue contains multiple copies
of each test. Previously all workers shared a single queue, so two workers
could run the same test simultaneously, causing failures when tests use
shared resources (tables with fixed names, files, etc.).

Partition tests by name hash so that all copies of the same test are
assigned to the same worker. Within a worker, tests run sequentially,
so the same test never overlaps with itself.

#102038
Comment thread tests/clickhouse-test Resolved
@alexey-milovidov
alexey-milovidov marked this pull request as draft April 9, 2026 06:31
@alexey-milovidov

Copy link
Copy Markdown
Member

The Fast test (arm_darwin) failure is unrelated to this PR — the fix is in #102184.

fm4v added a commit that referenced this pull request Apr 10, 2026
Flaky check now runs in two phases:

1. Targeted tests (previously failed + relevant) — no thread fuzzer,
   per-worker partitioning so the same test never runs concurrently.
2. Changed/new tests — with thread fuzzer, shared queue allowing the
   same test to run in parallel with itself (ensures new tests are
   parallel-safe).

Server is restarted between the two runs to enable thread fuzzer env
vars for the second phase.

Add --no-self-parallel flag to clickhouse-test that disables per-worker
partitioning in --flaky-check mode.

Add ClickHouseProc.restart method for stopping and restarting server
process(es) without affecting minio/kafka.

Also pick up master changes: nproc-1 workers, 45-min time limit,
separate targeted check job flow.

#102038
Comment thread tests/clickhouse-test Resolved
Comment thread ci/jobs/scripts/clickhouse_proc.py Resolved
@fm4v fm4v changed the title Improve flaky check: remove thread fuzzer, add stateless configs, fix targeted stale tests Split flaky and targeted checks: thread fuzzer for new tests, per-worker lock for targeted Apr 10, 2026
Comment thread ci/jobs/functional_tests.py Resolved
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests run in parallel with themselves (shared queue)
to ensure new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker queues,
  50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters (reverts reductions from
  06c945a and 9790435)
- Add amd_binary to flaky check, use AMD_LARGE for targeted debug
- Targeted check uses --flaky-check --no-self-parallel

PRs affected by tests running in parallel with themselves:
#102015 #101093 #99653 #101503 #101108 #101884 #100746
#101447 #100941 #101099 #100203 #96130

#102038
@fm4v
fm4v force-pushed the nik/flaky-check-improvements branch from 15c903f to c181b29 Compare April 14, 2026 10:32
@fm4v

fm4v commented Apr 14, 2026 •

Copy link
Copy Markdown
Member Author

Broken sync PR. new PR #102659

@fm4v fm4v closed this Apr 14, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests run in parallel with themselves (shared queue)
to ensure new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker queues,
  50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters (reverts reductions from
  06c945a and 9790435)
- Add amd_binary to flaky check, use AMD_LARGE for targeted debug
- Targeted check uses --flaky-check --no-self-parallel

PRs affected by tests running in parallel with themselves:
ClickHouse#102015 ClickHouse#101093 ClickHouse#99653 ClickHouse#101503 ClickHouse#101108 ClickHouse#101884 ClickHouse#100746
ClickHouse#101447 ClickHouse#100941 ClickHouse#101099 ClickHouse#100203 ClickHouse#96130

ClickHouse#102038
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants