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

dataroaring pushed a commit to branch opt_memtable_speed
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/opt_memtable_speed by this 
push:
     new 2e5f2bb033 [fix](move-memtable) fix BE core when LoadStreamWriter init 
fail (#23208)
2e5f2bb033 is described below

commit 2e5f2bb0337138f7009fb09b014d0751ee9e09ff
Author: Kaijie Chen <c...@apache.org>
AuthorDate: Sun Aug 20 00:17:10 2023 +0800

    [fix](move-memtable) fix BE core when LoadStreamWriter init fail (#23208)
---
 be/src/runtime/load_stream.cpp        | 4 +++-
 be/src/runtime/load_stream_writer.cpp | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/be/src/runtime/load_stream.cpp b/be/src/runtime/load_stream.cpp
index 393c4034a9..2f274ed9db 100644
--- a/be/src/runtime/load_stream.cpp
+++ b/be/src/runtime/load_stream.cpp
@@ -76,7 +76,9 @@ Status TabletStream::init(OlapTableSchemaParam* schema, 
int64_t index_id, int64_
 }
 
 Status TabletStream::append_data(const PStreamHeader& header, butil::IOBuf* 
data) {
-    // TODO failed early
+    if (!_failed_st->ok()) {
+        return *failed_st;
+    }
 
     // dispatch add_segment request
     if (header.opcode() == PStreamHeader::ADD_SEGMENT) {
diff --git a/be/src/runtime/load_stream_writer.cpp 
b/be/src/runtime/load_stream_writer.cpp
index 72cc92327f..328638f7c8 100644
--- a/be/src/runtime/load_stream_writer.cpp
+++ b/be/src/runtime/load_stream_writer.cpp
@@ -83,10 +83,12 @@ Status LoadStreamWriter::init() {
 }
 
 Status LoadStreamWriter::append_data(uint32_t segid, butil::IOBuf buf) {
-    DCHECK(_is_init);
     io::FileWriter* file_writer = nullptr;
     {
         std::lock_guard lock_guard(_lock);
+        if (!_is_init) {
+            RETURN_IF_ERROR(init());
+        }
         if (segid + 1 > _segment_file_writers.size()) {
             for (size_t i = _segment_file_writers.size(); i <= segid; i++) {
                 Status st;


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

Reply via email to