Repository navigation
Allow skipping local shard with missing table when skip_unavailable_shards is enabled - #100141
Conversation
…shards` is enabled When a distributed query targets a table that doesn't exist on a local replica and there are no remote replicas to fall back to, the query would always fail with `UNKNOWN_TABLE` even when `skip_unavailable_shards` was enabled. Remote shards with missing tables could be skipped, but local shards could not, which was inconsistent. Now, when `skip_unavailable_shards` is enabled and the table is absent on the local replica with no remote replicas configured, the shard is skipped instead of failing. Closes #100134 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [cbb83a4] Summary: ✅ AI ReviewSummaryThis PR makes ClickHouse Rules
Final Verdict
|
… shards are skipped When `skip_unavailable_shards` causes all shards to be skipped (e.g., the only shard has a missing table with no remote replicas), throw a proper `ALL_CONNECTION_TRIES_FAILED` exception instead of `LOGICAL_ERROR: Pipeline is not initialized`. Update the test to expect this error for the single-shard case. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100141&sha=latest&name_0=PR Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…code path is tested Without this, the test runner's randomized settings can set `prefer_localhost_replica = 0`, causing the shard to be treated as remote and producing `ALL_CONNECTION_TRIES_FAILED` instead of `UNKNOWN_TABLE`. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
…sing-table skip path The new local-missing-table skip path in `SelectStreamFactory::createForShardImpl` was skipping shards without going through `UnavailableShardTracker`, so `max_skip_unavailable_shards_num` and `max_skip_unavailable_shards_ratio` were not enforced for that path. Move the tracker construction ahead of the per-shard loop in `ClusterProxy::executeQuery` and pass it into `SelectStreamFactory::createForShard`, which calls `onShardSkipped` when it drops a local shard with a missing table. The same tracker continues to be moved into `ReadFromRemote` for remote shards, so both skip paths share a single counter. Extend `04050_skip_unavailable_shards_local_missing_table.sql` with a two-shard case over `test_cluster_two_shards` that asserts `TOO_MANY_UNAVAILABLE_SHARDS` when `max_skip_unavailable_shards_num=1` or `max_skip_unavailable_shards_ratio=0.4` are exceeded.
…to fix-skip-local-missing-table
…ter with two `localhost` shards
The two-shard scenarios used `test_cluster_two_shards`, which has shards
on `127.0.0.1` and `127.0.0.2`. ClickHouse intentionally treats
`127.0.0.{2..255}` as non-local (see `isLocalAddress.cpp`) so that those
addresses can be used to emulate distributed queries across localhost.
As a result the second shard was routed through the remote path, the
analyzer on the receiving side failed with `UNKNOWN_TABLE`, and the test
returned `UNKNOWN_TABLE` instead of the expected
`TOO_MANY_UNAVAILABLE_SHARDS`.
Use `test_cluster_two_shards_localhost`, which points both shards at
`localhost` so each shard is detected as local and the new
local-missing-table skip path runs for both.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ing-table # Conflicts: # src/Disks/DiskObjectStorage/DiskObjectStorage.cpp
|
Add an integration test where the local shard does not have the table, but another shard has. Check that skipping the local shard is done correctly, and we will read from the remote shard. |
…e shard Covers the scenario from the review on #100141: a two-shard cluster where the local shard has no underlying table and the remote shard has the table populated. With `skip_unavailable_shards = 1` and `prefer_localhost_replica = 1`, the local shard is skipped and the query reads from the remote shard. Without the setting, the local shard fails with `UNKNOWN_TABLE`. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: 96.15% (50/52) · Uncovered code |
The upgrade test in CI installs a previous release binary, runs the test suite, then upgrades to the new server build and restarts. Tables created on the old binary with columns like `Nullable(Tuple(`null` UInt32))` fail to attach on the new binary because PR ClickHouse#98377 forbade Tuple element name `null` to avoid ambiguity with the Nullable null-map subcolumn name. This is a known consequence of the backward-incompatible change, not a regression introduced by any in-flight PR. Add the exact reserved-name phrase to the upgrade-runner error filter so unrelated PRs no longer fail the upgrade check on this message. Observed on PR ClickHouse#100141: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=100141&sha=ca91e01ef6f3c799bddb2176485608a8c9eaf151&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
When a distributed query targets a table that doesn't exist on a local replica and there are no remote replicas to fall back to, the query would always fail with
UNKNOWN_TABLEeven whenskip_unavailable_shardswas enabled. Remote shards with missing tables could be skipped, but local shards could not, which was inconsistent.Now, when
skip_unavailable_shardsis enabled and the table is absent on the local replica with no remote replicas configured, the shard is skipped instead of failing.Closes #100134
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Allow skipping local shard with missing table when
skip_unavailable_shardsis enabled.Version info
26.5.1.344