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

jianliangqi pushed a commit to branch clucene-2.0
in repository https://gitbox.apache.org/repos/asf/doris-thirdparty.git


The following commit(s) were added to refs/heads/clucene-2.0 by this push:
     new ff7c8667c0d [fix](inverted index) Fix incorrect exception handling 
(#243) (#246)
ff7c8667c0d is described below

commit ff7c8667c0db625ad46e4aa51829b1a203334401
Author: zzzxl <[email protected]>
AuthorDate: Fri Oct 25 14:30:05 2024 +0800

    [fix](inverted index) Fix incorrect exception handling (#243) (#246)
    
    Memory leaks may occur in exceptional situations
    pick https://github.com/apache/doris-thirdparty/pull/243
---
 src/core/CLucene/index/IndexWriter.cpp | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/core/CLucene/index/IndexWriter.cpp 
b/src/core/CLucene/index/IndexWriter.cpp
index a3b30848af6..10dfd68c60d 100644
--- a/src/core/CLucene/index/IndexWriter.cpp
+++ b/src/core/CLucene/index/IndexWriter.cpp
@@ -1308,21 +1308,6 @@ void 
IndexWriter::indexCompaction(std::vector<lucene::store::Directory *> &src_d
     }
     assert(readers.size() == numIndices);
 
-    // check hasProx
-    bool hasProx = false;
-    {
-        if (!readers.empty()) {
-            IndexReader* reader = readers[0];
-            hasProx = reader->getFieldInfos()->hasProx();
-            for (int32_t i = 1; i < readers.size(); i++) {
-                if (hasProx != readers[i]->getFieldInfos()->hasProx()) {
-                    _CLTHROWA(CL_ERR_IllegalArgument, "src_dirs hasProx 
inconformity");
-                }
-            }
-        }
-    }
-    // std::cout << "hasProx: " << hasProx << std::endl;
-
     numDestIndexes = dest_dirs.size();
 
     // print dest index files
@@ -1342,6 +1327,20 @@ void 
IndexWriter::indexCompaction(std::vector<lucene::store::Directory *> &src_d
     std::vector<lucene::index::IndexWriter *> destIndexWriterList;
     std::vector<lucene::store::IndexOutput *> nullBitmapIndexOutputList;
     try {
+        // check hasProx
+        bool hasProx = false;
+        {
+            if (!readers.empty()) {
+                IndexReader* reader = readers[0];
+                hasProx = reader->getFieldInfos()->hasProx();
+                for (int32_t i = 1; i < readers.size(); i++) {
+                    if (hasProx != readers[i]->getFieldInfos()->hasProx()) {
+                        _CLTHROWA(CL_ERR_IllegalArgument, "src_dirs hasProx 
inconformity");
+                    }
+                }
+            }
+        }
+
         /// merge fields
         mergeFields(hasProx);
 
@@ -1395,8 +1394,6 @@ void 
IndexWriter::indexCompaction(std::vector<lucene::store::Directory *> &src_d
 
         /// merge null_bitmap
         mergeNullBitmap(srcNullBitmapValues, nullBitmapIndexOutputList);
-    } catch (CLuceneError &e) {
-        throw e;
     }
     _CLFINALLY(
             for (auto freqOutput


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to