public class VLSNIndex extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
VLSNIndex.BackwardVLSNScanner
Assumes that VLSNs are scanned backwards.
|
static class |
VLSNIndex.ForwardVLSNScanner
Scans VLSNs in a forward direction, used by feeders.
|
static class |
VLSNIndex.VLSNAwaitLatch
Associates the logItem with the latch, so that it's readily available
when the latch is released.
|
static class |
VLSNIndex.WaitTimeOutException |
| Modifier and Type | Field and Description |
|---|---|
static int |
AWAIT_CONSISTENCY_MS |
| Constructor and Description |
|---|
VLSNIndex(EnvironmentImpl envImpl,
String mappingDbName,
NameIdPair nameIdPair,
int vlsnStride,
int vlsnMaxMappings,
int vlsnMaxDistance,
RecoveryInfo recoveryInfo)
The mapping db's name is passed in as a parameter instead of the more
intuitive approach of defining it within the class to facilitate unit
testing of the VLSNIndex.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abnormalClose() |
void |
awaitConsistency()
Ensure that the in-memory vlsn index encompasses all logged entries
before it is flushed to disk.
|
VLSN |
bump() |
void |
close() |
void |
close(boolean doFlush) |
Map<VLSN,Long> |
dumpDb(boolean display)
For debugging and unit tests
|
void |
flushToDatabase(Durability useDurability)
Mappings are flushed to disk at close, and at checkpoints.
|
DatabaseImpl |
getDatabaseImpl()
For unit testing.
|
VLSNBucket |
getGTEBucket(VLSN vlsn,
VLSNBucket currentBucketInUse)
Get the vlsnBucket that owns this VLSN.
|
long |
getGTEFileNumber(VLSN vlsn)
The caller must ensure that the requested VLSN is within the VLSNIndex
range; we assume that there is a valid bucket.
|
long |
getGTELsn(VLSN vlsn)
The requested VLSN must be within the VLSNIndex range; we assume that
there is a valid bucket.
|
long |
getLatestAllocatedVal() |
VLSNBucket |
getLTEBucketFromDatabase(VLSN vlsn) |
long |
getLTEFileNumber(VLSN vlsn)
Return the nearest file number <= the log file that houses
this VLSN.
|
long |
getProtectedRangeStartFile()
Returns the file at the lower bound of the current range.
|
VLSNRange |
getRange()
All range points (first, last, etc) ought to be seen as one consistent
group.
|
StatGroup |
getStats(StatsConfig config)
Returns the statistics associated with the VLSNIndex
|
void |
initAsMaster()
Initialize before this node begins working as a master.
|
void |
initAsReplica()
Initialize before this node begins working as a replica after being
a master.
|
boolean |
isFlushedToDisk() |
FileProtector.ProtectedFileSet |
protectRangeHead(String lockerName)
Prevents truncation of the head of the index range (the lower bound).
|
void |
put(LogItem logItem) |
void |
setReplicaLatestVLSNSeq(long seq) |
void |
truncateFromHead(VLSN deleteEnd,
long deleteFileNum)
Forcibly truncate the VLSNIndex range head, in situations where the
environment is quiescent and we know that truncation is safe.
|
void |
truncateFromTail(VLSN deleteStart,
long lastLsn)
Remove all information from the VLSNIndex for VLSNs >=
deleteStart Used by replica side syncup, when the log is
truncated.
|
boolean |
tryTruncateFromHead(long bytesNeeded)
Try to advance the VLSNIndex ProtectedFileRange and truncate the head
of the VLSNIndex range, so that bytesNeeded can be freed by deleting
files in this range.
|
boolean |
tryTruncateFromHead(VLSN deleteEnd,
long deleteFileNum)
Like
tryTruncateFromHead(long) but allows specifying a
specific {deleteEnd, deleteFileNum}. |
boolean |
verify(boolean verbose) |
static void |
verifyDb(Environment env,
PrintStream out,
boolean verbose)
For DbStreamVerify utility.
|
LogItem |
waitForVLSN(VLSN vlsn,
int waitTime)
Wait for the vlsn, or a higher numbered vlsn, to make its appearance in
the VLSN index.
|
public VLSNIndex(EnvironmentImpl envImpl, String mappingDbName, NameIdPair nameIdPair, int vlsnStride, int vlsnMaxMappings, int vlsnMaxDistance, RecoveryInfo recoveryInfo) throws DatabaseException
DatabaseExceptionpublic void initAsMaster()
Reset the vlsnIndex so the VLSN sequence corresponds to what this node thinks is the next VLSN.
public void initAsReplica()
public VLSN bump()
public long getLatestAllocatedVal()
public void setReplicaLatestVLSNSeq(long seq)
public void put(LogItem logItem)
public LogItem waitForVLSN(VLSN vlsn, int waitTime) throws InterruptedException, VLSNIndex.WaitTimeOutException
InterruptedExceptionVLSNIndex.WaitTimeOutException - if the VLSN did not appear within waitTime
or the latch was explicitly terminated.public FileProtector.ProtectedFileSet protectRangeHead(String lockerName)
FileProtector.removeFileProtection(com.sleepycat.je.cleaner.FileProtector.ProtectedFileSet) will allow
the head of the range to change and files to be deleted.
It is important that a syncup does not synchronize on VLSNIndex, since this could block waiting for an expensive operation such as truncation. The synchronization for protecting the range head is therefore on VLSNTracker.
lockerName - the name of the protecting entity, i.e., the syncup,
to be used in LogSizeStats.public long getProtectedRangeStartFile()
public boolean tryTruncateFromHead(long bytesNeeded)
public boolean tryTruncateFromHead(VLSN deleteEnd, long deleteFileNum)
tryTruncateFromHead(long) but allows specifying a
specific {deleteEnd, deleteFileNum}.public void truncateFromHead(VLSN deleteEnd, long deleteFileNum)
deleteEnd - the last VLSN to be truncated.deleteFileNum - the file having deleteEnd as its last VLSN.public void truncateFromTail(VLSN deleteStart, long lastLsn) throws DatabaseException
DatabaseExceptionpublic VLSNRange getRange()
public StatGroup getStats(StatsConfig config)
public long getLTEFileNumber(VLSN vlsn) throws DatabaseException
DatabaseExceptionpublic long getGTEFileNumber(VLSN vlsn) throws DatabaseException
DatabaseExceptionpublic long getGTELsn(VLSN vlsn)
public VLSNBucket getGTEBucket(VLSN vlsn, VLSNBucket currentBucketInUse) throws DatabaseException
currentBucketInUse - is used only for debugging, to add to the
error message if the GTEBucketFromDatabase fails.DatabaseExceptionpublic VLSNBucket getLTEBucketFromDatabase(VLSN vlsn) throws DatabaseException
DatabaseExceptionpublic void close()
public void abnormalClose()
public void close(boolean doFlush)
throws DatabaseException
DatabaseExceptionpublic DatabaseImpl getDatabaseImpl()
public void flushToDatabase(Durability useDurability)
public Map<VLSN,Long> dumpDb(boolean display)
DatabaseExceptionpublic static void verifyDb(Environment env, PrintStream out, boolean verbose) throws DatabaseException
DatabaseExceptionpublic boolean verify(boolean verbose)
throws DatabaseException
DatabaseExceptionpublic boolean isFlushedToDisk()
public void awaitConsistency()
Copyright © 2024. All rights reserved.