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/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 6817141d14f [Fix](Outfiel) fix be core when the open method of 
vfile_result_writer failed #32042
6817141d14f is described below

commit 6817141d14f65ac8ffdfa4c47e634513bfdc4693
Author: Tiewei Fang <43782773+bepppo...@users.noreply.github.com>
AuthorDate: Mon Mar 11 22:16:58 2024 +0800

    [Fix](Outfiel) fix be core when the open method of vfile_result_writer 
failed #32042
---
 be/src/vec/sink/writer/vfile_result_writer.cpp | 24 ++++++++++++++----------
 be/src/vec/sink/writer/vfile_result_writer.h   |  2 +-
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/be/src/vec/sink/writer/vfile_result_writer.cpp 
b/be/src/vec/sink/writer/vfile_result_writer.cpp
index 661afa15935..8952aa769ae 100644
--- a/be/src/vec/sink/writer/vfile_result_writer.cpp
+++ b/be/src/vec/sink/writer/vfile_result_writer.cpp
@@ -420,17 +420,21 @@ Status VFileResultWriter::_delete_dir() {
     return Status::OK();
 }
 
-Status VFileResultWriter::close(Status) {
-    // the following 2 profile "_written_rows_counter" and 
"_writer_close_timer"
-    // must be outside the `_close_file_writer()`.
-    // because `_close_file_writer()` may be called in deconstructor,
-    // at that time, the RuntimeState may already been deconstructed,
-    // so does the profile in RuntimeState.
-    if (_written_rows_counter) {
-        COUNTER_SET(_written_rows_counter, _written_rows);
-        SCOPED_TIMER(_writer_close_timer);
+Status VFileResultWriter::close(Status exec_status) {
+    Status st = exec_status;
+    if (st.ok()) {
+        // the following 2 profile "_written_rows_counter" and 
"_writer_close_timer"
+        // must be outside the `_close_file_writer()`.
+        // because `_close_file_writer()` may be called in deconstructor,
+        // at that time, the RuntimeState may already been deconstructed,
+        // so does the profile in RuntimeState.
+        if (_written_rows_counter) {
+            COUNTER_SET(_written_rows_counter, _written_rows);
+            SCOPED_TIMER(_writer_close_timer);
+        }
+        st = _close_file_writer(true);
     }
-    return _close_file_writer(true);
+    return st;
 }
 
 } // namespace doris::vectorized
diff --git a/be/src/vec/sink/writer/vfile_result_writer.h 
b/be/src/vec/sink/writer/vfile_result_writer.h
index c52050ba6f1..29fd6d89cd3 100644
--- a/be/src/vec/sink/writer/vfile_result_writer.h
+++ b/be/src/vec/sink/writer/vfile_result_writer.h
@@ -60,7 +60,7 @@ public:
 
     Status write(Block& block) override;
 
-    Status close(Status s = Status::OK()) override;
+    Status close(Status exec_status) override;
 
     Status open(RuntimeState* state, RuntimeProfile* profile) override;
 


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

Reply via email to