public abstract class PagesList extends DataStructure
| Modifier and Type | Class and Description |
|---|---|
static class |
PagesList.PagesCache
Class to store page-list cache onheap.
|
static class |
PagesList.Stripe |
| Modifier and Type | Field and Description |
|---|---|
protected AtomicLongArray |
bucketsSize |
protected boolean |
changed |
static int |
DFLT_PAGES_LIST_TRY_LOCK_ATTEMPTS |
static String |
IGNITE_PAGES_LIST_STRIPES_PER_BUCKET |
static String |
IGNITE_PAGES_LIST_TRY_LOCK_ATTEMPTS |
protected IgniteLogger |
log
Logger.
|
protected boolean |
pageCacheChanged
Page cache changed.
|
grpId, grpName, metrics, pageFlag, pageIoRslvr, pageMem, reuseList, rnd, wal| Modifier | Constructor and Description |
|---|---|
protected |
PagesList(int cacheGrpId,
String name,
PageMemory pageMem,
int buckets,
@Nullable IgniteWriteAheadLogManager wal,
long metaPageId,
PageLockTrackerManager pageLockTrackerManager,
GridKernalContext ctx,
byte pageFlag) |
| Modifier and Type | Method and Description |
|---|---|
int |
bucketsCount()
Buckets count.
|
long |
bucketSize(int bucket)
Bucket size.
|
int |
cachedPagesCount(int bucket)
Cached pages count.
|
protected abstract boolean |
casBucket(int bucket,
PagesList.Stripe[] exp,
PagesList.Stripe[] upd) |
protected CorruptedFreeListException |
corruptedFreeListException(String msg,
long... pageIds) |
protected CorruptedFreeListException |
corruptedFreeListException(String msg,
@Nullable Throwable err,
long... pageIds) |
protected CorruptedFreeListException |
corruptedFreeListException(Throwable err,
long... pageIds) |
protected abstract PagesList.Stripe[] |
getBucket(int bucket) |
protected abstract PagesList.PagesCache |
getBucketCache(int bucket,
boolean create) |
protected abstract int |
getBucketIndex(int freeSpace)
Gets bucket index by page freespace.
|
abstract int |
getPageFreeSpace(int bucket)
Gets per page free space for specified bucket.
|
protected void |
init(long metaPageId,
boolean initNew) |
protected long |
initRecycledPage0(long pageId,
byte flag,
PageIO initIO)
Create new page id and update page content accordingly if it's necessary.
|
protected long |
initReusedPage(long reusedPageId,
long reusedPage,
long reusedPageAddr,
int partId,
byte flag,
PageIO initIo)
Reused page must obtain correctly assaembled page id, then initialized by proper
PageIO instance and
non-zero itemId of reused page id must be saved into special place. |
protected abstract boolean |
isReuseBucket(int bucket) |
long |
metaPageId() |
protected void |
put(@Nullable ReuseBag bag,
long dataId,
long dataPage,
long dataAddr,
int bucket,
IoStatisticsHolder statHolder) |
protected boolean |
removeDataPage(long dataId,
long dataPage,
long dataAddr,
AbstractDataPageIO dataIO,
int bucket,
IoStatisticsHolder statHolder)
Removes data page from bucket, merges bucket list if needed.
|
void |
saveMetadata(IoStatisticsHolder statHolder)
Save metadata without exclusive lock on it.
|
protected long |
storedPagesCount(int bucket)
!!!
|
int |
stripesCount(int bucket)
Stripes count.
|
protected long |
takeEmptyPage(int bucket,
@Nullable IOVersions initIoVers,
IoStatisticsHolder statHolder) |
acquirePage, allocatePage, allocatePage, allocatePageNoReuse, close, groupId, init, name, needWalDeltaRecord, pageSize, randomInt, read, read, readLock, readUnlock, recyclePage, releasePage, tryWriteLock, write, write, write, write, writeLock, writeUnlock, writeUnlockpublic static final int DFLT_PAGES_LIST_TRY_LOCK_ATTEMPTS
@SystemProperty(value="Maximum count of the stripes", type=java.lang.Long.class, defaults="Maximum of 8 and available processors count") public static final String IGNITE_PAGES_LIST_STRIPES_PER_BUCKET
@SystemProperty(value="Count of tries to lock stripe before fail back to blocking lock", type=java.lang.Long.class, defaults="10") public static final String IGNITE_PAGES_LIST_TRY_LOCK_ATTEMPTS
protected final AtomicLongArray bucketsSize
protected volatile boolean changed
protected volatile boolean pageCacheChanged
protected final IgniteLogger log
protected PagesList(int cacheGrpId,
String name,
PageMemory pageMem,
int buckets,
@Nullable
@Nullable IgniteWriteAheadLogManager wal,
long metaPageId,
PageLockTrackerManager pageLockTrackerManager,
GridKernalContext ctx,
byte pageFlag)
cacheGrpId - Cache group ID.name - Name (for debug purpose).pageMem - Page memory.buckets - Number of buckets.metaPageId - Metadata page ID.pageFlag - Default flag value for allocated pages.protected final void init(long metaPageId,
boolean initNew)
throws IgniteCheckedException
metaPageId - Metadata page ID.initNew - True if new list if created, false if should be initialized from metadata.IgniteCheckedException - If failed.public void saveMetadata(IoStatisticsHolder statHolder) throws IgniteCheckedException
IgniteCheckedException - If failed.public abstract int getPageFreeSpace(int bucket)
protected abstract int getBucketIndex(int freeSpace)
protected abstract PagesList.Stripe[] getBucket(int bucket)
bucket - Bucket index.protected abstract boolean casBucket(int bucket,
PagesList.Stripe[] exp,
PagesList.Stripe[] upd)
bucket - Bucket index.exp - Expected bucket.upd - Updated bucket.true If succeeded.protected abstract boolean isReuseBucket(int bucket)
bucket - Bucket index.true If it is a reuse bucket.protected abstract PagesList.PagesCache getBucketCache(int bucket, boolean create)
bucket - Bucket index.protected final long storedPagesCount(int bucket)
throws IgniteCheckedException
bucket - Bucket index.IgniteCheckedException - If failed.protected final void put(@Nullable
@Nullable ReuseBag bag,
long dataId,
long dataPage,
long dataAddr,
int bucket,
IoStatisticsHolder statHolder)
throws IgniteCheckedException
bag - Reuse bag.dataId - Data page ID.dataPage - Data page pointer.dataAddr - Data page address.bucket - Bucket.statHolder - Statistics holder to track IO operations.IgniteCheckedException - If failed.protected long takeEmptyPage(int bucket,
@Nullable
@Nullable IOVersions initIoVers,
IoStatisticsHolder statHolder)
throws IgniteCheckedException
bucket - Bucket index.initIoVers - Optional IO to initialize page.statHolder - Statistics holder to track IO operations.IgniteCheckedException - If failed.protected long initRecycledPage0(long pageId,
byte flag,
PageIO initIO)
throws IgniteCheckedException
pageId - Id of the recycled page from reuse bucket.flag - New flag for the page.IgniteCheckedException - If failed.initReusedPage(long, long, long, int, byte, PageIO)protected final long initReusedPage(long reusedPageId,
long reusedPage,
long reusedPageAddr,
int partId,
byte flag,
PageIO initIo)
throws IgniteCheckedException
PageIO instance and
non-zero itemId of reused page id must be saved into special place.reusedPageId - Reused page id.reusedPage - Reused page.reusedPageAddr - Reused page address.partId - Partition id.flag - Flag.initIo - Initial io.IgniteCheckedException - In case of failure.protected final boolean removeDataPage(long dataId,
long dataPage,
long dataAddr,
AbstractDataPageIO dataIO,
int bucket,
IoStatisticsHolder statHolder)
throws IgniteCheckedException
dataId - Data page ID.dataPage - Data page pointer.dataAddr - Data page address.dataIO - Data page IO.bucket - Bucket index.statHolder - Statistics holder to track IO operations.True if page was removed.IgniteCheckedException - If failed.public int bucketsCount()
public long bucketSize(int bucket)
bucket - Bucket.public int stripesCount(int bucket)
bucket - Bucket.public int cachedPagesCount(int bucket)
bucket - Bucket.public long metaPageId()
protected CorruptedFreeListException corruptedFreeListException(Throwable err, long... pageIds)
err - Error that caused this exception.pageIds - Ids of possibly corrupted pages.CorruptedFreeListException that wraps original error and ids of
possibly corrupted pages.protected CorruptedFreeListException corruptedFreeListException(String msg, long... pageIds)
msg - Exception message.pageIds - Ids of possibly corrupted pages.CorruptedFreeListException that wraps original error and ids of
possibly corrupted pages.protected CorruptedFreeListException corruptedFreeListException(String msg, @Nullable @Nullable Throwable err, long... pageIds)
msg - Exception message.err - Error that caused this exception.pageIds - Ids of possibly corrupted pages.CorruptedFreeListException that wraps original error and ids of
possibly corrupted pages.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023