public class FilePageStoreManager extends GridCacheSharedManagerAdapter implements IgnitePageStoreManager, PageStoreCollection
| Modifier and Type | Class and Description |
|---|---|
protected static class |
FilePageStoreManager.LongOperationAsyncExecutor
Synchronization wrapper for long operations that should be executed asynchronously
and operations that can not be executed in parallel with long operation.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_DATA_FILENAME |
static String |
CACHE_DATA_TMP_FILENAME |
static String |
CACHE_DIR_PREFIX |
static String |
CACHE_GRP_DIR_PREFIX |
static String |
CORRUPTED_DATA_FILES_MNTC_TASK_NAME
Unique name for corrupted data files maintenance task.
|
static Predicate<File> |
DATA_DIR_FILTER |
static String |
DFLT_STORE_DIR |
static String |
FILE_SUFFIX
File suffix.
|
static String |
INDEX_FILE_NAME |
static String |
INDEX_FILE_PREFIX |
static String |
PART_FILE_PREFIX
Partition file prefix.
|
static String |
PART_FILE_TEMPLATE |
static PathMatcher |
TMP_FILE_MATCHER
Matcher for searching of *.tmp files.
|
static String |
TMP_SUFFIX
Suffix for tmp files
|
static String |
ZIP_SUFFIX
Suffix for zip files
|
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.
|
static File[] |
cacheDataFiles(File root) |
static List<File> |
cacheDirectories(File dir,
Predicate<String> names) |
static File |
cacheDirectory(File dir,
int grpId) |
static String |
cacheDirName(boolean isSharedGroup,
String cacheOrGroupName) |
static String |
cacheDirName(CacheConfiguration<?,?> ccfg) |
String |
cacheDirName(int grpId) |
static String |
cacheGroupName(File dir) |
static List<File> |
cachePartitionFiles(File cacheDir) |
File |
cacheWorkDir(boolean isSharedGroup,
String cacheOrGroupName) |
File |
cacheWorkDir(CacheConfiguration<?,?> ccfg) |
static File |
cacheWorkDir(File storeWorkDir,
String cacheDirName) |
static boolean |
checkAndInitCacheWorkDir(File cacheWorkDir,
IgniteLogger log) |
void |
cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred,
boolean cleanFiles)
Cleanup cache store whether it matches the provided predicate and if matched
store was previously initizlized.
|
void |
cleanupPersistentSpace()
Cleanup persistent space for all caches except metastore.
|
void |
cleanupPersistentSpace(CacheConfiguration cacheConfiguration)
Cleanup persistent space for cache.
|
EncryptedFileIOFactory |
encryptedFileIoFactory(FileIOFactory plainFileIOFactory,
int cacheGrpId) |
EncryptedFileIOFactory |
encryptedFileIoFactory(FileIOFactory plainFileIOFactory,
int cacheGrpId,
EncryptionCacheKeyProvider encrKeyProvider) |
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.
|
FileVersionCheckingFactory |
getPageStoreFactory(int grpId,
boolean encrypted) |
FileVersionCheckingFactory |
getPageStoreFactory(int grpId,
EncryptionCacheKeyProvider encrKeyProvider) |
FileIOFactory |
getPageStoreFileIoFactory() |
static @NotNull File |
getPartitionFile(File workDir,
String cacheDirName,
int partId) |
static String |
getPartitionFileName(int partId) |
Path |
getPath(boolean isSharedGroup,
String cacheOrGroupName,
int partId) |
PageStore |
getStore(int grpId,
int partId) |
Collection<PageStore> |
getStores(int grpId) |
boolean |
hasIndexStore(int grpId) |
void |
initialize(int cacheId,
int partitions,
String cacheName,
PageMetrics pageMetrics)
Initializes disk store structures.
|
void |
initializeForCache(CacheGroupDescriptor grpDesc,
CacheConfiguration<?,?> ccfg)
Callback called when a cache is starting.
|
void |
initializeForMetastorage()
Initializes disk cache store structures.
|
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
onKernalStop0(boolean cancel) |
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.
|
long |
pagesAllocated(int grpId)
Calculates number of pages currently allocated for given cache group.
|
int |
pageSize() |
static int |
partId(String partFileName) |
void |
read(int grpId,
long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
Reads a page for the given cache ID.
|
void |
readHeader(int grpId,
int partId,
ByteBuffer buf)
Reads a header of a page store.
|
void |
setPageStoreFileIOFactories(FileIOFactory pageStoreFileIoFactory,
FileIOFactory pageStoreV1FileIoFactory) |
void |
shutdownForCacheGroup(CacheGroupContext grp,
boolean destroy)
Callback called when a cache is stopping.
|
void |
start0() |
void |
stop0(boolean cancel) |
void |
sync(int grpId,
int partId)
Makes sure that all previous writes to the store has been written to disk.
|
void |
truncate(int grpId,
int partId,
int tag)
Callback called when a partition for the given cache is evicted from the local node.
|
File |
workDir() |
PageStore |
write(int grpId,
long pageId,
ByteBuffer pageBuf,
int tag,
boolean calculateCrc)
Writes the page for the given cache ID.
|
context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onReconnected, printMemoryStats, start, startInfo, stop, stopInfo, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonDisconnected, onKernalStart, onKernalStop, onReconnected, printMemoryStats, start, stoppublic static final String FILE_SUFFIX
public static final String ZIP_SUFFIX
public static final String TMP_SUFFIX
public static final String PART_FILE_PREFIX
public static final String INDEX_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 static final String CACHE_DATA_TMP_FILENAME
public static final String DFLT_STORE_DIR
public static final PathMatcher TMP_FILE_MATCHER
public static final String CORRUPTED_DATA_FILES_MNTC_TASK_NAME
public FilePageStoreManager(GridKernalContext ctx)
ctx - Kernal context.public void start0()
throws IgniteCheckedException
start0 in class GridCacheSharedManagerAdapterIgniteCheckedException - If failed.public void cleanupPersistentSpace(CacheConfiguration cacheConfiguration) throws IgniteCheckedException
cleanupPersistentSpace in interface IgnitePageStoreManagercacheConfiguration - Cache configuration of cache which should be cleanup.IgniteCheckedExceptionpublic void cleanupPersistentSpace()
throws IgniteCheckedException
cleanupPersistentSpace in interface IgnitePageStoreManagerIgniteCheckedExceptionpublic void cleanupPageStoreIfMatch(Predicate<Integer> cacheGrpPred, boolean cleanFiles)
cleanupPageStoreIfMatch in interface IgnitePageStoreManagercacheGrpPred - Predicate to match by id cache group stores to clean.cleanFiles - True to delete all persisted files related to particular store.public void stop0(boolean cancel)
stop0 in class GridCacheSharedManagerAdaptercancel - Cancel flag.public void onKernalStop0(boolean cancel)
onKernalStop0 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()
throws IgniteCheckedException
finishRecover in interface IgnitePageStoreManagerIgniteCheckedExceptionpublic void initialize(int cacheId,
int partitions,
String cacheName,
PageMetrics pageMetrics)
throws IgniteCheckedException
initialize in interface IgnitePageStoreManagercacheId - Cache id.partitions - Partitions count.cacheName - Cache name.pageMetrics - Page metrics.IgniteCheckedException - If failed.public void initializeForCache(CacheGroupDescriptor grpDesc, CacheConfiguration<?,?> ccfg) throws IgniteCheckedException
initializeForCache in interface IgnitePageStoreManagergrpDesc - Cache group descriptor.ccfg - Cache configuration.IgniteCheckedException - If failed to handle cache start callback.public void initializeForMetastorage()
throws IgniteCheckedException
initializeForMetastorage in interface IgnitePageStoreManagerIgniteCheckedExceptionpublic 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 truncate(int grpId,
int partId,
int tag)
throws IgniteCheckedException
truncate 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,
boolean keepCrc)
throws IgniteCheckedException
0 if the page is a meta page.read in interface PageReadWriteManagergrpId - Cache group ID.pageId - PageID to read.pageBuf - Page buffer to write to.keepCrc - Keep CRC flag.IgniteCheckedException - If failed to read the page.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 PageStore write(int grpId, long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc) throws IgniteCheckedException
0 if the page is a meta page.write in interface IgnitePageStoreManagerwrite in interface PageReadWriteManagergrpId - 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 FileVersionCheckingFactory getPageStoreFactory(int grpId, boolean encrypted)
grpId - Cache group id.encrypted - true if cache group encryption enabled.public FileVersionCheckingFactory getPageStoreFactory(int grpId, EncryptionCacheKeyProvider encrKeyProvider)
grpId - Cache group id.encrKeyProvider - Encryption keys provider for encrypted IO. If null, no encryption is used.public EncryptedFileIOFactory encryptedFileIoFactory(FileIOFactory plainFileIOFactory, int cacheGrpId, EncryptionCacheKeyProvider encrKeyProvider)
plainFileIOFactory - Not-encrypting file io factory.cacheGrpId - Cache group id.encrKeyProvider - Encryption keys provider for encrypted IO. If null, no encryption is used.public EncryptedFileIOFactory encryptedFileIoFactory(FileIOFactory plainFileIOFactory, int cacheGrpId)
@NotNull public static @NotNull File getPartitionFile(File workDir, String cacheDirName, int partId)
workDir - Cache work directory.cacheDirName - Cache directory name.partId - Partition id.public static String getPartitionFileName(int partId)
partId - Partition id.public static boolean checkAndInitCacheWorkDir(File cacheWorkDir, IgniteLogger log) throws IgniteCheckedException
cacheWorkDir - Cache work directory.IgniteCheckedExceptionpublic 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 IgnitePageStoreManagerallocatePage in interface PageReadWriteManagergrpId - Cache group ID.partId - Partition ID. Used only if flags is not equal to PageIdAllocator.FLAG_IDX.flags - Page allocation flags.IgniteCheckedException - If IO exception occurred while allocating a page ID.public int pages(int grpId,
int partId)
throws IgniteCheckedException
pages in interface IgnitePageStoreManagergrpId - Cache group ID.partId - Partition ID.IgniteCheckedException - If failed.public static List<File> cacheDirectories(File dir, Predicate<String> names)
dir - Directory to check.names - Cache group names to filter.public static File cacheDirectory(File dir, int grpId)
dir - Directory to check.grpId - Cache group idpublic static int partId(String partFileName)
partFileName - Partition file name.public static List<File> cachePartitionFiles(File cacheDir)
cacheDir - Cache directory to check.public static String cacheGroupName(File dir)
dir - Cache directory on disk.public static File[] cacheDataFiles(File root)
root - Root directory.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 long pagesAllocated(int grpId)
pagesAllocated in interface IgnitePageStoreManagergrpId - cache group id.public File workDir()
public File cacheWorkDir(CacheConfiguration<?,?> ccfg)
ccfg - Cache configuration.public File cacheWorkDir(boolean isSharedGroup, String cacheOrGroupName)
isSharedGroup - True if cache is sharing the same `underlying` cache.cacheOrGroupName - Cache name.public static File cacheWorkDir(File storeWorkDir, String cacheDirName)
cacheDirName - Cache directory name.public static String cacheDirName(boolean isSharedGroup, String cacheOrGroupName)
isSharedGroup - True if cache is sharing the same `underlying` cache.cacheOrGroupName - Cache name.public static String cacheDirName(CacheConfiguration<?,?> ccfg)
ccfg - Cache configuration.public String cacheDirName(int grpId) throws IgniteCheckedException
grpId - Group id.IgniteCheckedException - If cache group doesn't exist.public Collection<PageStore> getStores(int grpId) throws IgniteCheckedException
getStores in interface PageStoreCollectiongrpId - Cache group ID.IgniteCheckedException - If failed.public PageStore getStore(int grpId, int partId) throws IgniteCheckedException
getStore in interface PageStoreCollectiongrpId - Cache group ID.partId - Partition ID.IgniteCheckedException - If cache or partition with the given ID was not created.
Note: visible for testing.public void setPageStoreFileIOFactories(FileIOFactory pageStoreFileIoFactory, FileIOFactory pageStoreV1FileIoFactory)
pageStoreFileIoFactory - File IO factory to override default, may be used for blocked read-write.pageStoreV1FileIoFactory - File IO factory for reading V1 page store and for fast touching page files
(non blocking).public FileIOFactory getPageStoreFileIoFactory()
public int pageSize()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023