Package org.apache.solr.update
Class CdcrTransactionLog
- java.lang.Object
-
- org.apache.solr.update.TransactionLog
-
- org.apache.solr.update.CdcrTransactionLog
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class CdcrTransactionLog extends TransactionLog
ExtendsTransactionLogto:- reopen automatically the output stream if its reference count reached 0. This is achieved by extending
methods
incref(),close()andreopenOutputStream(). - encode the number of records in the tlog file in the last commit record. The number of records will be
decoded and reuse if the tlog file is reopened. This is achieved by extending the constructor, and the
methods
writeCommit(CommitUpdateCommand)andgetReader(long).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCdcrTransactionLog.CdcrLogReader-
Nested classes/interfaces inherited from class org.apache.solr.update.TransactionLog
TransactionLog.FSReverseReader, TransactionLog.LogCodec, TransactionLog.LogReader, TransactionLog.ReverseReader, TransactionLog.SortedLogReader
-
-
Field Summary
-
Fields inherited from class org.apache.solr.update.TransactionLog
deleteOnClose, END_MESSAGE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()TransactionLog.LogReadergetReader(long startingPos)Returns a reader that can be used while a log is still in use.voidincref()intnumRecords()Returns the number of records in the log (currently includes the header and an optional commit).booleantry_incref()Modified to act likeincref()in order to be compatible withUpdateLog.recoverFromLog().longwrite(AddUpdateCommand cmd, long prevPointer)Writes an add update command to the transaction log.longwriteCommit(CommitUpdateCommand cmd)longwriteDelete(DeleteUpdateCommand cmd)longwriteDeleteByQuery(DeleteUpdateCommand cmd)-
Methods inherited from class org.apache.solr.update.TransactionLog
addGlobalStrings, checkWriteHeader, closeOutput, decref, endRecord, endsWithCommit, finish, forceClose, getLogSize, getLogSizeFromStream, getReverseReader, getSortedReader, lookup, position, toString, write, writeData, writeLogHeader
-
-
-
-
Method Detail
-
numRecords
public int numRecords()
Returns the number of records in the log (currently includes the header and an optional commit).- Overrides:
numRecordsin classTransactionLog
-
write
public long write(AddUpdateCommand cmd, long prevPointer)
Description copied from class:TransactionLogWrites an add update command to the transaction log. This should be called only for writing in-place updates, or else pass -1 as the prevPointer.- Overrides:
writein classTransactionLog- Parameters:
cmd- The add update command to be writtenprevPointer- The pointer in the transaction log which this update depends on (applicable for in-place updates)- Returns:
- Returns the position pointer of the written update command
-
writeDelete
public long writeDelete(DeleteUpdateCommand cmd)
- Overrides:
writeDeletein classTransactionLog
-
writeDeleteByQuery
public long writeDeleteByQuery(DeleteUpdateCommand cmd)
- Overrides:
writeDeleteByQueryin classTransactionLog
-
writeCommit
public long writeCommit(CommitUpdateCommand cmd)
- Overrides:
writeCommitin classTransactionLog
-
getReader
public TransactionLog.LogReader getReader(long startingPos)
Returns a reader that can be used while a log is still in use. Currently only *one* LogReader may be outstanding, and that log may only be used from a single thread.- Overrides:
getReaderin classTransactionLog
-
incref
public void incref()
- Overrides:
increfin classTransactionLog
-
try_incref
public boolean try_incref()
Modified to act likeincref()in order to be compatible withUpdateLog.recoverFromLog(). Otherwise, we would have to duplicate the methodUpdateLog.recoverFromLog()inCdcrUpdateLogand change the callif (!ll.try_incref()) continue;toincref();.- Overrides:
try_increfin classTransactionLog
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classTransactionLog
-
-