sollhui commented on code in PR #52472:
URL: https://github.com/apache/doris/pull/52472#discussion_r2182017216
##########
be/src/vec/sink/writer/vtablet_writer_v2.cpp:
##########
@@ -732,27 +737,154 @@ std::unordered_set<std::shared_ptr<LoadStreamStub>>
VTabletWriterV2::_non_increm
}
Status VTabletWriterV2::_close_wait(
- std::unordered_set<std::shared_ptr<LoadStreamStub>>
unfinished_streams) {
+ std::unordered_set<std::shared_ptr<LoadStreamStub>> unfinished_streams,
+ bool need_wait_after_quorum_success) {
SCOPED_TIMER(_close_load_timer);
Status status;
auto streams_for_node = _load_stream_map->get_streams_for_node();
+ // 1. first wait for quorum success
while (true) {
RETURN_IF_ERROR(_check_timeout());
RETURN_IF_ERROR(_check_streams_finish(unfinished_streams, status,
streams_for_node));
- if (!status.ok() || unfinished_streams.empty()) {
- LOG(INFO) << "is all unfinished: " << unfinished_streams.empty()
- << ", status: " << status << ", txn_id: " << _txn_id
- << ", load_id: " << print_id(_load_id);
+ bool quorum_success = _quorum_success(unfinished_streams);
+ if (quorum_success || unfinished_streams.empty()) {
+ LOG(INFO) << "quorum success, quorum_success: " << quorum_success
+ << ", is all unfinished: " << unfinished_streams.empty()
+ << ", txn_id: " << _txn_id << ", load_id: " <<
print_id(_load_id);
break;
}
bthread_usleep(1000 * 10);
}
+
+ // 2. then wait for remaining streams as much as possible
+ if (!unfinished_streams.empty() && need_wait_after_quorum_success) {
+ int64_t max_wait_time_ms = _calc_max_wait_time_ms(streams_for_node,
unfinished_streams);
+ while (true) {
+ RETURN_IF_ERROR(_check_timeout());
Review Comment:
We can't ensure max_wait_time_ms won't cause timeout, so another config was
support `quorum_success_load_timeout_remaining_seconds` which mean load will
return if load timeout remains 30s.
--
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]