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

jianliangqi 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 4d48597487b [fix](inverted index) fix close error on inverted index 
writer (#44601)
4d48597487b is described below

commit 4d48597487b35d9bece381aefae1736a9016c9f1
Author: Sun Chenyang <suncheny...@selectdb.com>
AuthorDate: Tue Nov 26 17:35:42 2024 +0800

    [fix](inverted index) fix close error on inverted index writer (#44601)
    
    Related PR: #44205
    fix close error on inverted index writer
---
 be/src/olap/rowset/segment_v2/inverted_index_writer.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp 
b/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
index 08cebaa07d6..86a8f89e4c9 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
@@ -667,8 +667,13 @@ public:
                 FINALLY_CLOSE(meta_out);
                 FINALLY_CLOSE(data_out);
                 FINALLY_CLOSE(index_out);
-                FINALLY_CLOSE(_dir);
-                FINALLY_CLOSE(_index_writer);
+                if constexpr (field_is_numeric_type(field_type)) {
+                    FINALLY_CLOSE(_dir);
+                } else if constexpr (field_is_slice_type(field_type)) {
+                    FINALLY_CLOSE(_index_writer);
+                    // After closing the _index_writer, it needs to be reset 
to null to prevent issues of not closing it or closing it multiple times.
+                    _index_writer.reset();
+                }
             })
 
             return Status::OK();


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

Reply via email to