com.sleepycat.je.rep.stream
Class ReplicaSyncupReader
java.lang.Object
com.sleepycat.je.log.FileReader
com.sleepycat.je.rep.stream.VLSNReader
com.sleepycat.je.rep.stream.ReplicaSyncupReader
public class ReplicaSyncupReader
- extends VLSNReader
The ReplicaSyncupReader scans the log backwards for requested log entries.
The reader must track whether it has passed a checkpoint, and therefore
can not used the vlsn index to skip over entries.
The ReplicaSyncupReader is not thread safe, and can only be used
serially. It will stop at the finishLsn, which should be set using the
GlobalCBVLSN.
Fields inherited from class com.sleepycat.je.log.FileReader |
cksumValidator, currentEntryHeader, currentEntryOffset, currentEntryPrevOffset, envImpl, eof, fileManager, forward, nextEntryOffset, startLsn, window |
Method Summary |
OutputWireRecord |
findPrevSyncEntry()
Backward scanning for finding an earlier candidate syncup matchpoint. |
protected boolean |
isTargetEntry()
Return true for ckpt entries, for syncable entries, and if we're in
specific vlsn scan mode, any replicated entry. |
protected boolean |
processEntry(ByteBuffer entryBuffer)
ProcessEntry does additional filtering before deciding whether to
return an entry as a candidate for matching. |
OutputWireRecord |
scanBackwards(VLSN vlsn)
Backward scanning for the replica's part in syncup. |
Methods inherited from class com.sleepycat.je.log.FileReader |
entryIsReplicated, getAndResetNReads, getLastEntrySize, getLastLsn, getNRepeatIteratorReads, getNumRead, initStartingPosition, makeWindow, readNextEntry, readNextEntryAllowExceptions, resyncReader, setAlwaysValidateChecksum, setBackwardPosition, setForwardPosition |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReplicaSyncupReader
public ReplicaSyncupReader(EnvironmentImpl envImpl,
VLSNIndex vlsnIndex,
long endOfLogLsn,
int readBufferSize,
NameIdPair nameIdPair,
VLSN startVLSN,
long finishLsn,
MatchpointSearchResults searchResults)
throws IOException,
DatabaseException
- Throws:
IOException
DatabaseException
scanBackwards
public OutputWireRecord scanBackwards(VLSN vlsn)
throws DatabaseException
- Backward scanning for the replica's part in syncup.
- Throws:
DatabaseException
findPrevSyncEntry
public OutputWireRecord findPrevSyncEntry()
throws DatabaseException
- Backward scanning for finding an earlier candidate syncup matchpoint.
- Throws:
DatabaseException
isTargetEntry
protected boolean isTargetEntry()
throws DatabaseException
- Return true for ckpt entries, for syncable entries, and if we're in
specific vlsn scan mode, any replicated entry. There is an additional
level of filtering in processEntry.
- Overrides:
isTargetEntry
in class FileReader
- Returns:
- true if this reader should process this entry, or just
skip over it.
- Throws:
DatabaseException
- from subclasses.
processEntry
protected boolean processEntry(ByteBuffer entryBuffer)
- ProcessEntry does additional filtering before deciding whether to
return an entry as a candidate for matching.
If this is a record we are submitting as a matchpoint candidate,
instantiate a WireRecord to house this log entry. If this is a
non-replicated entry or a txn end that follows the candidate matchpoint,
record whatever status we need to, but don't use it for comparisons.
For example, suppose the log is like this:f
VLSN entry
10 LN
11 commit
12 LN
-- ckpt end
13 commit
14 abort
And that the master only has VLSNs 1-12. The replica will suggest vlsn
14 as the first matchpoint. The feeder will counter with a suggestion
of vlsn 11, since it doe not have vlsn 14.
At that point, the ReplicaSyncupReader will scan backwards in the log,
looking for vlsn 11. Although the reader should only return an entry
when it gets to vlsn 11. the reader must process commits and ckpts that
follow 11, so that they can be recorded in the searchResults, so the
number of rolled back commits can be accurately reported.
- Overrides:
processEntry
in class VLSNReader
- Parameters:
entryBuffer
- contains the entry data and is positioned at the
data
- Returns:
- true if this entry should be returned
Copyright (c) 2004-2010 Oracle. All rights reserved.