Package io.debezium.relational.history
Interface DatabaseHistory
-
- All Known Implementing Classes:
AbstractDatabaseHistory,FileDatabaseHistory,KafkaDatabaseHistory,MemoryDatabaseHistory
public interface DatabaseHistoryA history of the database schema described by aTables. Changes to the database schema can berecorded, and adatabase schemacan berecoveredto various points in that history.- Author:
- Randall Hauch
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATION_FIELD_PREFIX_STRINGstatic FieldDDL_FILTERstatic FieldNAMEstatic FieldSKIP_UNPARSEABLE_DDL_STATEMENTSstatic FieldSTORE_ONLY_CAPTURED_TABLES_DDLstatic FieldSTORE_ONLY_MONITORED_TABLES_DDLDeprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidconfigure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema)Configure this instance.booleanexists()Determines if the database history entity exists; i.e.voidinitializeStorage()Called to initialize permanent storage of the history.voidrecord(Map<String,?> source, Map<String,?> position, String databaseName, String ddl)Record a change to the schema of the named database, and store it in the schema storage.voidrecord(Map<String,?> source, Map<String,?> position, String databaseName, String schemaName, String ddl, TableChanges changes)default voidrecover(Offsets<?,?> offsets, Tables schema, DdlParser ddlParser)Recover thedatabase schemato a known point in its history.default voidrecover(Map<String,?> source, Map<String,?> position, Tables schema, DdlParser ddlParser)Deprecated.Userecover(Offsets, Tables, DdlParser)instead.voidrecover(Map<Map<String,?>,Map<String,?>> offsets, Tables schema, DdlParser ddlParser)Deprecated.Userecover(Offsets, Tables, DdlParser)instead.booleanskipUnparseableDdlStatements()voidstart()Start the history.voidstop()Stop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener).booleanstorageExists()Determines if the underlying storage exists (e.g.booleanstoreOnlyCapturedTables()static intvalidateMonitoredTables(Configuration config, Field field, Field.ValidationOutput problems)
-
-
-
Field Detail
-
CONFIGURATION_FIELD_PREFIX_STRING
static final String CONFIGURATION_FIELD_PREFIX_STRING
- See Also:
- Constant Field Values
-
NAME
static final Field NAME
-
SKIP_UNPARSEABLE_DDL_STATEMENTS
static final Field SKIP_UNPARSEABLE_DDL_STATEMENTS
-
STORE_ONLY_CAPTURED_TABLES_DDL
static final Field STORE_ONLY_CAPTURED_TABLES_DDL
-
STORE_ONLY_MONITORED_TABLES_DDL
@Deprecated static final Field STORE_ONLY_MONITORED_TABLES_DDL
Deprecated.
-
DDL_FILTER
static final Field DDL_FILTER
-
-
Method Detail
-
configure
void configure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema)
Configure this instance.- 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
void start()
Start the history.
-
record
void record(Map<String,?> source, Map<String,?> position, String databaseName, String ddl) throws DatabaseHistoryException
Record a change to the schema of the named database, and store it in the schema storage.- 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
void record(Map<String,?> source, Map<String,?> position, String databaseName, String schemaName, String ddl, TableChanges changes) throws DatabaseHistoryException
- Throws:
DatabaseHistoryException
-
recover
@Deprecated default void recover(Map<String,?> source, Map<String,?> position, Tables schema, DdlParser ddlParser)
Deprecated.Userecover(Offsets, Tables, DdlParser)instead.
-
recover
default void recover(Offsets<?,?> offsets, Tables schema, DdlParser ddlParser)
Recover thedatabase schemato a known point in its history. Note that it is possible to recover the database schema to a point in history that is earlier than what has beenrecorded. Likewise, when recovering to a point in history later than what was recorded, the database schema will reflect the latest state known to the history.- Parameters:
offsets- the map of information about the source database to corresponding point in history at which database schema should be recoveredschema- the table definitions that should be changed to reflect the database schema at the desired point in history; may not be nullddlParser- the DDL parser that can be used to apply DDL statements to the givenschema; may not be null
-
recover
@Deprecated void recover(Map<Map<String,?>,Map<String,?>> offsets, Tables schema, DdlParser ddlParser)
Deprecated.Userecover(Offsets, Tables, DdlParser)instead.
-
stop
void stop()
Stop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener).
-
exists
boolean exists()
Determines if the database history entity exists; i.e. the storage must have been initialized and the history must have been populated.
-
storageExists
boolean storageExists()
Determines if the underlying storage exists (e.g. a Kafka topic, file or similar). Note: storage may exist while history entities not yet written, seeexists()
-
initializeStorage
void initializeStorage()
Called to initialize permanent storage of the history.
-
storeOnlyCapturedTables
boolean storeOnlyCapturedTables()
-
skipUnparseableDdlStatements
boolean skipUnparseableDdlStatements()
-
validateMonitoredTables
static int validateMonitoredTables(Configuration config, Field field, Field.ValidationOutput problems)
-
-