Package io.debezium.relational
Class HistorizedRelationalDatabaseSchema
- java.lang.Object
-
- io.debezium.relational.RelationalDatabaseSchema
-
- io.debezium.relational.HistorizedRelationalDatabaseSchema
-
- All Implemented Interfaces:
DatabaseSchema<TableId>
,HistorizedDatabaseSchema<TableId>
,AutoCloseable
public abstract class HistorizedRelationalDatabaseSchema extends RelationalDatabaseSchema implements HistorizedDatabaseSchema<TableId>
ADatabaseSchema
or a relational database which has a schema history, that can be recovered to the current state when restarting a connector.- Author:
- Gunnar Morling
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.debezium.schema.HistorizedDatabaseSchema
HistorizedDatabaseSchema.SchemaChangeEventConsumer
-
-
Field Summary
Fields Modifier and Type Field Description protected DatabaseHistory
databaseHistory
private boolean
recoveredTables
-
Fields inherited from interface io.debezium.schema.DatabaseSchema
NO_CAPTURED_DATA_COLLECTIONS_WARNING
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HistorizedRelationalDatabaseSchema(HistorizedRelationalDatabaseConnectorConfig config, TopicSelector<TableId> topicSelector, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected abstract DdlParser
getDdlParser()
Returns a new instance of theDdlParser
to be used when recovering the schema from a previously persisted history.void
initializeStorage()
Configures a storage used to store history, e.g.boolean
isHistorized()
Whether this schema is historized (i.e.protected void
record(SchemaChangeEvent schemaChange, TableChanges tableChanges)
Records the given schema change event in the persistent history.void
recover(Offsets<?,?> offsets)
boolean
skipUnparseableDdlStatements()
boolean
storeOnlyCapturedTables()
boolean
tableInformationComplete()
Indicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.-
Methods inherited from class io.debezium.relational.RelationalDatabaseSchema
assureNonEmptySchema, buildAndRegisterSchema, clearSchemas, getTableFilter, refresh, refreshSchema, removeSchema, schemaFor, tableFor, tableIds, tables
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.debezium.schema.DatabaseSchema
assureNonEmptySchema, schemaFor
-
Methods inherited from interface io.debezium.schema.HistorizedDatabaseSchema
applySchemaChange, recover
-
-
-
-
Field Detail
-
databaseHistory
protected final DatabaseHistory databaseHistory
-
recoveredTables
private boolean recoveredTables
-
-
Constructor Detail
-
HistorizedRelationalDatabaseSchema
protected HistorizedRelationalDatabaseSchema(HistorizedRelationalDatabaseConnectorConfig config, TopicSelector<TableId> topicSelector, Tables.TableFilter tableFilter, Tables.ColumnNameFilter columnFilter, TableSchemaBuilder schemaBuilder, boolean tableIdCaseInsensitive, Key.KeyMapper customKeysMapper)
-
-
Method Detail
-
recover
public void recover(Offsets<?,?> offsets)
- Specified by:
recover
in interfaceHistorizedDatabaseSchema<TableId>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classRelationalDatabaseSchema
-
initializeStorage
public void initializeStorage()
Configures a storage used to store history, e.g. in Kafka case it creates topic with required parameters.- Specified by:
initializeStorage
in interfaceHistorizedDatabaseSchema<TableId>
-
getDdlParser
protected abstract DdlParser getDdlParser()
Returns a new instance of theDdlParser
to be used when recovering the schema from a previously persisted history.
-
record
protected void record(SchemaChangeEvent schemaChange, TableChanges tableChanges)
Records the given schema change event in the persistent history.- Parameters:
schemaChange
- The schema change, must not benull
tableChanges
- A logical representation of the change, may benull
if a specific implementation solely relies on storing DDL statements in the history
-
tableInformationComplete
public boolean tableInformationComplete()
Description copied from interface:DatabaseSchema
Indicates whether or not table names are guaranteed to be fully present, regardless of whether or not a snapshot has been performed.- Specified by:
tableInformationComplete
in interfaceDatabaseSchema<TableId>
- Overrides:
tableInformationComplete
in classRelationalDatabaseSchema
- Returns:
- boolean indicating if table names are present
-
storeOnlyCapturedTables
public boolean storeOnlyCapturedTables()
- Specified by:
storeOnlyCapturedTables
in interfaceHistorizedDatabaseSchema<TableId>
-
skipUnparseableDdlStatements
public boolean skipUnparseableDdlStatements()
-
isHistorized
public boolean isHistorized()
Description copied from interface:DatabaseSchema
Whether this schema is historized (i.e. a history of all schema changes is kept which is recovered upon connector restart) or not.- Specified by:
isHistorized
in interfaceDatabaseSchema<TableId>
- Overrides:
isHistorized
in classRelationalDatabaseSchema
-
-