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
FieldsModifier and TypeFieldDescriptionprivate HistoryRecordComparatorprotected Configurationstatic final Fieldprivate DatabaseHistoryListenerprotected final org.slf4j.Loggerprivate booleanprivate booleanprivate booleanprivate TableChanges.TableChangesSerializer<Array>private booleanFields inherited from interface io.debezium.relational.history.DatabaseHistory
CONFIGURATION_FIELD_PREFIX_STRING, DDL_FILTER, NAME, SKIP_UNPARSEABLE_DDL_STATEMENTS, STORE_ONLY_CAPTURED_TABLES_DDL, STORE_ONLY_MONITORED_TABLES_DDL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema) Configure this instance.voidCalled to initialize permanent storage of the history.final voidRecord a change to the schema of the named database, and store it in the schema storage.final voidrecord(Map<String, ?> source, Map<String, ?> position, String databaseName, String schemaName, String ddl, TableChanges changes) voidprotected abstract voidrecoverRecords(Consumer<HistoryRecord> records) booleanvoidstart()Start the history.voidstop()Stop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener).booleanprotected abstract voidstoreRecord(HistoryRecord record) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:DatabaseHistoryConfigure this instance.- Specified by:
configurein 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 comparatoris 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:DatabaseHistoryStart the history.- Specified by:
startin interfaceDatabaseHistory
-
record
public final void record(Map<String, ?> source, Map<String, throws DatabaseHistoryException?> position, String databaseName, String ddl) Description copied from interface:DatabaseHistoryRecord a change to the schema of the named database, and store it in the schema storage.- Specified by:
recordin 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 whenrecoveringthe 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) - Specified by:
recordin interfaceDatabaseHistory- Throws:
DatabaseHistoryException
-
recover
- Specified by:
recoverin interfaceDatabaseHistory
-
storeRecord
- Throws:
DatabaseHistoryException
-
recoverRecords
-
stop
public void stop()Description copied from interface:DatabaseHistoryStop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener).- Specified by:
stopin interfaceDatabaseHistory
-
initializeStorage
public void initializeStorage()Description copied from interface:DatabaseHistoryCalled to initialize permanent storage of the history.- Specified by:
initializeStoragein interfaceDatabaseHistory
-
storeOnlyCapturedTables
public boolean storeOnlyCapturedTables()- Specified by:
storeOnlyCapturedTablesin interfaceDatabaseHistory
-
skipUnparseableDdlStatements
public boolean skipUnparseableDdlStatements()- Specified by:
skipUnparseableDdlStatementsin interfaceDatabaseHistory
-