csun5285 commented on code in PR #44084:
URL: https://github.com/apache/doris/pull/44084#discussion_r1845337149


##########
be/src/olap/rowset/segment_v2/inverted_index_file_writer.cpp:
##########
@@ -268,38 +270,39 @@ Status InvertedIndexFileWriter::write_v1() {
             write_header_and_data_v1(output.get(), sorted_files, directory, 
header_length,
                                      header_file_count);
 
-            // Close and clean up
-            finalize_output_dir(out_dir);
-
             // Collect file information
             auto compound_file_size = output->getFilePointer() - start;
-            output->close();
             total_size += compound_file_size;
             add_index_info(index_id, index_suffix, compound_file_size);
-
         } catch (CLuceneError& err) {
-            finalize_output_dir(out_dir);
-            if (output != nullptr) {
-                output->close();
-                output.reset();
-            }
+            eptr = std::current_exception();
             auto index_path = InvertedIndexDescriptor::get_index_file_path_v1(
                     _index_path_prefix, index_id, index_suffix);
-            LOG(ERROR) << "CLuceneError occur when write_v1 idx file " << 
index_path
-                       << " error msg: " << err.what();
-
-            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                    "CLuceneError occur when write_v1 idx file: {}, error msg: 
{}", index_path,
-                    err.what());
+            err_msg = "CLuceneError occur when write_v1 idx file " + 
index_path +
+                      " error msg: " + err.what();
         }
     }
+
+    // Close and clean up
+    finalize_output_dir(out_dir);

Review Comment:
   在 finalize_output_dir 里面把 out_dir 置空就行



##########
be/src/olap/rowset/segment_v2/inverted_index_file_writer.cpp:
##########
@@ -268,38 +270,39 @@ Status InvertedIndexFileWriter::write_v1() {
             write_header_and_data_v1(output.get(), sorted_files, directory, 
header_length,
                                      header_file_count);
 
-            // Close and clean up
-            finalize_output_dir(out_dir);
-
             // Collect file information
             auto compound_file_size = output->getFilePointer() - start;
-            output->close();
             total_size += compound_file_size;
             add_index_info(index_id, index_suffix, compound_file_size);
-
         } catch (CLuceneError& err) {
-            finalize_output_dir(out_dir);
-            if (output != nullptr) {
-                output->close();
-                output.reset();
-            }
+            eptr = std::current_exception();
             auto index_path = InvertedIndexDescriptor::get_index_file_path_v1(
                     _index_path_prefix, index_id, index_suffix);
-            LOG(ERROR) << "CLuceneError occur when write_v1 idx file " << 
index_path
-                       << " error msg: " << err.what();
-
-            return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(
-                    "CLuceneError occur when write_v1 idx file: {}, error msg: 
{}", index_path,
-                    err.what());
+            err_msg = "CLuceneError occur when write_v1 idx file " + 
index_path +

Review Comment:
   这得 return Error, 写错一个不能继续写了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to