Class CommitLogUtil

java.lang.Object
io.debezium.connector.cassandra.CommitLogUtil

public final class CommitLogUtil extends Object
Utility class used by the CommitLogProcessor to compare/delete commit log files.
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • FILENAME_REGEX_PATTERN

      private static final Pattern FILENAME_REGEX_PATTERN
    • FILENAME_INDEX_REGEX_PATTERN

      private static final Pattern FILENAME_INDEX_REGEX_PATTERN
  • Constructor Details

    • CommitLogUtil

      private CommitLogUtil()
  • Method Details

    • moveCommitLog

      public static void moveCommitLog(Path file, Path toDir)
      Move a commit log to a new directory. If the commit log already exists in the new directory, it would be replaced.
      Throws:
      RuntimeException - exception in case moving failed
    • deleteCommitLog

      public static void deleteCommitLog(File file)
      Delete a commit log and logs the error in the case the deletion failed.
    • getCommitLogs

      public static File[] getCommitLogs(File directory)
      Given a directory, return an array of commit logs in this directory. If the directory does not contain any commit logs, an empty array is returned.
    • getIndexes

      public static File[] getIndexes(File directory)
      Given a directory, return an array of commit logs' marker files in this directory. If the directory does not contain any commit logs, an empty array is returned.
    • compareCommitLogs

      public static int compareCommitLogs(File file1, File file2)
      Comparing two commit log files provided the File instances; Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
    • compareCommitLogs

      public static int compareCommitLogs(String file1, String file2)
    • compareCommitLogsIndexes

      public static int compareCommitLogsIndexes(File file1, File file2)
      Comparing two commit log files provided the File instances; Returns 0 if they are the same, -1 if first file is older, 1 if first file is newer.
    • extractTimestamp

      private static long extractTimestamp(String commitLogFileName, Pattern pattern)