github-actions[bot] commented on code in PR #68628:
URL: https://github.com/apache/doris/pull/68628#discussion_r4135222463
##########
be/src/load/channel/tablets_channel.cpp:
##########
@@ -338,13 +341,26 @@ std::unique_ptr<BaseDeltaWriter>
TabletsChannel::create_delta_writer(const Write
_profile, _load_id);
}
+void
BaseTabletsChannel::_notify_all_senders_closed(std::unique_lock<std::mutex>&
lock) {
+ DCHECK_EQ(_num_remaining_senders, 0);
+ // All senders have reached EOS, so no sender can incrementally open
another
+ // channel. Preserve the old barrier: earlier RPCs may return before this
+ // final sender finishes flushing/committing, and incremental channels can
+ // close in parallel. Mark finished before unlocking so duplicate EOS and
+ // cancellation cannot start another close or cancel the writers here.
+ _state = kFinished;
+ lock.unlock();
Review Comment:
[P1] Prevent block-bearing EOS retries from writing during final close.
After this unlock, _state is already kFinished but the writers have not reached
close(). A retried EOS carrying a block still enters add_batch first;
_get_current_seq returns the default OK close status without setting cur_seq,
so the packet check cannot deduplicate it, and MemTableWriter can append the
rows again before _is_closed is set. This can commit duplicate rows in both
local and cloud mode. Keep the arrival callback outside the lock, but make the
closing state reject or serialize data-bearing retries until the writer is
closed; add a retry-with-block test.
##########
be/src/cloud/cloud_tablets_channel.cpp:
##########
@@ -196,7 +197,8 @@ Status CloudTabletsChannel::close(LoadChannel* parent,
const PTabletWriterAddBlo
auto* tablet_errors = res->mutable_tablet_errors();
auto* tablet_vec = res->mutable_tablet_vec();
- _state = kFinished;
+ _notify_all_senders_closed(l);
Review Comment:
[P1] Preserve the final cloud close result for duplicate EOS. This publishes
kFinished and releases _lock before commit_rowset sets _close_status. A retried
EOS in that window returns the default OK status with an empty tablet_vec; if
the original commit then fails, the retry has already told VNodeChannel that
its last RPC succeeded without any tablet commit information. Previously the
duplicate waited under _lock and observed the commit failure. Keep duplicate
close requests pending for the final result while releasing the arrival waiters
separately.
--
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]