This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new e1694e3d915 [Pick 2.1](inverted index) fix memory leak in inverted
index writer for array values #36144 (#36165)
e1694e3d915 is described below
commit e1694e3d9157ef9e22f0d01da8182ad986b8fe27
Author: airborne12 <[email protected]>
AuthorDate: Wed Jun 12 19:59:57 2024 +0800
[Pick 2.1](inverted index) fix memory leak in inverted index writer for
array values #36144 (#36165)
---
be/src/olap/rowset/segment_v2/inverted_index_writer.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 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 664a4f16478..e29dd19ffec 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_writer.cpp
@@ -405,12 +405,15 @@ public:
_parser_type !=
InvertedIndexParserType::PARSER_NONE) {
// in this case stream need to delete after
add_document, because the
// stream can not reuse for different field
+ bool own_token_stream = true;
+ bool own_reader = true;
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);
ts = _analyzer->tokenStream(new_field->name(),
char_string_reader.release());
- new_field->setValue(ts);
+ _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);
}
@@ -422,7 +425,6 @@ public:
// if this array is null, we just ignore to write inverted
index
RETURN_IF_ERROR(add_document());
_doc->clear();
- _CLDELETE(ts);
} else {
// avoid to add doc which without any field which may make
threadState init skip
// init fieldDataArray, then will make error with next doc
with fields in
@@ -436,7 +438,6 @@ public:
_doc->add(*new_field);
RETURN_IF_ERROR(add_null_document());
_doc->clear();
- _CLDELETE(ts);
}
_rid++;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]