public class FilePageStoreManager extends GridCacheSharedManagerAdapter implements IgnitePageStoreManager
| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_DATA_FILENAME |
static String |
CACHE_DIR_PREFIX |
static String |
CACHE_GRP_DIR_PREFIX |
static String |
FILE_SUFFIX
File suffix.
|
static String |
INDEX_FILE_NAME |
static String |
PART_FILE_PREFIX
Partition file prefix.
|
static String |
PART_FILE_TEMPLATE |
cctx, diagnosticLog, log| Constructor and Description |
|---|
FilePageStoreManager(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
long |
allocatePage(int grpId,
int partId,
byte flags)
Allocates a page for the given page space.
|
void |
beginRecover()
Invoked before starting checkpoint recover.
|
File |
cacheWorkDir(CacheConfiguration ccfg) |
void |
ensure(int grpId,
int partId) |
boolean |
exists(int grpId,
int partId)
Checks if partition store exists.
|
void |
finishRecover()
Invoked after checkpoint recover is finished.
|
PageStore |
getStore(int grpId,
int partId) |
boolean |
hasIndexStore(int grpId) |
void |
initializeForCache(CacheGroupDescriptor grpDesc,
StoredCacheData cacheData)
Callback called when a cache is starting.
|
long |
metaPageId(int grpId)
Gets meta page ID for specified cache.
|
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
onPartitionCreated(int grpId,
int partId)
Callback called when a partition is created on the local node.
|
void |
onPartitionDestroyed(int grpId,
int partId,
int tag)
Callback called when a partition for the given cache is evicted from the local node.
|
long |
pageOffset(int grpId,
long pageId)
Gets page offset within the page store file.
|
int |
pages(int grpId,
int partId)
Gets total number of allocated pages for the given space.
|
void |
read(int grpId,
long pageId,
ByteBuffer pageBuf)
Reads a page for the given cache ID.
|
void |
read(int cacheId,
long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
Will preserve crc in buffer if keepCrc is true.
|
Map<String,StoredCacheData> |
readCacheConfigurations() |
void |
readHeader(int grpId,
int partId,
ByteBuffer buf)
Reads a header of a page store.
|
void |
shutdownForCacheGroup(CacheGroupContext grp,
boolean destroy)
Callback called when a cache is stopping.
|
void |
start0() |
void |
stop0(boolean cancel) |
void |
storeCacheData(StoredCacheData cacheData) |
void |
sync(int grpId,
int partId)
Makes sure that all previous writes to the store has been written to disk.
|
File |
workDir() |
void |
write(int grpId,
long pageId,
ByteBuffer pageBuf,
int tag)
Writes the page for the given cache ID.
|
PageStore |
writeInternal(int cacheId,
long pageId,
ByteBuffer pageBuf,
int tag) |
context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonDisconnected, onKernalStop, printMemoryStats, start, stoppublic static final String FILE_SUFFIX
public static final String PART_FILE_PREFIX
public static final String INDEX_FILE_NAME
public static final String PART_FILE_TEMPLATE
public static final String CACHE_DIR_PREFIX
public static final String CACHE_GRP_DIR_PREFIX
public static final String CACHE_DATA_FILENAME
public FilePageStoreManager(GridKernalContext ctx)
ctx - Kernal context.public void start0()
throws IgniteCheckedException
start0 in class GridCacheSharedManagerAdapterIgniteCheckedException - If failed.public void stop0(boolean cancel)
stop0 in class GridCacheSharedManagerAdaptercancel - Cancel flag.public void onActivate(GridKernalContext kctx) throws IgniteCheckedException
onActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.IgniteCheckedException - If failed.public void onDeActivate(GridKernalContext kctx)
onDeActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.public void beginRecover()
beginRecover in interface IgnitePageStoreManagerpublic void finishRecover()
finishRecover in interface IgnitePageStoreManagerpublic void initializeForCache(CacheGroupDescriptor grpDesc, StoredCacheData cacheData) throws IgniteCheckedException
initializeForCache in interface IgnitePageStoreManagergrpDesc - Cache group descriptor.cacheData - Cache data of the cache being started.IgniteCheckedException - If failed to handle cache start callback.public void storeCacheData(StoredCacheData cacheData) throws IgniteCheckedException
storeCacheData in interface IgnitePageStoreManagercacheData - Cache configuration.IgniteCheckedException - If failed.public void shutdownForCacheGroup(CacheGroupContext grp, boolean destroy) throws IgniteCheckedException
shutdownForCacheGroup in interface IgnitePageStoreManagergrp - Cache group being stopped.destroy - Flag indicating if the cache is being destroyed and data should be cleaned.IgniteCheckedException - If failed to handle cache destroy callback.public void onPartitionCreated(int grpId,
int partId)
throws IgniteCheckedException
onPartitionCreated in interface IgnitePageStoreManagergrpId - Cache group ID where the partition is being created.partId - ID of the partition being created.IgniteCheckedException - If failed to handle partition create callback.public void onPartitionDestroyed(int grpId,
int partId,
int tag)
throws IgniteCheckedException
onPartitionDestroyed in interface IgnitePageStoreManagergrpId - Cache group ID of the evicted partition.partId - Partition ID.tag - Partition tag (growing 1-based partition file version).IgniteCheckedException - If failed to handle partition destroy callback.public void read(int grpId,
long pageId,
ByteBuffer pageBuf)
throws IgniteCheckedException
0 if the page is a meta page.read in interface IgnitePageStoreManagergrpId - Cache group ID.pageId - PageID to read.pageBuf - Page buffer to write to.IgniteCheckedException - If failed to read the page.public void read(int cacheId,
long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
throws IgniteCheckedException
cacheId - Cache ID.pageId - Page ID.pageBuf - Page buffer.keepCrc - Keep CRC flag.IgniteCheckedException - If failed.public boolean exists(int grpId,
int partId)
throws IgniteCheckedException
exists in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID.True if partition store exists.IgniteCheckedException - If failed.public void readHeader(int grpId,
int partId,
ByteBuffer buf)
throws IgniteCheckedException
readHeader in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID.buf - Buffer to write to.IgniteCheckedException - If failed.public void write(int grpId,
long pageId,
ByteBuffer pageBuf,
int tag)
throws IgniteCheckedException
0 if the page is a meta page.write in interface IgnitePageStoreManagergrpId - Cache group ID.pageId - Page ID.pageBuf - Page buffer to write.IgniteCheckedException - If failed to write page.public long pageOffset(int grpId,
long pageId)
throws IgniteCheckedException
pageOffset in interface IgnitePageStoreManagergrpId - Cache group ID.pageId - Page ID.IgniteCheckedException - If failed.public PageStore writeInternal(int cacheId, long pageId, ByteBuffer pageBuf, int tag) throws IgniteCheckedException
cacheId - Cache ID to write.pageId - Page ID.pageBuf - Page buffer.tag - Partition tag (growing 1-based partition file version). Used to validate page is not outdatedIgniteCheckedException - If IO error occurred.public void sync(int grpId,
int partId)
throws IgniteCheckedException
sync in interface IgnitePageStoreManagergrpId - Cache group ID to sync.partId - Partition ID to sync.IgniteCheckedException - If IO error occurred while running sync.public void ensure(int grpId,
int partId)
throws IgniteCheckedException
ensure in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID.IgniteCheckedException - If failed.public long allocatePage(int grpId,
int partId,
byte flags)
throws IgniteCheckedException
allocatePage in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID. Used only if flags is equal to PageIdAllocator.FLAG_DATA.flags - Page allocation flags.IgniteCheckedException - If IO exception occurred while allocating a page ID.public long metaPageId(int grpId)
metaPageId in interface IgnitePageStoreManagergrpId - Cache group ID.public int pages(int grpId,
int partId)
throws IgniteCheckedException
pages in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID.IgniteCheckedException - If failed.public Map<String,StoredCacheData> readCacheConfigurations() throws IgniteCheckedException
readCacheConfigurations in interface IgnitePageStoreManagerIgniteCheckedException - If failed.public boolean hasIndexStore(int grpId)
hasIndexStore in interface IgnitePageStoreManagergrpId - Cache group ID.True if index store for given cache group existed before node started.public File workDir()
public File cacheWorkDir(CacheConfiguration ccfg)
ccfg - Cache configuration.public PageStore getStore(int grpId, int partId) throws IgniteCheckedException
grpId - Cache group ID.partId - Partition ID.IgniteCheckedException - If cache or partition with the given ID was not created.
Note: visible for testing.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.2.0 Release Date : September 15 2017