Interface PageMemoryEx
-
- All Superinterfaces:
PageIdAllocator,PageMemory,PageSupport
- All Known Implementing Classes:
PageMemoryImpl
public interface PageMemoryEx extends PageMemory
Page memory with some persistence related additions.
-
-
Field Summary
-
Fields inherited from interface org.apache.ignite.internal.pagemem.PageIdAllocator
FLAG_AUX, FLAG_DATA, FLAG_IDX, INDEX_PARTITION, MAX_PARTITION_ID, META_PAGE_ID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longacquirePage(int grpId, long pageId, AtomicBoolean pageAllocated)longacquirePage(int grpId, long pageId, IoStatisticsHolder statHldr, boolean restore)GridMultiCollectionWrapper<FullPageId>beginCheckpoint(IgniteInternalFuture allowToReplace)Gets a collection of dirty page IDs since the last checkpoint.voidcheckpointWritePage(FullPageId pageId, ByteBuffer buf, PageStoreWriter pageWriter, CheckpointMetricsTracker tracker)Prepare page for write during checkpoint.IgniteInternalFuture<Void>clearAsync(LoadedPagesMap.KeyPredicate pred, boolean cleanDirty)Asynchronously clears pages satisfying the given predicate.voidfinishCheckpoint()Finishes checkpoint operation.intinvalidate(int grpId, int partId)Marks partition as invalid / outdated.booleanisCpBufferOverflowThresholdExceeded()Checks if the Checkpoint Buffer is currently close to exhaustion.voidonCacheGroupDestroyed(int grpId)Clears internal metadata of destroyed cache group.PageReadWriteManagerpageManager()longpartitionMetaPageId(int grpId, int partId)Gets partition metadata page for specified grpId and partId.FullPageIdpullPageFromCpBuffer()Pull page from checkpoint buffer.longreadLock(long absPtr, long pageId, boolean force, boolean touch)booleansafeToUpdate()Heuristic method which allows a thread to check if it safe to start memory struture modifications in regard with checkpointing.longtotalPages()Total pages can be placed to memory.longwriteLock(int grpId, long pageId, long page, boolean restore)voidwriteUnlock(int grpId, long pageId, long page, Boolean walPlc, boolean dirtyFlag, boolean restore)-
Methods inherited from interface org.apache.ignite.internal.pagemem.PageIdAllocator
allocatePage, freePage
-
Methods inherited from interface org.apache.ignite.internal.pagemem.PageMemory
checkpointBufferPagesCount, loadedPages, metrics, pageBuffer, pageSize, realPageSize, start, stop, systemPageSize
-
Methods inherited from interface org.apache.ignite.internal.pagemem.PageSupport
acquirePage, acquirePage, isDirty, readLock, readLockForce, readUnlock, releasePage, tryWriteLock, writeLock, writeUnlock
-
-
-
-
Method Detail
-
readLock
long readLock(long absPtr, long pageId, boolean force, boolean touch)- Parameters:
absPtr- Absolute pointer to read lock.pageId- Page ID.force- Force flag.touch- Update page timestamp.- Returns:
- Pointer to the page read buffer.
-
writeLock
long writeLock(int grpId, long pageId, long page, boolean restore)- Parameters:
grpId- Group ID.pageId- Page ID.page- Page pointer.restore- Determines if the page is locked for restore memory (crash recovery).- Returns:
- ByteBuffer for modifying the page.
-
writeUnlock
void writeUnlock(int grpId, long pageId, long page, Boolean walPlc, boolean dirtyFlag, boolean restore)- Parameters:
grpId- Group ID.pageId- Page ID.page- Page pointer.walPlc-Trueif page should be recorded to WAL,falseif the page must not be recorded andnullfor the default behavior.dirtyFlag- Determines whether the page was modified since the last checkpoint.restore- Determines if the page is locked for restore.
-
partitionMetaPageId
long partitionMetaPageId(int grpId, int partId)Gets partition metadata page for specified grpId and partId.- Parameters:
grpId- Group ID.partId- Partition ID.- Returns:
- Meta page for grpId and partId.
-
acquirePage
long acquirePage(int grpId, long pageId, AtomicBoolean pageAllocated) throws IgniteCheckedException- Parameters:
grpId- Cache group ID.pageId- Page ID.pageAllocated- Flag is set if new page was allocated in offheap memory.- Returns:
- Page.
- Throws:
IgniteCheckedException- See Also:
Sets additional flag indicating that page was not found in memory and had to be allocated.
-
acquirePage
long acquirePage(int grpId, long pageId, IoStatisticsHolder statHldr, boolean restore) throws IgniteCheckedException- Parameters:
grpId- Cache group ID.pageId- Page id.restore- Get page for restore- Returns:
- Page.
- Throws:
IgniteCheckedException- If failed.StorageException- If page reading failed from storage.- See Also:
Will read page from file if it is not present in memory
-
safeToUpdate
boolean safeToUpdate()
Heuristic method which allows a thread to check if it safe to start memory struture modifications in regard with checkpointing. May return false-negative result during or after partition eviction.- Returns:
Falseif there are too many dirty pages and a thread should wait for a checkpoint to begin.
-
beginCheckpoint
GridMultiCollectionWrapper<FullPageId> beginCheckpoint(IgniteInternalFuture allowToReplace) throws IgniteException
Gets a collection of dirty page IDs since the last checkpoint. If a dirty page is being written after the checkpointing operation begun, the modifications will be written to a temporary buffer which will be flushed to the main memory after the checkpointing finished. This method must be called when no concurrent operations on pages are performed.- Parameters:
allowToReplace- The sign which allows to replace pages from a checkpoint by page replacer.- Returns:
- Collection of dirty page IDs.
- Throws:
IgniteException- If checkpoint has been already started and was not finished.
-
finishCheckpoint
void finishCheckpoint()
Finishes checkpoint operation.
-
checkpointWritePage
void checkpointWritePage(FullPageId pageId, ByteBuffer buf, PageStoreWriter pageWriter, CheckpointMetricsTracker tracker) throws IgniteCheckedException
Prepare page for write during checkpoint.PageStoreWriterwill be called when the page will be ready to write.- Parameters:
pageId- Page ID to get byte buffer for. The page ID must be present in the collection returned by thebeginCheckpoint(IgniteInternalFuture)method call.buf- Temporary buffer to write changes into.pageWriter- Checkpoint page write context.tracker- Checkpoint metrics tracker.- Throws:
IgniteCheckedException- If failed to obtain page data.
-
pageManager
PageReadWriteManager pageManager()
-
invalidate
int invalidate(int grpId, int partId)Marks partition as invalid / outdated.- Parameters:
grpId- Group ID.partId- Partition ID.- Returns:
- New partition generation (growing 1-based partition file version).
-
onCacheGroupDestroyed
void onCacheGroupDestroyed(int grpId)
Clears internal metadata of destroyed cache group.- Parameters:
grpId- Cache group ID.
-
clearAsync
IgniteInternalFuture<Void> clearAsync(LoadedPagesMap.KeyPredicate pred, boolean cleanDirty)
Asynchronously clears pages satisfying the given predicate.- Parameters:
pred- Predicate for cache group id, pageId.cleanDirty- Flag indicating that dirty pages collection should be cleaned.- Returns:
- Future that will be completed when all pages are cleared.
-
pullPageFromCpBuffer
FullPageId pullPageFromCpBuffer()
Pull page from checkpoint buffer.
-
isCpBufferOverflowThresholdExceeded
boolean isCpBufferOverflowThresholdExceeded()
Checks if the Checkpoint Buffer is currently close to exhaustion.- Returns:
trueif measures like throttling to protect Checkpoint Buffer should be applied, andfalseotherwise.
-
totalPages
long totalPages()
Total pages can be placed to memory.
-
-