You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/07 22:45:33 UTC

[incubator-doris] branch master updated: [Bug] Missing error tablet list when close_wait return error (#9418)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7234c964ae [Bug] Missing error tablet list when close_wait return error (#9418)
7234c964ae is described below

commit 7234c964aedebdef0bbf5f1894d349e8dd123a63
Author: pengxiangyu <di...@163.com>
AuthorDate: Sun May 8 06:45:28 2022 +0800

    [Bug] Missing error tablet list when close_wait return error (#9418)
---
 be/src/olap/delta_writer.cpp       |  9 ++++++++-
 be/src/olap/delta_writer.h         |  4 +++-
 be/src/runtime/load_channel.h      |  3 ++-
 be/src/runtime/tablets_channel.cpp | 10 ++++++----
 be/src/runtime/tablets_channel.h   |  5 +++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index 1890efd0e9..2a6f597642 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -311,6 +311,7 @@ Status DeltaWriter::close() {
 }
 
 Status DeltaWriter::close_wait(google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec,
+                               google::protobuf::RepeatedPtrField<PTabletError>* tablet_errors,
                                bool is_broken) {
     std::lock_guard<std::mutex> l(_lock);
     DCHECK(_is_init)
@@ -321,7 +322,13 @@ Status DeltaWriter::close_wait(google::protobuf::RepeatedPtrField<PTabletInfo>*
     }
 
     // return error if previous flush failed
-    RETURN_NOT_OK(_flush_token->wait());
+    Status s = _flush_token->wait();
+    if (!s.ok()) {
+        PTabletError* tablet_error = tablet_errors->Add();
+        tablet_error->set_tablet_id(_tablet->tablet_id());
+        tablet_error->set_msg(s.get_error_msg());
+        return s;
+    }
 
     // use rowset meta manager to save meta
     _cur_rowset = _rowset_writer->build();
diff --git a/be/src/olap/delta_writer.h b/be/src/olap/delta_writer.h
index 6e4ef8fdb6..210c4b3eec 100644
--- a/be/src/olap/delta_writer.h
+++ b/be/src/olap/delta_writer.h
@@ -67,7 +67,9 @@ public:
     Status close();
     // wait for all memtables to be flushed.
     // mem_consumption() should be 0 after this function returns.
-    Status close_wait(google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec, bool is_broken);
+    Status close_wait(google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec,
+                      google::protobuf::RepeatedPtrField<PTabletError>* tablet_errors,
+                      bool is_broken);
 
     // abandon current memtable and wait for all pending-flushing memtables to be destructed.
     // mem_consumption() should be 0 after this function returns.
diff --git a/be/src/runtime/load_channel.h b/be/src/runtime/load_channel.h
index fa88ec20e2..1d0c3f04e1 100644
--- a/be/src/runtime/load_channel.h
+++ b/be/src/runtime/load_channel.h
@@ -81,7 +81,8 @@ protected:
         bool finished = false;
         auto index_id = request.index_id();
         RETURN_IF_ERROR(channel->close(request.sender_id(), request.backend_id(), &finished,
-                                       request.partition_ids(), response->mutable_tablet_vec()));
+                                       request.partition_ids(), response->mutable_tablet_vec(),
+                                       response->mutable_tablet_errors()));
         if (finished) {
             std::lock_guard<std::mutex> l(_lock);
             _tablets_channels.erase(index_id);
diff --git a/be/src/runtime/tablets_channel.cpp b/be/src/runtime/tablets_channel.cpp
index 72999fe3af..07dbca425e 100644
--- a/be/src/runtime/tablets_channel.cpp
+++ b/be/src/runtime/tablets_channel.cpp
@@ -80,7 +80,8 @@ Status TabletsChannel::open(const PTabletWriterOpenRequest& request) {
 
 Status TabletsChannel::close(int sender_id, int64_t backend_id, bool* finished,
                              const google::protobuf::RepeatedField<int64_t>& partition_ids,
-                             google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec) {
+                             google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec,
+                             google::protobuf::RepeatedPtrField<PTabletError>* tablet_errors) {
     std::lock_guard<std::mutex> l(_lock);
     if (_state == kFinished) {
         return _close_status;
@@ -128,8 +129,9 @@ Status TabletsChannel::close(int sender_id, int64_t backend_id, bool* finished,
         for (auto writer : need_wait_writers) {
             // close may return failed, but no need to handle it here.
             // tablet_vec will only contains success tablet, and then let FE judge it.
-            writer->close_wait(tablet_vec, (_broken_tablets.find(writer->tablet_id()) !=
-                                            _broken_tablets.end()));
+            writer->close_wait(
+                    tablet_vec, tablet_errors,
+                    (_broken_tablets.find(writer->tablet_id()) != _broken_tablets.end()));
         }
     }
     return Status::OK();
@@ -260,4 +262,4 @@ std::ostream& operator<<(std::ostream& os, const TabletsChannelKey& key) {
     return os;
 }
 
-} // namespace doris
\ No newline at end of file
+} // namespace doris
diff --git a/be/src/runtime/tablets_channel.h b/be/src/runtime/tablets_channel.h
index 725fe44083..eb39956cba 100644
--- a/be/src/runtime/tablets_channel.h
+++ b/be/src/runtime/tablets_channel.h
@@ -77,7 +77,8 @@ public:
     // no-op when this channel has been closed or cancelled
     Status close(int sender_id, int64_t backend_id, bool* finished,
                  const google::protobuf::RepeatedField<int64_t>& partition_ids,
-                 google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec);
+                 google::protobuf::RepeatedPtrField<PTabletInfo>* tablet_vec,
+                 google::protobuf::RepeatedPtrField<PTabletError>* tablet_error);
 
     // no-op when this channel has been closed or cancelled
     Status cancel();
@@ -235,4 +236,4 @@ Status TabletsChannel::add_batch(const TabletWriterAddRequest& request,
     }
     return Status::OK();
 }
-} // namespace doris
\ No newline at end of file
+} // namespace doris


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