github-actions[bot] commented on code in PR #62661:
URL: https://github.com/apache/doris/pull/62661#discussion_r3371318449
##########
be/src/cloud/cloud_tablets_channel.cpp:
##########
@@ -60,6 +60,21 @@ Status CloudTabletsChannel::add_batch(const
PTabletWriterAddBlockRequest& reques
return Status::OK();
}
+ if (request.is_receiver_side_random_bucket()) {
+ std::unordered_map<int64_t, DorisVector<uint32_t>>
partition_to_rowidxs;
+ _build_partition_to_rowidxs_for_receiver_side_random_bucket(request,
&partition_to_rowidxs);
+ if (!partition_to_rowidxs.empty()) {
+ std::unordered_set<int64_t> partition_ids;
+ partition_ids.reserve(partition_to_rowidxs.size());
+ for (const auto& [partition_id, _] : partition_to_rowidxs) {
+ partition_ids.insert(partition_id);
+ }
+ RETURN_IF_ERROR(_init_writers_by_partition_ids(partition_ids));
Review Comment:
This new receiver-side path calls `_init_writers_by_partition_ids()` without
holding `_tablet_writers_lock`, but `add_batch()` can run concurrently with
`incremental_open()` (the existing tablet-routed path takes the lock before
walking `_tablet_writers` for exactly that reason). In an
auto-partition/replace-partition load, one sender can be incremental-opening
new tablet writers while another sender reaches this branch and
`_init_writers_by_partition_ids()` iterates `_tablet_writers`; that is an
unsynchronized `unordered_map` traversal concurrent with insertion and can
invalidate the iteration or miss writers before
`CloudDeltaWriter::batch_init()`. Please take `_tablet_writers_lock` around
this initialization path, matching the non-random cloud path below, before
iterating or initializing writers by partition.
--
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]