Package io.debezium.relational.history
Class FileDatabaseHistory
java.lang.Object
io.debezium.relational.history.AbstractDatabaseHistory
io.debezium.relational.history.FileDatabaseHistory
- All Implemented Interfaces:
DatabaseHistory
A
DatabaseHistory
implementation that stores the schema history in a local file.- Author:
- Randall Hauch
-
Field Summary
Modifier and TypeFieldDescriptionstatic Collection<Field>
static final Field
private final FunctionalReadWriteLock
private Path
private final DocumentReader
private final AtomicBoolean
private static final Charset
private final DocumentWriter
Fields inherited from class io.debezium.relational.history.AbstractDatabaseHistory
config, INTERNAL_PREFER_DDL, logger
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, STORE_ONLY_MONITORED_TABLES_DDL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema) Configure this instance.boolean
exists()
Determines if the database history entity exists; i.e.protected void
recoverRecords
(Consumer<HistoryRecord> records) void
start()
Start the history.void
stop()
Stop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener)
.boolean
Determines if the underlying storage exists (e.g.protected void
storeRecord
(HistoryRecord record) toString()
Methods inherited from class io.debezium.relational.history.AbstractDatabaseHistory
initializeStorage, record, record, recover, skipUnparseableDdlStatements, storeOnlyCapturedTables
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.debezium.relational.history.DatabaseHistory
recover, recover
-
Field Details
-
FILE_PATH
-
ALL_FIELDS
-
UTF8
-
lock
-
writer
-
reader
-
running
-
path
-
-
Constructor Details
-
FileDatabaseHistory
public FileDatabaseHistory()
-
-
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
- Overrides:
configure
in classAbstractDatabaseHistory
- 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
- Overrides:
start
in classAbstractDatabaseHistory
-
storeRecord
- Specified by:
storeRecord
in classAbstractDatabaseHistory
- Throws:
DatabaseHistoryException
-
stop
public void stop()Description copied from interface:DatabaseHistory
Stop recording history and release any resources acquired since#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener)
.- Specified by:
stop
in interfaceDatabaseHistory
- Overrides:
stop
in classAbstractDatabaseHistory
-
recoverRecords
- Specified by:
recoverRecords
in classAbstractDatabaseHistory
-
storageExists
public boolean storageExists()Description copied from interface:DatabaseHistory
Determines if the underlying storage exists (e.g. a Kafka topic, file or similar). Note: storage may exist while history entities not yet written, seeDatabaseHistory.exists()
-
exists
public boolean exists()Description copied from interface:DatabaseHistory
Determines if the database history entity exists; i.e. the storage must have been initialized and the history must have been populated. -
toString
-