kaijchen commented on code in PR #18874:
URL: https://github.com/apache/doris/pull/18874#discussion_r1286556381


##########
be/src/runtime/tablets_channel.cpp:
##########
@@ -388,23 +508,36 @@ Status TabletsChannel::add_batch(const 
PTabletWriterAddBlockRequest& request,
                                  std::function<Status(DeltaWriter * writer)> 
write_func) {
         google::protobuf::RepeatedPtrField<PTabletError>* tablet_errors =
                 response->mutable_tablet_errors();
-        auto tablet_writer_it = _tablet_writers.find(tablet_id);
-        if (tablet_writer_it == _tablet_writers.end()) {
-            return Status::InternalError("unknown tablet to append data, 
tablet={}", tablet_id);
-        }
-        Status st = write_func(tablet_writer_it->second);
-        if (!st.ok()) {
-            auto err_msg =
-                    fmt::format("tablet writer write failed, tablet_id={}, 
txn_id={}, err={}",
-                                tablet_id, _txn_id, st.to_string());
-            LOG(WARNING) << err_msg;
-            PTabletError* error = tablet_errors->Add();
-            error->set_tablet_id(tablet_id);
-            error->set_msg(err_msg);
-            tablet_writer_it->second->cancel_with_status(st);
-            _add_broken_tablet(tablet_id);
-            // continue write to other tablet.
-            // the error will return back to sender.
+        {
+            std::lock_guard<SpinLock> l(_tablet_writers_lock);

Review Comment:
   The scope of this lock may be too large. Changing it in #22703.



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to