public class SegmentAware extends Object
| Constructor and Description |
|---|
SegmentAware(int walSegmentsCnt,
boolean compactionEnabled,
IgniteLogger log)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCurrentWalArchiveSize(long size)
Adding current WAL archive size in bytes.
|
void |
addReservedWalArchiveSize(long size)
Adding reserved WAL archive size in bytes.
|
long |
awaitAvailableTruncateArchive()
Waiting for segment truncation to be available.
|
void |
awaitExceedMaxArchiveSize(long max)
Waiting for exceeding the maximum WAL archive size.
|
void |
awaitSegment(long absSegIdx)
Waiting until current WAL index will be greater or equal than given one.
|
void |
awaitSegmentArchived(long awaitIdx)
Method will wait activation of particular WAL segment index.
|
long |
curAbsWalIdx() |
void |
curAbsWalIdx(long curAbsWalIdx)
Update current WAL index.
|
void |
forceInterrupt()
Interrupt waiting on related objects.
|
void |
interrupt()
Interrupt waiting on related objects.
|
long |
lastArchivedAbsoluteIndex() |
void |
lastCheckpointIdx(long absIdx)
Update segment of last completed checkpoint.
|
long |
lastCompressedIdx() |
long |
lastTruncatedArchiveIdx()
Getting last truncated segment.
|
void |
lastTruncatedArchiveIdx(long absIdx)
Update last truncated segment.
|
boolean |
lock(long absIdx)
Segment lock.
|
boolean |
locked(long absIdx)
Check if WAL segment locked (protected from move to archive).
|
void |
markAsMovedToArchive(long toArchive)
Mark segment as moved to archive under lock.
|
boolean |
minLockIndex(long absIdx)
Increasing minimum segment index after that can be locked.
|
boolean |
minReserveIndex(long absIdx)
Increasing minimum segment index after that can be reserved.
|
long |
nextAbsoluteSegmentIndex()
Calculate next segment index or wait if needed.
|
void |
onSegmentCompressed(long compressedIdx)
Callback after segment compression finish.
|
void |
release(long absIdx) |
boolean |
reserve(long absIdx)
Segment reservation.
|
boolean |
reserved(long absIdx)
Checks if segment is currently reserved (protected from deletion during WAL cleanup).
|
void |
reset()
Reset interrupted flag.
|
void |
resetWalArchiveSizes()
Reset the current and reserved WAL archive sizes.
|
void |
setLastArchivedAbsoluteIndex(long lastAbsArchivedIdx) |
void |
unlock(long absIdx) |
long |
waitNextSegmentForArchivation()
Waiting until archivation of next segment will be allowed.
|
long |
waitNextSegmentToCompress()
Pessimistically tries to reserve segment for compression in order to avoid concurrent truncation.
|
public SegmentAware(int walSegmentsCnt,
boolean compactionEnabled,
IgniteLogger log)
walSegmentsCnt - Total WAL segments count.compactionEnabled - Is wal compaction enabled.log - Logger.public void awaitSegment(long absSegIdx)
throws IgniteInterruptedCheckedException
absSegIdx - Target WAL index.IgniteInterruptedCheckedExceptionpublic long nextAbsoluteSegmentIndex()
throws IgniteInterruptedCheckedException
IgniteInterruptedCheckedExceptionpublic long curAbsWalIdx()
public long waitNextSegmentForArchivation()
throws IgniteInterruptedCheckedException
public void markAsMovedToArchive(long toArchive)
throws IgniteInterruptedCheckedException
toArchive - Segment which was should be moved to archive.IgniteInterruptedCheckedException - if interrupted during waiting.public void awaitSegmentArchived(long awaitIdx)
throws IgniteInterruptedCheckedException
awaitIdx - absolute index lastArchivedAbsoluteIndex() to become true.IgniteInterruptedCheckedException - if interrupted.public long waitNextSegmentToCompress()
throws IgniteInterruptedCheckedException
public void onSegmentCompressed(long compressedIdx)
compressedIdx - Index of compressed segment.public long lastCompressedIdx()
public void curAbsWalIdx(long curAbsWalIdx)
curAbsWalIdx - New current WAL index.public void lastTruncatedArchiveIdx(long absIdx)
absIdx - Absolut segment index.public long lastTruncatedArchiveIdx()
public void setLastArchivedAbsoluteIndex(long lastAbsArchivedIdx)
lastAbsArchivedIdx - New value of last archived segment index.public long lastArchivedAbsoluteIndex()
public boolean reserve(long absIdx)
> than
the minimum.absIdx - Index for reservation.True if the reservation was successful.public boolean reserved(long absIdx)
absIdx - Index for check reservation.True if index is reserved.public void release(long absIdx)
absIdx - Reserved index.public boolean locked(long absIdx)
absIdx - Index for check locking.True if index is locked.public boolean lock(long absIdx)
> than
the last archived.absIdx - Index to lock.True if the lock was successful.public void unlock(long absIdx)
absIdx - Index to unlock.public void reset()
public void interrupt()
public void forceInterrupt()
public boolean minReserveIndex(long absIdx)
absIdx - Absolut segment index.True if update is successful.public boolean minLockIndex(long absIdx)
absIdx - Absolut segment index.True if update is successful.public void addCurrentWalArchiveSize(long size)
size - Size in bytes.public void addReservedWalArchiveSize(long size)
size - Size in bytes.public void resetWalArchiveSizes()
public void awaitExceedMaxArchiveSize(long max)
throws IgniteInterruptedCheckedException
addCurrentWalArchiveSize(long) and addReservedWalArchiveSize(long).max - Maximum WAL archive size in bytes.IgniteInterruptedCheckedException - If it was interrupted.public void lastCheckpointIdx(long absIdx)
absIdx - Absolut segment index.public long awaitAvailableTruncateArchive()
throws IgniteInterruptedCheckedException
lastTruncatedArchiveIdx(long), lastCheckpointIdx(long), reserve(long) and
lastArchivedAbsoluteIndex() (to restart the node correctly) and is calculated as
lastTruncatedArchiveIdx - min(lastCheckpointIdx, reserve, lastArchivedAbsoluteIndex).IgniteInterruptedCheckedException - If it was interrupted.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021