Skip to content

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
auto-pick-60681-branch-4.0
Feb 26, 2026
Merged

branch-4.0: [fix](load) fix quorum success invalid in move-memtable-on-sink load path #60681#60820
yiguolei merged 1 commit intobranch-4.0from
auto-pick-60681-branch-4.0

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #60681

…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.
@github-actions github-actions bot requested a review from yiguolei as a code owner February 25, 2026 03:12
@Thearas
Copy link
Contributor

Thearas commented Feb 25, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Feb 25, 2026
@Thearas
Copy link
Contributor

Thearas commented Feb 25, 2026

run buildall

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 33.33% (1/3) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.99% (19126/36095)
Line Coverage 36.17% (178096/492356)
Region Coverage 32.76% (137941/421014)
Branch Coverage 33.73% (59894/177590)

@yiguolei yiguolei merged commit 3541a6d into branch-4.0 Feb 26, 2026
26 of 29 checks passed
@github-actions github-actions bot deleted the auto-pick-60681-branch-4.0 branch February 26, 2026 10:18
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.

5 participants