Package io.debezium.relational.history
Class FileDatabaseHistory
- java.lang.Object
-
- io.debezium.relational.history.AbstractDatabaseHistory
-
- io.debezium.relational.history.FileDatabaseHistory
-
- All Implemented Interfaces:
DatabaseHistory
@ThreadSafe public final class FileDatabaseHistory extends AbstractDatabaseHistory
ADatabaseHistoryimplementation that stores the schema history in a local file.- Author:
- Randall Hauch
-
-
Field Summary
Fields Modifier and Type Field Description static Collection<Field>ALL_FIELDSstatic FieldFILE_PATHprivate FunctionalReadWriteLocklockprivate Pathpathprivate DocumentReaderreaderprivate AtomicBooleanrunningprivate static CharsetUTF8private DocumentWriterwriter-
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
Constructors Constructor Description FileDatabaseHistory()
-
Method Summary
All Methods Instance Methods Concrete 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.protected voidrecoverRecords(Consumer<HistoryRecord> records)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.protected voidstoreRecord(HistoryRecord record)StringtoString()-
Methods inherited from class io.debezium.relational.history.AbstractDatabaseHistory
initializeStorage, record, record, recover, skipUnparseableDdlStatements, storeOnlyCapturedTables
-
-
-
-
Field Detail
-
FILE_PATH
public static final Field FILE_PATH
-
ALL_FIELDS
public static Collection<Field> ALL_FIELDS
-
UTF8
private static final Charset UTF8
-
lock
private final FunctionalReadWriteLock lock
-
writer
private final DocumentWriter writer
-
reader
private final DocumentReader reader
-
running
private final AtomicBoolean running
-
path
private Path path
-
-
Method Detail
-
configure
public void configure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema)
Description copied from interface:DatabaseHistoryConfigure this instance.- Specified by:
configurein interfaceDatabaseHistory- Overrides:
configurein 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 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- Overrides:
startin classAbstractDatabaseHistory
-
storeRecord
protected void storeRecord(HistoryRecord record) throws DatabaseHistoryException
- Specified by:
storeRecordin classAbstractDatabaseHistory- Throws:
DatabaseHistoryException
-
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- Overrides:
stopin classAbstractDatabaseHistory
-
recoverRecords
protected void recoverRecords(Consumer<HistoryRecord> records)
- Specified by:
recoverRecordsin classAbstractDatabaseHistory
-
storageExists
public boolean storageExists()
Description copied from interface:DatabaseHistoryDetermines 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:DatabaseHistoryDetermines if the database history entity exists; i.e. the storage must have been initialized and the history must have been populated.
-
-