Package org.rocksdb
Interface WalFilter
-
- All Known Implementing Classes:
AbstractWalFilter
public interface WalFilterWALFilter allows an application to inspect write-ahead-log (WAL) records or modify their processing on recovery.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWalFilter.LogRecordFoundResult
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcolumnFamilyLogNumberMap(java.util.Map<java.lang.Integer,java.lang.Long> cfLognumber, java.util.Map<java.lang.String,java.lang.Integer> cfNameId)Provide ColumnFamily->LogNumber map to filter so that filter can determine whether a log number applies to a given column family (i.e.WalFilter.LogRecordFoundResultlogRecordFound(long logNumber, java.lang.String logFileName, WriteBatch batch, WriteBatch newBatch)LogRecord is invoked for each log record encountered for all the logs during replay on logs on recovery.java.lang.Stringname()Returns a name that identifies this WAL filter.
-
-
-
Method Detail
-
columnFamilyLogNumberMap
void columnFamilyLogNumberMap(java.util.Map<java.lang.Integer,java.lang.Long> cfLognumber, java.util.Map<java.lang.String,java.lang.Integer> cfNameId)Provide ColumnFamily->LogNumber map to filter so that filter can determine whether a log number applies to a given column family (i.e. that log hasn't been flushed to SST already for the column family). We also pass in name>id map as only name is known during recovery (as handles are opened post-recovery). while write batch callbacks happen in terms of column family id.- Parameters:
cfLognumber- column_family_id to lognumber mapcfNameId- column_family_name to column_family_id map
-
logRecordFound
WalFilter.LogRecordFoundResult logRecordFound(long logNumber, java.lang.String logFileName, WriteBatch batch, WriteBatch newBatch)
LogRecord is invoked for each log record encountered for all the logs during replay on logs on recovery. This method can be used to: * inspect the record (using the batch parameter) * ignoring current record (by returning WalProcessingOption::kIgnoreCurrentRecord) * reporting corrupted record (by returning WalProcessingOption::kCorruptedRecord) * stop log replay (by returning kStop replay) - please note that this implies discarding the logs from current record onwards.- Parameters:
logNumber- log number of the current log. Filter might use this to determine if the log record is applicable to a certain column family.logFileName- log file name - only for informational purposesbatch- batch encountered in the log during recoverynewBatch- new batch to populate if filter wants to change the batch (for example to filter some records out, or alter some records). Please note that the new batch MUST NOT contain more records than original, else recovery would be failed.- Returns:
- Processing option for the current record.
-
name
java.lang.String name()
Returns a name that identifies this WAL filter. The name will be printed to LOG file on start up for diagnosis.- Returns:
- the name
-
-