Class ReuseListImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.DataStructure
-
- org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList
-
- org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseListImpl
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList
PagesList.PagesCache, PagesList.Stripe
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList
bucketsSize, changed, DFLT_PAGES_LIST_TRY_LOCK_ATTEMPTS, IGNITE_PAGES_LIST_STRIPES_PER_BUCKET, IGNITE_PAGES_LIST_TRY_LOCK_ATTEMPTS, log, pageCacheChanged
-
Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.DataStructure
grpId, grpName, metrics, pageFlag, pageIoRslvr, pageMem, reuseList, rnd, wal
-
-
Constructor Summary
Constructors Constructor Description ReuseListImpl(int cacheId, String name, PageMemory pageMem, @Nullable IgniteWriteAheadLogManager wal, long metaPageId, boolean initNew, PageLockTrackerManager pageLockTrackerManager, GridKernalContext ctx, @Nullable AtomicLong pageListCacheLimit, byte pageFlag)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddForRecycle(ReuseBag bag)protected booleancasBucket(int bucket, PagesList.Stripe[] exp, PagesList.Stripe[] upd)protected PagesList.Stripe[]getBucket(int bucket)protected PagesList.PagesCachegetBucketCache(int bucket, boolean create)protected intgetBucketIndex(int freeSpace)Gets bucket index by page freespace.intgetPageFreeSpace(int bucket)Gets per page free space for specified bucket.longinitRecycledPage(long pageId, byte flag, PageIO initIO)Converts recycled page id back to a usable id.protected booleanisReuseBucket(int bucket)longrecycledPagesCount()longtakeRecycledPage()StringtoString()-
Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.freelist.PagesList
bucketsCount, bucketSize, cachedPagesCount, corruptedFreeListException, corruptedFreeListException, corruptedFreeListException, init, initRecycledPage0, initReusedPage, metaPageId, put, removeDataPage, saveMetadata, storedPagesCount, stripesCount, takeEmptyPage
-
Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.DataStructure
acquirePage, allocatePage, allocatePage, allocatePageNoReuse, close, groupId, init, name, needWalDeltaRecord, pageSize, randomInt, read, read, readLock, readUnlock, recyclePage, releasePage, tryWriteLock, write, write, write, write, writeLock, writeUnlock, writeUnlock
-
-
-
-
Constructor Detail
-
ReuseListImpl
public ReuseListImpl(int cacheId, String name, PageMemory pageMem, @Nullable @Nullable IgniteWriteAheadLogManager wal, long metaPageId, boolean initNew, PageLockTrackerManager pageLockTrackerManager, GridKernalContext ctx, @Nullable @Nullable AtomicLong pageListCacheLimit, byte pageFlag) throws IgniteCheckedException- Parameters:
cacheId- Cache ID.name- Name (for debug purpose).pageMem- Page memory.wal- Write ahead log manager.metaPageId- Metadata page ID.initNew-Trueif new metadata should be initialized.pageLockTrackerManager- Page lock tracker manager.pageFlag- Default flag value for allocated pages.- Throws:
IgniteCheckedException- If failed.
-
-
Method Detail
-
isReuseBucket
protected boolean isReuseBucket(int bucket)
- Specified by:
isReuseBucketin classPagesList- Parameters:
bucket- Bucket index.- Returns:
trueIf it is a reuse bucket.
-
addForRecycle
public void addForRecycle(ReuseBag bag) throws IgniteCheckedException
- Specified by:
addForRecyclein interfaceReuseList- Parameters:
bag- Reuse bag.- Throws:
IgniteCheckedException- If failed.
-
takeRecycledPage
public long takeRecycledPage() throws IgniteCheckedException- Specified by:
takeRecycledPagein interfaceReuseList- Returns:
- Page ID or
0if none available. - Throws:
IgniteCheckedException- If failed.
-
initRecycledPage
public long initRecycledPage(long pageId, byte flag, PageIO initIO) throws IgniteCheckedExceptionConverts recycled page id back to a usable id. Might modify page content as well if flag is changing.- Specified by:
initRecycledPagein interfaceReuseList- Parameters:
pageId- Id of the recycled page.flag- Flag value for the page. One ofPageIdAllocator.FLAG_DATA,PageIdAllocator.FLAG_IDXorPageIdAllocator.FLAG_AUX.initIO- Page IO to reinit reused page.- Returns:
- Updated page id.
- Throws:
IgniteCheckedException- If failed.- See Also:
FullPageId
-
recycledPagesCount
public long recycledPagesCount() throws IgniteCheckedException- Specified by:
recycledPagesCountin interfaceReuseList- Returns:
- Number of recycled pages it contains.
- Throws:
IgniteCheckedException- If failed.
-
getBucket
protected PagesList.Stripe[] getBucket(int bucket)
-
getPageFreeSpace
public int getPageFreeSpace(int bucket)
Gets per page free space for specified bucket.- Specified by:
getPageFreeSpacein classPagesList- Returns:
- Free space available to use for each page in specified bucket.
-
getBucketIndex
protected int getBucketIndex(int freeSpace)
Gets bucket index by page freespace.- Specified by:
getBucketIndexin classPagesList- Returns:
- Bucket index or -1 if page doesn't belong to any bucket.
-
casBucket
protected boolean casBucket(int bucket, PagesList.Stripe[] exp, PagesList.Stripe[] upd)
-
getBucketCache
protected PagesList.PagesCache getBucketCache(int bucket, boolean create)
- Specified by:
getBucketCachein classPagesList- Parameters:
bucket- Bucket index.- Returns:
- Bucket cache.
-
-