Class LogMinerHelper

java.lang.Object
io.debezium.connector.oracle.logminer.LogMinerHelper

public class LogMinerHelper extends Object
This class contains methods to configure and manage LogMiner utility
  • Field Details

  • Constructor Details

    • LogMinerHelper

      public LogMinerHelper()
  • Method Details

    • setLogFilesForMining

      public static List<LogFile> setLogFilesForMining(OracleConnection connection, Scn lastProcessedScn, Duration archiveLogRetention, boolean archiveLogOnlyMode, String archiveDestinationName, int maxRetries, Duration initialDelay, Duration maxDelay) throws SQLException
      This method substitutes CONTINUOUS_MINE functionality
      Parameters:
      connection - connection
      lastProcessedScn - current offset
      archiveLogRetention - the duration that archive logs will be mined
      archiveLogOnlyMode - true to mine only archive lgos, false to mine all available logs
      archiveDestinationName - configured archive log destination name to use, may be null
      maxRetries - the number of retry attempts before giving up and throwing an exception about log state
      initialDelay - the initial delay
      maxDelay - the maximum delay
      Returns:
      log files that were added to the current mining session
      Throws:
      SQLException - if anything unexpected happens
    • hasLogFilesStartingBeforeOrAtScn

      private static boolean hasLogFilesStartingBeforeOrAtScn(List<LogFile> logs, Scn scn)
    • getMinimumScn

      private static Scn getMinimumScn(List<LogFile> logs)
    • logWarn

      static void logWarn(OracleStreamingChangeEventSourceMetrics streamingMetrics, String format, Object... args)
    • logError

      static void logError(OracleStreamingChangeEventSourceMetrics streamingMetrics, String format, Object... args)
    • getLogFilesForOffsetScn

      public static List<LogFile> getLogFilesForOffsetScn(OracleConnection connection, Scn offsetScn, Duration archiveLogRetention, boolean archiveLogOnlyMode, String archiveDestinationName) throws SQLException
      Get all log files that should be mined.
      Parameters:
      connection - database connection
      offsetScn - offset system change number
      archiveLogRetention - duration that archive logs should be mined
      archiveLogOnlyMode - true to mine only archive logs, false to mine all available logs
      archiveDestinationName - archive destination to use, may be null
      Returns:
      list of log files
      Throws:
      SQLException - if a database exception occurs
    • getScnFromString

      private static Scn getScnFromString(String value)
    • removeLogFilesFromMining

      public static void removeLogFilesFromMining(OracleConnection conn) throws SQLException
      This method removes all added log files from mining
      Parameters:
      conn - connection
      Throws:
      SQLException - something happened
    • executeCallableStatement

      private static void executeCallableStatement(OracleConnection connection, String statement) throws SQLException
      Throws:
      SQLException
    • getColumnIndexByName

      public static int getColumnIndexByName(String columnName, Table table)
      Returns a 0-based index offset for the column name in the relational table.
      Parameters:
      columnName - the column name, should not be null.
      table - the relational table, should not be null.
      Returns:
      the 0-based index offset for the column name