Package io.debezium.relational.history
Class AbstractSchemaHistory
java.lang.Object
io.debezium.relational.history.AbstractSchemaHistory
- All Implemented Interfaces:
SchemaHistory
- Direct Known Subclasses:
AbstractFileBasedSchemaHistory,MemorySchemaHistory
- Author:
- Randall Hauch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Field.Setprivate HistoryRecordComparatorprotected Configurationprivate SchemaHistoryListenerprotected final org.slf4j.Loggerprivate booleanprivate booleanprivate final TableChanges.TableChangesSerializer<Array>private booleanFields inherited from interface io.debezium.relational.history.SchemaHistory
CONFIGURATION_FIELD_PREFIX_STRING, DDL_FILTER, INTERNAL_CONNECTOR_CLASS, INTERNAL_CONNECTOR_ID, INTERNAL_PREFER_DDL, NAME, SKIP_UNPARSEABLE_DDL_STATEMENTS, STORE_ONLY_CAPTURED_DATABASES_DDL, STORE_ONLY_CAPTURED_TABLES_DDL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration config, HistoryRecordComparator comparator, SchemaHistoryListener 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, Instant timestamp) voidprotected abstract voidrecoverRecords(Consumer<HistoryRecord> records) voidstart()Start the history.voidstop()Stop recording history and release any resources acquired sinceSchemaHistory.configure(Configuration, HistoryRecordComparator, SchemaHistoryListener, boolean).protected 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.SchemaHistory
exists, recover, recover, storageExists
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
ALL_FIELDS
-
config
-
comparator
-
skipUnparseableDDL
private boolean skipUnparseableDDL -
ddlFilter
-
listener
-
useCatalogBeforeSchema
private boolean useCatalogBeforeSchema -
preferDdl
private boolean preferDdl -
tableChangesSerializer
-
-
Constructor Details
-
AbstractSchemaHistory
protected AbstractSchemaHistory()
-
-
Method Details
-
configure
public void configure(Configuration config, HistoryRecordComparator comparator, SchemaHistoryListener listener, boolean useCatalogBeforeSchema) Description copied from interface:SchemaHistoryConfigure this instance.- Specified by:
configurein interfaceSchemaHistory- 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:SchemaHistoryStart the history.- Specified by:
startin interfaceSchemaHistory
-
record
public final void record(Map<String, ?> source, Map<String, throws SchemaHistoryException?> position, String databaseName, String ddl) Description copied from interface:SchemaHistoryRecord a change to the schema of the named database, and store it in the schema storage.- Specified by:
recordin interfaceSchemaHistory- 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:
SchemaHistoryException- if the record could not be written
-
record
public final void record(Map<String, ?> source, Map<String, throws SchemaHistoryException?> position, String databaseName, String schemaName, String ddl, TableChanges changes, Instant timestamp) - Specified by:
recordin interfaceSchemaHistory- Throws:
SchemaHistoryException
-
recover
- Specified by:
recoverin interfaceSchemaHistory
-
storeRecord
- Throws:
SchemaHistoryException
-
recoverRecords
-
stop
public void stop()Description copied from interface:SchemaHistoryStop recording history and release any resources acquired sinceSchemaHistory.configure(Configuration, HistoryRecordComparator, SchemaHistoryListener, boolean).- Specified by:
stopin interfaceSchemaHistory
-
initializeStorage
public void initializeStorage()Description copied from interface:SchemaHistoryCalled to initialize permanent storage of the history.- Specified by:
initializeStoragein interfaceSchemaHistory
-