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


##########
be/src/olap/compaction.cpp:
##########
@@ -567,10 +573,48 @@ Status 
Compaction::construct_output_rowset_writer(RowsetWriterContext& ctx, bool
                                     return false;
                                 }
                                 if (!exists) {
-                                    LOG(WARNING) << 
inverted_index_src_file_path
+                                    LOG(WARNING) << "tablet[" << 
_tablet->tablet_id()
+                                                 << "] index_unique_id[" << 
unique_id << "],"
+                                                 << 
inverted_index_src_file_path
                                                  << " is not exists, will skip 
index compaction";
                                     return false;
                                 }
+
+                                // check idx file size
+                                int64_t file_size = 0;
+                                if 
(fs->file_size(inverted_index_src_file_path, &file_size) !=
+                                    Status::OK()) {
+                                    LOG(ERROR) << inverted_index_src_file_path
+                                               << " fs->file_size error";
+                                    return false;
+                                }
+                                if (file_size == 0) {
+                                    LOG(WARNING) << "tablet[" << 
_tablet->tablet_id()
+                                                 << "] index_unique_id[" << 
unique_id << "],"
+                                                 << 
inverted_index_src_file_path
+                                                 << " is empty file, will skip 
index compaction";
+                                    return false;
+                                }
+
+                                // check index meta
+                                std::filesystem::path 
p(inverted_index_src_file_path);
+                                std::string dir_str = p.parent_path().string();
+                                std::string file_str = p.filename().string();
+                                lucene::store::Directory* dir =
+                                        
DorisCompoundDirectory::getDirectory(fs, dir_str.c_str());
+                                auto reader = new DorisCompoundReader(dir, 
file_str.c_str());
+                                std::vector<std::string> files;
+                                reader->list(&files);
+
+                                // why is 3?
+                                // bkd index will write at least 3 files
+                                if (files.size() < 3) {

Review Comment:
   need to check the actual index file to confirm that.



-- 
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