airborne12 commented on code in PR #44205:
URL: https://github.com/apache/doris/pull/44205#discussion_r1851259382


##########
be/src/olap/rowset/segment_v2/inverted_index_file_writer.cpp:
##########
@@ -326,22 +320,18 @@ Status InvertedIndexFileWriter::write_v2() {
         _total_file_size = compound_file_output->getFilePointer();
         _file_info.set_index_size(_total_file_size);
     } catch (CLuceneError& err) {
-        eptr = std::current_exception();
+        error_context.eptr = std::current_exception();
         auto index_path = 
InvertedIndexDescriptor::get_index_file_path_v2(_index_path_prefix);
-        err_msg = "CLuceneError occur when close idx file " + index_path +
-                  " error msg: " + err.what();
-    }
-
-    // Close and clean up
-    finalize_output_dir(out_dir);
-    if (compound_file_output) {
-        compound_file_output->close();
-    }
-
-    if (eptr) {
-        LOG(ERROR) << err_msg;
-        return Status::Error<ErrorCode::INVERTED_INDEX_CLUCENE_ERROR>(err_msg);
+        error_context.err_msg.append("CLuceneError occur when close idx file: 
");
+        error_context.err_msg.append(index_path);
+        error_context.err_msg.append(", error msg: ");
+        error_context.err_msg.append(err.what());
+        LOG(ERROR) << error_context.err_msg;
     }
+    FINALLY_ON_ERROR({

Review Comment:
   The name `FINALLY_ON_ERROR` is misleading since it is invoked during normal 
procedures as well. 
   Consider renaming it to something more descriptive, such as 
`FINALIZE_PROCESS` or `CLEANUP_HANDLER`, 
   to better reflect its usage in both error and normal execution flows.
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to