Repository navigation
Support parallel replicas read for Alias engine - #107830
Conversation
|
Workflow [PR], commit [4e77c38] Summary: ❌
AI ReviewSummaryThis PR makes Findings❌ Blockers
Tests
Final VerdictStatus: ❌ Block Minimum required actions: contain the global |
|
|
||
| std::optional<CheckResult> StorageAlias::checkDataNext(DataValidationTasksPtr & check_task_list) | ||
| { | ||
| auto & tasks = dynamic_cast<AliasCheckTasks &>(*check_task_list); |
There was a problem hiding this comment.
Let's replace it with assert_cast, like in the StorageLog:
std::optional<CheckResult> StorageLog::checkDataNext(DataValidationTasksPtr & check_task_list)
{
return file_checker.checkNextEntry(assert_cast<DataValidationTasks *>(check_task_list.get())->file_checker_tasks);
}
| { | ||
| } | ||
|
|
||
| size_t size() const override { return inner->size(); } |
|
|
||
| std::string getName() const override { return "Alias"; } | ||
|
|
||
| bool isMergeTree() const override |
There was a problem hiding this comment.
isMergeTree is used by more than the SELECT parallel-replica planner. With parallel_distributed_insert_select = 2 (the default), InterpreterInsertQuery::distributedWriteIntoReplicatedMergeTreeOrDataLakeFromClusterStorage now treats INSERT INTO alias SELECT ... FROM cluster(...) as a replicated MergeTree destination and serializes the original INSERT INTO alias to every remote node. That changes existing Alias write semantics: if the alias exists only on the initiator, the query now fails remotely; if remote aliases point to different targets, rows go into different tables. Please avoid advertising Alias as MergeTree globally, or explicitly exclude/rewrite Alias in that distributed insert-select path so this PR only enables parallel-replica reads.
There was a problem hiding this comment.
isMergeTreeis used by more than theSELECTparallel-replica planner. Withparallel_distributed_insert_select = 2(the default),InterpreterInsertQuery::distributedWriteIntoReplicatedMergeTreeOrDataLakeFromClusterStoragenow treatsINSERT INTO alias SELECT ... FROM cluster(...)as a replicatedMergeTreedestination and serializes the originalINSERT INTO aliasto every remote node. That changes existingAliaswrite semantics: if the alias exists only on the initiator, the query now fails remotely; if remote aliases point to different targets, rows go into different tables. Please avoid advertisingAliasasMergeTreeglobally, or explicitly exclude/rewriteAliasin that distributed insert-select path so this PR only enables parallel-replica reads.
Alias behaves like a MaterializedVIEW , it is the user's responsibility to ensure the alias is created consistently on all nodes. In practice, when using a Replicated database , DDL including CREATE TABLE xx ENGINE = Alias(yy) is replicated automatically, so all nodes see the same alias pointing to the same target.
There was a problem hiding this comment.
I agree, the comment doesn't make sense
fa25b2e to
21ec518
Compare
This behavioral change is acceptable. When the target table is MergeTree, Alias ought to support |
a0917fd to
f6e5edd
Compare
| " AND type = 'QueryFinish' " | ||
| "ORDER BY query_start_time DESC LIMIT 1" | ||
| ) | ||
| assert int(used_count.strip()) > 0, ( |
There was a problem hiding this comment.
This assertion no longer proves the behavior the test name promises. ParallelReplicasUsedCount is the number of replicas that received read assignments, so 1 satisfies > 0 even when the query used only one replica; then a regression that enables the coordinator for Alias but never actually distributes work to a second replica would pass. In this two-replica cluster please make the execution deterministic, for example by disabling parallel_replicas_local_plan and keeping enough marks/segments, and assert >= 2, or otherwise verify that both replicas participated.
There was a problem hiding this comment.
The test's purpose is to verify that the Alias engine supports parallel replicas, ParallelReplicasUsedCount > 0 enough to proves and this also consistent with many existing tests in the codebase .
f6e5edd to
4e77c38
Compare
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 12/15 (80.00%) | Lost baseline coverage: none · Uncovered code |
|
@groeneai Are the failed tests related to this PR? |
|
@nauu No, none of the failures are caused by this PR. This PR only adds 1. Stateless tests (arm_binary, parallel) — 2. Stress test (arm_tsan) — 3 & 4. Stress test (arm_msan) and (arm_ubsan) — both 5. AST fuzzer (arm_asan_ubsan) — 6. BuzzHouse (amd_tsan) — Mergeable Check and PR are aggregate roll-ups; they are red only because the children above are red, not independent failures. Recommendation: rerun the 6 failed jobs (they should pass) or treat them as flaky. None of them blocks on this PR. |
c2ac697
|
Hi @nauu @scanhex12 — a couple of suggestions to make this PR easier for reviewers and the changelog reader. Description (currently
Ignore this if the current title/body is intentional. |
Support parallel replicas read for Alias engine
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Aliasengine now supports parallel replicas read when the target table is aMergeTreefamily engine.As a consequence of the
isMergeTreeproxy,getCheckTaskListandcheckDataNextare also proxied to the target, soCHECK TABLEandCHECK DATABASEwork correctly onAliastables.Version info
26.7.1.22