public class ExpirationTracker extends Object
A copy-on-write approach is used to store a file number-to-counter mapping, and AtomicIntegers are used for the counters. This avoids blocking when tracking information for the current end-of-log file. That way, the end-of-log tracker can be used by multiple threads without holding a global mutex. This tracker is maintained by the LogManager and a new tracker is created for each file, and then flushed to disk when starting a new file as a FileExpirationLN.
An ExpirationTracker instance is used to track expired data when performing the first pass of two pass cleaning, although in that case it is only used by one thread, so the optimizations are irrelevant.
The serialize()} method is called to represent the histogram in a
single byte array. This array is the record "data" in a FileExpirationLN.
It is also stored in memory, in the UtilizationProfile, and used during
cleaning to calculate the number of expired bytes per file.
| Constructor and Description |
|---|
ExpirationTracker(long fileNum) |
| Modifier and Type | Method and Description |
|---|---|
int |
getExpiredBytes(long time)
Computes the current expired bytes for the given time.
|
long |
getFileNum() |
void |
incrementPendingTrackCalls()
Increment the number of calls to
track(int, boolean, int)
that must be made before the tracked data can be flushed to its
database. |
String |
toString() |
static String |
toString(byte[] serializedForm) |
void |
track(LogEntry entry,
int size)
Tracks expiration of a BIN or LN.
|
public long getFileNum()
public void track(LogEntry entry, int size)
entry - is the LogEntry that was just logged. INs and LNs will be
processed here, and must be protected by their parent latch.size - byte size of logged entry.public void incrementPendingTrackCalls()
track(int, boolean, int)
that must be made before the tracked data can be flushed to its
database.public int getExpiredBytes(long time)
public static String toString(byte[] serializedForm)
Copyright © 2024. All rights reserved.