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

airborne pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 502bcd13c8a [fix](inverted index) Fix index-tool runtime error (#58684)
502bcd13c8a is described below

commit 502bcd13c8af2dd5cd66a7b7af8cb852f2753c5c
Author: zzzxl <[email protected]>
AuthorDate: Thu Dec 4 13:09:08 2025 +0800

    [fix](inverted index) Fix index-tool runtime error (#58684)
---
 be/src/index-tools/index_tool.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/be/src/index-tools/index_tool.cpp 
b/be/src/index-tools/index_tool.cpp
index 604b1e49711..15f18dac972 100644
--- a/be/src/index-tools/index_tool.cpp
+++ b/be/src/index-tools/index_tool.cpp
@@ -52,6 +52,7 @@
 #include "olap/rowset/segment_v2/inverted_index_desc.h"
 #include "olap/rowset/segment_v2/inverted_index_fs_directory.h"
 #include "olap/tablet_schema.h"
+#include "runtime/thread_context.h"
 
 using doris::segment_v2::DorisCompoundReader;
 using doris::segment_v2::DorisFSDirectoryFactory;
@@ -271,6 +272,8 @@ std::unique_ptr<DorisCompoundReader> 
get_compound_reader(std::string file_path)
 }
 
 int main(int argc, char** argv) {
+    SCOPED_INIT_THREAD_CONTEXT();
+
     std::string usage = get_usage(argv[0]);
     gflags::SetUsageMessage(usage);
     google::ParseCommandLineFlags(&argc, &argv, true);
@@ -645,6 +648,11 @@ int main(int argc, char** argv) {
             for (auto& dir : *dirs) {
                 auto index_id = dir.first.first;
                 auto index_suffix = dir.first.second;
+
+                if (FLAGS_idx_id > 0 && index_id != FLAGS_idx_id) {
+                    continue;
+                }
+
                 std::vector<std::string> files;
                 doris::TabletIndexPB index_pb;
                 index_pb.set_index_id(index_id);
@@ -664,7 +672,8 @@ int main(int argc, char** argv) {
                 auto reader = std::forward<T>(ret).value();
                 reader->list(&files);
                 for (auto& file : files) {
-                    std::cout << file << std::endl;
+                    int64_t size = reader->fileLength(file.c_str());
+                    std::cout << file << "\t" << size << " bytes" << std::endl;
                 }
             }
         } catch (CLuceneError& err) {


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

Reply via email to