You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2024/06/17 04:17:41 UTC

(doris) 08/26: [Fix](inverted index) fix memory leak of inverted index writer for array values (#36208)

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

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

commit 7fa639bdeb98752a6b47cd6e2798ab66d669807a
Author: airborne12 <ai...@gmail.com>
AuthorDate: Thu Jun 13 20:00:07 2024 +0800

    [Fix](inverted index) fix memory leak of inverted index writer for array values (#36208)
    
    fix inverted index writer's field leak
---
 be/src/clucene                                          |  2 +-
 be/src/olap/rowset/segment_v2/inverted_index_writer.cpp | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/be/src/clucene b/be/src/clucene
index 25324632bab..a23a45e6e18 160000
--- a/be/src/clucene
+++ b/be/src/clucene
@@ -1 +1 @@
-Subproject commit 25324632babc0e5da28048ebbe9adcbdfc73c281
+Subproject commit a23a45e6e1846a8e82194a94f1678e006d638c31
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 ffbd90c7173..cc2c89bb116 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
@@ -385,13 +385,6 @@ public:
                     if (null_map[j] == 1) {
                         continue;
                     }
-                    // now we temp create field . later make a pool
-                    if (Status st = create_field(&new_field); st != Status::OK()) {
-                        LOG(ERROR)
-                                << "create field " << string(_field_name.begin(), _field_name.end())
-                                << " error:" << st;
-                        return st;
-                    }
                     auto* v = (Slice*)((const uint8_t*)value_ptr + j * field_size);
                     if ((_parser_type == InvertedIndexParserType::PARSER_NONE &&
                          v->get_size() > _ignore_above) ||
@@ -400,6 +393,13 @@ public:
                         // TODO. Maybe here has performance problem for large size string.
                         continue;
                     } else {
+                        // now we temp create field . later make a pool
+                        if (Status st = create_field(&new_field); st != Status::OK()) {
+                            LOG(ERROR) << "create field "
+                                       << string(_field_name.begin(), _field_name.end())
+                                       << " error:" << st;
+                            return st;
+                        }
                         if (_parser_type != InvertedIndexParserType::PARSER_UNKNOWN &&
                             _parser_type != InvertedIndexParserType::PARSER_NONE) {
                             // in this case stream need to delete after add_document, because the
@@ -409,9 +409,9 @@ public:
                             std::unique_ptr<lucene::util::Reader> char_string_reader = nullptr;
                             RETURN_IF_ERROR(create_char_string_reader(char_string_reader));
                             char_string_reader->init(v->get_data(), v->get_size(), false);
+                            _analyzer->set_ownReader(own_reader);
                             ts = _analyzer->tokenStream(new_field->name(),
                                                         char_string_reader.release());
-                            _analyzer->set_ownReader(own_reader);
                             new_field->setValue(ts, own_token_stream);
                         } else {
                             new_field_char_value(v->get_data(), v->get_size(), new_field);


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