public static void main(final String[] args) throws Exception {
        if (args == null || args.length < 1) {
            System.out.println(
                    "[Data Repair] Please input 1 params : storePath [ topicA,topicB,....]");
            return;
        }
        List<String> topicList = null;
        final String storePath = args[0];
        if (args.length > 1) {
            if (args[1] != null && TStringUtils.isNotBlank(args[1])) {
                topicList = Arrays.asList(args[1].split(","));
            }
        }
        final File storeDir = new File(storePath);
        if (!storeDir.exists()) {
            throw new RuntimeException(new StringBuilder(512)
                    .append("[Data Repair] store path is not existed, path is ")
                    .append(storePath).toString());
        }
        if (!storeDir.isDirectory()) {
            throw new RuntimeException(new StringBuilder(512)
                    .append("[Data Repair]  store path is not a directory, path is ")
                    .append(storePath).toString());
        }
        final long start = System.currentTimeMillis();
        final File[] ls = storeDir.listFiles();
        if (topicList == null || topicList.isEmpty()) {
            logger.warn(new StringBuilder(512)
                    .append("[Data Repair] Begin to scan store path: ")
                    .append(storePath).toString());
        } else {
            logger.warn(new StringBuilder(512)
                    .append("[Data Repair] Begin to scan store path: ")
                    .append(storePath).append(",topicList:")
                    .append(topicList.toString()).toString());
        }
        int count = 0;
        ExecutorService executor =
                Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() + 1);
        List<Callable<IndexRepairStore>> tasks = new ArrayList<>();
        if (ls != null) {
            for (final File subDir : ls) {
                if (subDir == null) {
                    continue;
                }
                if (subDir.isDirectory()) {
                    final String name = subDir.getName();
                    final int index = name.lastIndexOf('-');
                    if (index < 0) {
                        continue;
                    }
                    final String topic = name.substring(0, index);
                    if (topicList != null && !topicList.isEmpty()) {
                        if (!topicList.contains(topic)) {
                            continue;
                        }
                    }
                    final int storeId = Integer.parseInt(name.substring(index + 1));
                    tasks.add(new Callable<IndexRepairStore>() {

                        @Override
                        public IndexRepairStore call() throws Exception {
                            StringBuilder sBuilder = new StringBuilder(512);
                            logger.info(sBuilder.append("[Data Repair] Loading data directory:")
                                    .append(subDir.getAbsolutePath()).append("...").toString());
                            sBuilder.delete(0, sBuilder.length());
                            final IndexRepairStore messageStore =
                                    new IndexRepairStore(storePath, topic, storeId);
                            messageStore.reCreateIndexFiles();
                            logger.info(sBuilder.append("[Data Repair] Finished data index recreation :")
                                    .append(subDir.getAbsolutePath()).toString());
                            return messageStore;
                        }
                    });
                    count++;
                }
            }
        }
        if (count > 0) {
            CompletionService<IndexRepairStore> completionService =
                    new ExecutorCompletionService<>(executor);
            for (Callable<IndexRepairStore> task : tasks) {
                completionService.submit(task);
            }
            for (int i = 0; i < tasks.size(); i++) {
                IndexRepairStore messageStore =
                        completionService.take().get();
                if (messageStore != null) {
                    messageStore.close();
                }
            }
            tasks.clear();
        }
        executor.shutdown();
        try {
            executor.awaitTermination(30 * 1000, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            //
        }
        logger.warn(new StringBuilder(512)
                .append("[Data Repair] End to scan data path in ")
                .append((System.currentTimeMillis() - start) / 1000)
                .append(" secs").toString());
        System.exit(0);
    }
Repair topic storage files, rebuild index files by existing data files
@param args   Startup parameter array, including the following parts:
              The 1st parameter is the path of topic storage files;
              The 2nd parameter is the topic name(s) that needs to be repaired,
                  if not specified, all topics in the storage path will be repaired.
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/tools/StoreRepairAdmin.java