branch-4.0: [fix](load) fix quorum success invalid in move-memtable-on-sink load path #60681#60820
Merged
yiguolei merged 1 commit intobranch-4.0from Feb 26, 2026
Merged
Conversation
…path (#60681) ## Description In `VTabletWriterV2`, the `_quorum_success()` function always returns `false` even when all streams have finished successfully, making the quorum success write feature effectively non-functional. ## Root Cause In both `_build_tablet_node_mapping()` and `_incremental_open_streams()`, `_tablets_by_node[node].emplace(tablet_id)` is guarded by the `known_indexes` check: ```cpp if (known_indexes.contains(index.index_id)) [[likely]] { continue; } _indexes_from_node[node].emplace_back(tablet); _tablets_by_node[node].emplace(tablet_id); known_indexes.insert(index.index_id); ``` The known_indexes set is shared across all partitions, tablets, and nodes. Once an index_id is inserted after processing the first tablet's first node, all subsequent tablets (and all other nodes of the same tablet) with the same index_id skip the _tablets_by_node update. For example, with 1 index, 3 tablets [T1, T2, T3], and 3 replicas [N1, N2, N3]: Only _tablets_by_node[N1] = {T1} gets populated T1 on N2/N3, and T2/T3 on all nodes are skipped This causes _quorum_success() to compute finished_tablets_replica incorrectly: finished_tablets_replica[T1] = 1 (only counted from N1) finished_tablets_replica[T2] = 0, finished_tablets_replica[T3] = 0 With a quorum requirement of 2 (for 3 replicas), the check always fails. The known_indexes optimization was intended only for _indexes_from_node (to avoid sending duplicate schema info per index), but it incorrectly also blocked the _tablets_by_node population. Note: vtablet_writer.cpp does NOT have this issue — its _tablets_by_channel is populated without the known_indexes guard. ## Fix Move _tablets_by_node[node].emplace(tablet_id) before the known_indexes check in both _build_tablet_node_mapping() and _incremental_open_streams(), so that every tablet on every node is correctly recorded.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
|
run buildall |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
yiguolei
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #60681