Class CommitLogWriterFlushStrategy

java.lang.Object
io.debezium.connector.oracle.logminer.logwriter.CommitLogWriterFlushStrategy
All Implemented Interfaces:
LogWriterFlushStrategy, AutoCloseable

public class CommitLogWriterFlushStrategy extends Object implements LogWriterFlushStrategy
A LogWriterFlushStrategy that uses a transaction commit to force the provided connection's Oracle LogWriter (LGWR) process to flush to disk.
Author:
Chris Cranford
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • CREATE_FLUSH_TABLE

      private static final String CREATE_FLUSH_TABLE
      See Also:
    • INSERT_FLUSH_TABLE

      private static final String INSERT_FLUSH_TABLE
      See Also:
    • UPDATE_FLUSH_TABLE

      private static final String UPDATE_FLUSH_TABLE
      See Also:
    • DELETE_FLUSH_TABLE

      private static final String DELETE_FLUSH_TABLE
      See Also:
    • flushTableName

      private final String flushTableName
    • flushTableId

      private final TableId flushTableId
    • databasePdbName

      private final String databasePdbName
    • connection

      private final OracleConnection connection
    • closeConnectionOnClose

      private final boolean closeConnectionOnClose
  • Constructor Details

    • CommitLogWriterFlushStrategy

      public CommitLogWriterFlushStrategy(OracleConnectorConfig connectorConfig, OracleConnection connection)
      Creates a transaction-commit Oracle LogWriter (LGWR) process flush strategy. This will use the existing database connection to make the flush and the connection will not be automatically closed when the strategy is closed.
      Parameters:
      connectorConfig - the connector configuration, must not be null
      connection - the connection to be used to force the flush, must not be null
    • CommitLogWriterFlushStrategy

      public CommitLogWriterFlushStrategy(OracleConnectorConfig connectorConfig, JdbcConfiguration jdbcConfig) throws SQLException
      Creates a transaction-commit Oracle LogWriter (LGWR) process flush strategy. This will create a new database connection based on the supplied JDBC configuration and the connection will automatically be closed when the strategy is closed.
      Parameters:
      connectorConfig - the connector configuration, must not be null
      jdbcConfig - the jdbc configuration
      Throws:
      SQLException - if there was a database problem
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getHost

      public String getHost()
      Specified by:
      getHost in interface LogWriterFlushStrategy
      Returns:
      the host or ip address that will be flushed by the strategy
    • flush

      public void flush(Scn currentScn)
      Description copied from interface: LogWriterFlushStrategy
      Perform the Oracle LGWR process flush.
      Specified by:
      flush in interface LogWriterFlushStrategy
      Parameters:
      currentScn - the current system change number
    • createFlushTableIfNotExists

      private void createFlushTableIfNotExists()
      Makes sure that the flush table is created in the database and that it at least has 1 row of data so that when flushes occur that the update succeeds without failure.
    • fixMultiRowDataBug

      private void fixMultiRowDataBug() throws SQLException
      Cleans and resets the state of the flush table if multiple rows are detected. This bug was introduced in Debezium 1.7.0.Final by mistake and this function will self-correct the data managed by the table.
      Throws:
      SQLException - if a database exception occurs