@ShellMethod(key = "repair show empty commit metadata", value = "show failed commits")
  public void showFailedCommits() {
    HoodieTableMetaClient metaClient = HoodieCLI.getTableMetaClient();
    HoodieActiveTimeline activeTimeline =  metaClient.getActiveTimeline();
    activeTimeline.filterCompletedInstants().getInstantsAsStream().filter(activeTimeline::isEmpty).forEach(hoodieInstant -> LOG.warn("Empty Commit: " + hoodieInstant.toString()));
  }
@Test
  public void testShowFailedCommits() {
    HoodieCLI.conf = storageConf();

    StorageConfiguration<?> conf = HoodieCLI.conf;

    HoodieTableMetaClient metaClient = HoodieCLI.getTableMetaClient();

    for (int i = 1; i < 20; i++) {
      String timestamp = String.valueOf(i);
      // Write corrupted requested Clean File
      HoodieTestCommitMetadataGenerator.createCommitFile(tablePath, timestamp, conf);
    }

    metaClient.getActiveTimeline().getInstantsAsStream().filter(hoodieInstant -> Integer.parseInt(hoodieInstant.getTimestamp()) % 4 == 0).forEach(hoodieInstant -> {
      metaClient.getActiveTimeline().deleteInstantFileIfExists(hoodieInstant);
      if (hoodieInstant.isCompleted()) {
        metaClient.getActiveTimeline().createCompleteInstant(hoodieInstant);
      } else {
        metaClient.getActiveTimeline().createNewInstant(hoodieInstant);
      }
    });

    final TestLogAppender appender = new TestLogAppender();
    final Logger logger = (Logger) LogManager.getLogger(RepairsCommand.class);
    try {
      appender.start();
      logger.addAppender(appender);
      Object result = shell.evaluate(() -> "repair show empty commit metadata");
      assertTrue(ShellEvaluationResultUtil.isSuccess(result));
      final List<LogEvent> log = appender.getLog();
      assertEquals(log.size(),4);
      log.forEach(LoggingEvent -> {
        assertEquals(LoggingEvent.getLevel(), Level.WARN);
        assertTrue(LoggingEvent.getMessage().getFormattedMessage().contains("Empty Commit: "));
        assertTrue(LoggingEvent.getMessage().getFormattedMessage().contains("COMPLETED]"));
      });
    } finally {
      logger.removeAppender(appender);
    }


  }