sollhui opened a new pull request, #60681:
URL: https://github.com/apache/doris/pull/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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]