Package io.debezium.relational.history
Class AbstractDatabaseHistory
java.lang.Object
io.debezium.relational.history.AbstractDatabaseHistory
- All Implemented Interfaces:
DatabaseHistory
- Direct Known Subclasses:
FileDatabaseHistory
,KafkaDatabaseHistory
,MemoryDatabaseHistory
- Author:
- Randall Hauch
-
Field Summary
Modifier and TypeFieldDescriptionprivate HistoryRecordComparator
protected Configuration
static final Field
private DatabaseHistoryListener
protected final org.slf4j.Logger
private boolean
private boolean
private boolean
private TableChanges.TableChangesSerializer<Array>
private boolean
Fields inherited from interface io.debezium.relational.history.DatabaseHistory
CONFIGURATION_FIELD_PREFIX_STRING, DDL_FILTER, NAME, SKIP_UNPARSEABLE_DDL_STATEMENTS, STORE_ONLY_CAPTURED_TABLES_DDL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema) Configure this instance.void
Called to initialize permanent storage of the history.final void
Record a change to the schema of the named database, and store it in the schema storage.final void
record
(Map<String, ?> source, Map<String, ?> position, String databaseName, String schemaName, String ddl, TableChanges changes, Instant timestamp) void
protected abstract void
recoverRecords
(Consumer<HistoryRecord> records) boolean
void
start()
Start the history.void
stop()
Stop recording history and release any resources acquired sinceDatabaseHistory.configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener, boolean)
.boolean
protected abstract void
storeRecord
(HistoryRecord record) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.debezium.relational.history.DatabaseHistory
exists, recover, recover, storageExists
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
INTERNAL_PREFER_DDL
-
config
-
comparator
-
skipUnparseableDDL
private boolean skipUnparseableDDL -
storeOnlyCapturedTablesDdl
private boolean storeOnlyCapturedTablesDdl -
ddlFilter
-
listener
-
useCatalogBeforeSchema
private boolean useCatalogBeforeSchema -
preferDdl
private boolean preferDdl -
tableChangesSerializer
-
-
Constructor Details
-
AbstractDatabaseHistory
protected AbstractDatabaseHistory()
-
-
Method Details
-
configure
public void configure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema) Description copied from interface:DatabaseHistory
Configure this instance.- Specified by:
configure
in interfaceDatabaseHistory
- Parameters:
config
- the configuration for this history storecomparator
- the function that should be used to compare history records duringrecovery
; may be null if thedefault comparator
is to be usedlistener
- TODOuseCatalogBeforeSchema
- true if the parsed string for a table contains only 2 items and the first should be used as the catalog and the second as the table name, or false if the first should be used as the schema and the second as the table name
-
start
public void start()Description copied from interface:DatabaseHistory
Start the history.- Specified by:
start
in interfaceDatabaseHistory
-
record
public final void record(Map<String, ?> source, Map<String, throws DatabaseHistoryException?> position, String databaseName, String ddl) Description copied from interface:DatabaseHistory
Record a change to the schema of the named database, and store it in the schema storage.- Specified by:
record
in interfaceDatabaseHistory
- Parameters:
source
- the information about the source database; may not be nullposition
- the point in history where these DDL changes were made, which may be used whenrecovering
the schema to some point in history; may not be nulldatabaseName
- the name of the database whose schema is being changed; may be nullddl
- the DDL statements that describe the changes to the database schema; may not be null- Throws:
DatabaseHistoryException
- if the record could not be written
-
record
public final void record(Map<String, ?> source, Map<String, throws DatabaseHistoryException?> position, String databaseName, String schemaName, String ddl, TableChanges changes, Instant timestamp) - Specified by:
record
in interfaceDatabaseHistory
- Throws:
DatabaseHistoryException
-
recover
- Specified by:
recover
in interfaceDatabaseHistory
-
storeRecord
- Throws:
DatabaseHistoryException
-
recoverRecords
-
stop
public void stop()Description copied from interface:DatabaseHistory
Stop recording history and release any resources acquired sinceDatabaseHistory.configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener, boolean)
.- Specified by:
stop
in interfaceDatabaseHistory
-
initializeStorage
public void initializeStorage()Description copied from interface:DatabaseHistory
Called to initialize permanent storage of the history.- Specified by:
initializeStorage
in interfaceDatabaseHistory
-
storeOnlyCapturedTables
public boolean storeOnlyCapturedTables()- Specified by:
storeOnlyCapturedTables
in interfaceDatabaseHistory
-
skipUnparseableDdlStatements
public boolean skipUnparseableDdlStatements()- Specified by:
skipUnparseableDdlStatements
in interfaceDatabaseHistory
-