Skip to content

chore(weave): add replicated CH backends to nightly tests#7000

Draft
gtarpenning wants to merge 10 commits into
gtarpenning/wb-34908-files-chunked-read-racefrom
gtarpenning/add-replicated-ch-nightly-stacked
Draft

chore(weave): add replicated CH backends to nightly tests#7000
gtarpenning wants to merge 10 commits into
gtarpenning/wb-34908-files-chunked-read-racefrom
gtarpenning/add-replicated-ch-nightly-stacked

Conversation

@gtarpenning
Copy link
Copy Markdown
Member

@gtarpenning gtarpenning commented May 28, 2026

WB-34904

Summary

  • Adds two new replicated nightly test jobs: 1s3r (1 shard, 3 replicas) and 2s2r (2 shards, 2 replicas + Distributed). Mirrors prod and next-gen weave-trace topology.
  • Topology defined via docker-compose (tests/trace_server/conftest_lib/topologies/{1s3r,2s2r}.yaml) with embedded Keeper.
  • pytest_collection_modifyitems skip hook in tests/trace/conftest.py for the 4 deferred distributed-mode known failures (globalIn, cost JOIN cross-shard, DELETE on Distributed for feedback, OPTIMIZE on Distributed for storage-size).
  • Test-only overrides (test_overrides.xml), ON CLUSTER truncate/drop in fixtures, load_balancing=in_order, distributed-aware OPTIMIZE.

Testing

smoke 26596965141 - all 24 replicated trace legs (3.10-3.13 x 1s3r/2s2r) pass.

Copy link
Copy Markdown
Member Author

gtarpenning commented May 28, 2026

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gtarpenning gtarpenning force-pushed the gtarpenning/wb-34908-files-chunked-read-race branch from 1b11270 to c980d45 Compare May 28, 2026 21:07
@gtarpenning gtarpenning force-pushed the gtarpenning/add-replicated-ch-nightly-stacked branch from 751af18 to 83ef92d Compare May 28, 2026 21:07
gtarpenning and others added 10 commits May 28, 2026 14:24
Adds two parallel matrix jobs that exercise the replicated CH path:
- nightly-tests-replicated-1s3r (1 shard x 3 replicas, ReplicatedMergeTree)
- nightly-tests-replicated-2s2r (2 shards x 2 replicas + Distributed tables)

Both reuse the existing topology compose files under
tests/trace_server/conftest_lib/topologies/ that test.yaml already drives
for migrator coverage, and surface failures via slack-notification.

Timeouts bumped to 90/120 min vs the baseline 30 min since replicated
writes go through Keeper and Distributed adds an extra query hop.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The session-scoped ClickHouse fixture's patched migration runner was
constructing the migrator without the replicated/distributed kwargs,
so it ran in cloud mode while the application code in the same process
read WF_CLICKHOUSE_REPLICATED=true from env. Split-brain produced
UNKNOWN_DATABASE on ch-s1-r3 (1s3r) and missing _local-suffix tables
(2s2r) once the nightly started exercising replicated topologies.

Mirror the production wiring in clickhouse_trace_server_batched.py:6900.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
TRUNCATE and DROP DATABASE against a single replica don't propagate;
peer replicas keep stale state and the next test sees UNKNOWN_TABLE /
UNKNOWN_DATABASE on a different node. Append ON CLUSTER (gated by
WF_CLICKHOUSE_REPLICATED) and SYNC so the next test starts clean across
the cluster. Also filter Distributed-engine tables out of the truncate
list — TRUNCATE on a Distributed wrapper fails; the underlying _local
ReplicatedMergeTree carries the data.

No-op in cloud mode: _on_cluster_clause() returns "" so single-node SQL
is byte-identical.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OPTIMIZE is unsupported on Distributed engines. In 2s2r CI, both inline
and `force_merge_calls`-driven OPTIMIZE calls hit the Distributed
wrapper and failed with Code: 48 NOT_IMPLEMENTED, cascading into ~64
teardown failures through the autouse logging_error_check fixture.

Add a shared `force_optimize_calls_merged(ch_client)` helper that
targets `calls_merged_local ON CLUSTER` when distributed, else the base
table. Use it from both the inline call site and `force_merge_calls`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ClickHouse's default async Distributed INSERT (buffer locally, forward
later) breaks read-after-write in the test suite — writes return before
the destination shard sees the row, and immediate SELECTs against the
Distributed wrapper get 0 rows. Production users tolerate that latency;
the test suite cannot.

Server-side fix: mount a users.d override on every 2s2r CH node that
flips distributed_foreground_insert=1 on the default profile. Applies
to every connection from every test thread; never reaches production
deployments. 1s3r has no Distributed tables and is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ancing=in_order

ReplicatedMergeTree replicates between same-shard replicas asynchronously.
With distributed_foreground_insert=1, the write to call_parts_local lands
synchronously on one replica and the MV's downstream insert into
calls_merged_local lands on that same replica. A read against the
Distributed wrapper picks a replica per shard via load_balancing; with
the default `random`, the next SELECT can hit a replica that hasn't
replicated the row yet -> stale read.

`load_balancing=in_order` always routes to the first healthy replica per
shard, so test reads consistently hit the replica that received the most
recent write. Production keeps the default for load spreading; tests
trade that for determinism.

This file is mounted only by the test compose topologies. Production
servers don't pick it up.
Smoke 26585979011 closed out the bulk of distributed-mode failures
(174 down to 16) once the annotation_queues / distributed_product_mode
fixes landed. The remaining tests hit four distinct prod bugs that
each need their own RCA + fix in follow-up PRs:

- globalIn rewrite (CH 25.11 + distributed_product_mode=global)
- llm_token_prices rand-sharded -> cost JOIN misses
- DELETE on Distributed engine (feedback, llm_token_prices purge)
- OPTIMIZE TABLE on Distributed engine (storage-size tests)

Wires a small `pytest_collection_modifyitems` in trace/conftest.py
keyed off `WF_CLICKHOUSE_USE_DISTRIBUTED_TABLES`. Tests pass on cloud
and 1s3r unchanged; skipped only under multi-shard distributed.
Reasons are recorded in the table so each entry maps to a follow-up.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gtarpenning gtarpenning changed the title ci(weave): add replicated CH backends to nightly tests chore(weave): add replicated CH backends to nightly tests May 28, 2026
@gtarpenning gtarpenning force-pushed the gtarpenning/wb-34908-files-chunked-read-race branch from c980d45 to 6a9ed19 Compare May 28, 2026 21:25
@gtarpenning gtarpenning force-pushed the gtarpenning/add-replicated-ch-nightly-stacked branch from 83ef92d to 37a50ca Compare May 28, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant