public class IgniteCacheOffheapManagerImpl extends Object implements IgniteCacheOffheapManager
Modifier and Type | Class and Description |
---|---|
static class |
IgniteCacheOffheapManagerImpl.CacheDataStoreImpl |
IgniteCacheOffheapManager.CacheDataStore, IgniteCacheOffheapManager.OffheapInvokeClosure
Modifier and Type | Field and Description |
---|---|
protected GridSpinBusyLock |
busyLock |
protected GridCacheSharedContext |
ctx |
protected CacheGroupContext |
grp |
protected IgniteLogger |
log |
protected ConcurrentMap<Integer,IgniteCacheOffheapManager.CacheDataStore> |
partDataStores |
protected GridStripedLock |
partStoreLock |
static int |
PRELOAD_SIZE_UNDER_CHECKPOINT_LOCK
The maximum number of entries that can be preloaded under checkpoint read lock.
|
Constructor and Description |
---|
IgniteCacheOffheapManagerImpl() |
public static final int PRELOAD_SIZE_UNDER_CHECKPOINT_LOCK
protected GridCacheSharedContext ctx
protected CacheGroupContext grp
protected IgniteLogger log
protected final ConcurrentMap<Integer,IgniteCacheOffheapManager.CacheDataStore> partDataStores
protected final GridSpinBusyLock busyLock
protected GridStripedLock partStoreLock
public GridAtomicLong globalRemoveId()
globalRemoveId
in interface IgniteCacheOffheapManager
public void start(GridCacheSharedContext ctx, CacheGroupContext grp) throws IgniteCheckedException
start
in interface IgniteCacheOffheapManager
ctx
- Context.grp
- Cache group.IgniteCheckedException
- If failed.public void onCacheStarted(GridCacheContext cctx) throws IgniteCheckedException
onCacheStarted
in interface IgniteCacheOffheapManager
cctx
- Cache context.IgniteCheckedException
- If failed.protected void initPendingTree(GridCacheContext cctx) throws IgniteCheckedException
cctx
- Cache context.IgniteCheckedException
- If failed.protected void initDataStructures() throws IgniteCheckedException
IgniteCheckedException
- If failed.public void stopCache(int cacheId, boolean destroy)
stopCache
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.destroy
- Destroy data flag. Setting to true
will remove all cache data.public void stop()
stop
in interface IgniteCacheOffheapManager
public long restorePartitionStates(Map<GroupPartitionId,Integer> partitionRecoveryStates) throws IgniteCheckedException
restorePartitionStates
in interface IgniteCacheOffheapManager
partitionRecoveryStates
- Partition recovery states.IgniteCheckedException
- If failed.public void onKernalStop()
onKernalStop
in interface IgniteCacheOffheapManager
public IgniteCacheOffheapManager.CacheDataStore dataStore(GridDhtLocalPartition part)
dataStore
in interface IgniteCacheOffheapManager
part
- Partition.public IgniteCacheOffheapManager.CacheDataStore dataStore(int part)
part
- Partition.public long cacheEntriesCount(int cacheId)
cacheEntriesCount
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.public long totalPartitionEntriesCount(int p)
totalPartitionEntriesCount
in interface IgniteCacheOffheapManager
p
- Partition.public void preloadPartition(int p) throws IgniteCheckedException
preloadPartition
in interface IgniteCacheOffheapManager
p
- Partition.IgniteCheckedException
- If failed.public long cacheEntriesCount(int cacheId, boolean primary, boolean backup, AffinityTopologyVersion topVer) throws IgniteCheckedException
cacheEntriesCount
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.primary
- Primary entries flag.backup
- Backup entries flag.topVer
- Topology version.IgniteCheckedException
- If failed.public long cacheEntriesCount(int cacheId, int part)
cacheEntriesCount
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.part
- Partition.public void invoke(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartition part, IgniteCacheOffheapManager.OffheapInvokeClosure c) throws IgniteCheckedException
invoke
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.part
- Partition.c
- Tree update closure.IgniteCheckedException
- If failed.public void update(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, GridDhtLocalPartition part, @Nullable @Nullable CacheDataRow oldRow) throws IgniteCheckedException
update
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.val
- Value.ver
- Version.expireTime
- Expire time.part
- Partition.oldRow
- Old row if available.IgniteCheckedException
- If failed.public boolean mvccInitialValue(GridCacheMapEntry entry, CacheObject val, GridCacheVersion ver, long expireTime, MvccVersion mvccVer, MvccVersion newMvccVer) throws IgniteCheckedException
mvccInitialValue
in interface IgniteCacheOffheapManager
entry
- Entry.val
- Value.ver
- Version.expireTime
- Expire time.mvccVer
- MVCC version.newMvccVer
- New MVCC version.True
if value was inserted.IgniteCheckedException
- If failed.public boolean mvccApplyHistoryIfAbsent(GridCacheMapEntry entry, List<GridCacheMvccEntryInfo> hist) throws IgniteCheckedException
mvccApplyHistoryIfAbsent
in interface IgniteCacheOffheapManager
entry
- Entry to update.hist
- Full entry history.True
if history applied successfully, False
otherwise.IgniteCheckedException
public boolean mvccUpdateRowWithPreloadInfo(GridCacheMapEntry entry, @Nullable @Nullable CacheObject val, GridCacheVersion ver, long expireTime, MvccVersion mvccVer, MvccVersion newMvccVer, byte mvccTxState, byte newMvccTxState) throws IgniteCheckedException
mvccUpdateRowWithPreloadInfo
in interface IgniteCacheOffheapManager
entry
- Entry.val
- Value.ver
- Version.mvccVer
- MVCC version.newMvccVer
- New MVCC version.True
if value was inserted.IgniteCheckedException
- If failed.public MvccUpdateResult mvccUpdate(GridCacheMapEntry entry, CacheObject val, GridCacheVersion ver, long expireTime, MvccSnapshot mvccSnapshot, boolean primary, boolean needHistory, boolean noCreate, boolean needOldVal, @Nullable @Nullable CacheEntryPredicate filter, boolean retVal, boolean keepBinary, javax.cache.processor.EntryProcessor entryProc, Object[] invokeArgs) throws IgniteCheckedException
mvccUpdate
in interface IgniteCacheOffheapManager
entry
- Entry.val
- Value.ver
- Cache version.expireTime
- Expire time.mvccSnapshot
- MVCC snapshot.primary
- True
if on primary node.needHistory
- Flag to collect history.noCreate
- Flag indicating that row should not be created if absent.needOldVal
- True
if need old value.filter
- Filter.retVal
- Flag to return previous value.keepBinary
- Keep binary flag.entryProc
- Entry processor.invokeArgs
- Entry processor invoke arguments.IgniteCheckedException
- If failed.public MvccUpdateResult mvccRemove(GridCacheMapEntry entry, MvccSnapshot mvccSnapshot, boolean primary, boolean needHistory, boolean needOldVal, @Nullable @Nullable CacheEntryPredicate filter, boolean retVal) throws IgniteCheckedException
mvccRemove
in interface IgniteCacheOffheapManager
entry
- Entry.mvccSnapshot
- MVCC snapshot.primary
- True
if on primary node.needHistory
- Flag to collect history.needOldVal
- True
if need old value.filter
- Filter.retVal
- Flag to return previous value.IgniteCheckedException
- If failed.public void mvccRemoveAll(GridCacheMapEntry entry) throws IgniteCheckedException
mvccRemoveAll
in interface IgniteCacheOffheapManager
entry
- Entry.IgniteCheckedException
- If failed.@Nullable public @Nullable MvccUpdateResult mvccLock(GridCacheMapEntry entry, MvccSnapshot mvccSnapshot) throws IgniteCheckedException
mvccLock
in interface IgniteCacheOffheapManager
entry
- Entry.mvccSnapshot
- MVCC snapshot.IgniteCheckedException
- If failed.public void mvccApplyUpdate(GridCacheContext cctx, KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime, GridDhtLocalPartition part, MvccVersion mvccVer) throws IgniteCheckedException
mvccApplyUpdate
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.val
- Value.ver
- Version.expireTime
- Expire time.part
- Partition.mvccVer
- Mvcc version.IgniteCheckedException
- If failed.public void remove(GridCacheContext cctx, KeyCacheObject key, int partId, GridDhtLocalPartition part) throws IgniteCheckedException
remove
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.partId
- Partition number.part
- Partition.IgniteCheckedException
- If failed.@Nullable public @Nullable CacheDataRow read(GridCacheMapEntry entry) throws IgniteCheckedException
read
in interface IgniteCacheOffheapManager
entry
- Cache entry.IgniteCheckedException
- If failed.@Nullable public @Nullable CacheDataRow read(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException
read
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.IgniteCheckedException
- If failed.@Nullable public @Nullable CacheDataRow mvccRead(GridCacheContext cctx, KeyCacheObject key, MvccSnapshot mvccSnapshot) throws IgniteCheckedException
mvccRead
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.mvccSnapshot
- MVCC snapshot.IgniteCheckedException
- If failed.public List<IgniteBiTuple<Object,MvccVersion>> mvccAllVersions(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException
mvccAllVersions
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.IgniteCheckedException
- If failed.public GridCursor<CacheDataRow> mvccAllVersionsCursor(GridCacheContext cctx, KeyCacheObject key, Object x) throws IgniteCheckedException
mvccAllVersionsCursor
in interface IgniteCacheOffheapManager
cctx
- Cache context.key
- Key.x
- Implementation specific argument, null
always means that we need to return full detached data row.IgniteCheckedException
- If failed.public boolean containsKey(GridCacheMapEntry entry)
containsKey
in interface IgniteCacheOffheapManager
public void onPartitionCounterUpdated(int part, long cntr)
onPartitionCounterUpdated
in interface IgniteCacheOffheapManager
part
- Partition.cntr
- Partition counter.public void onPartitionInitialCounterUpdated(int part, long start, long delta)
onPartitionInitialCounterUpdated
in interface IgniteCacheOffheapManager
part
- Partitionstart
- Start.delta
- Delta.public long lastUpdatedPartitionCounter(int part)
lastUpdatedPartitionCounter
in interface IgniteCacheOffheapManager
part
- Partition ID.public void clearCache(GridCacheContext cctx, boolean readers)
clearCache
in interface IgniteCacheOffheapManager
readers
- True
to clear readers.cctx
- Cache context.public int onUndeploy(ClassLoader ldr)
onUndeploy
in interface IgniteCacheOffheapManager
ldr
- Class loader.public long offHeapAllocatedSize()
offHeapAllocatedSize
in interface IgniteCacheOffheapManager
public <K,V> GridCloseableIterator<javax.cache.Cache.Entry<K,V>> cacheEntriesIterator(GridCacheContext cctx, boolean primary, boolean backup, AffinityTopologyVersion topVer, boolean keepBinary, @Nullable @Nullable MvccSnapshot mvccSnapshot, Boolean dataPageScanEnabled)
cacheEntriesIterator
in interface IgniteCacheOffheapManager
cctx
- Cache context.primary
- True
if need to return primary entries.backup
- True
if need to return backup entries.topVer
- Topology version.keepBinary
- Keep binary flag.mvccSnapshot
- MVCC snapshot.dataPageScanEnabled
- Flag to enable data page scan.public GridCloseableIterator<KeyCacheObject> cacheKeysIterator(int cacheId, int part) throws IgniteCheckedException
cacheKeysIterator
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.part
- Partition.IgniteCheckedException
- If failed.public GridIterator<CacheDataRow> cacheIterator(int cacheId, boolean primary, boolean backups, AffinityTopologyVersion topVer, @Nullable @Nullable MvccSnapshot mvccSnapshot, Boolean dataPageScanEnabled)
cacheIterator
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.primary
- Primary entries flag.backups
- Backup entries flag.topVer
- Topology version.mvccSnapshot
- MVCC snapshot.dataPageScanEnabled
- Flag to enable data page scan.public GridIterator<CacheDataRow> cachePartitionIterator(int cacheId, int part, @Nullable @Nullable MvccSnapshot mvccSnapshot, Boolean dataPageScanEnabled)
cachePartitionIterator
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.part
- Partition.mvccSnapshot
- MVCC snapshot.dataPageScanEnabled
- Flag to enable data page scan.public GridIterator<CacheDataRow> partitionIterator(int part)
partitionIterator
in interface IgniteCacheOffheapManager
part
- Partition number.public RootPage rootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException
rootPageForIndex
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.idxName
- Index name.segment
- Segment.IgniteCheckedException
- If failed.public void dropRootPageForIndex(int cacheId, String idxName, int segment) throws IgniteCheckedException
dropRootPageForIndex
in interface IgniteCacheOffheapManager
cacheId
- Cache ID.idxName
- Index name.IgniteCheckedException
- If failed.public ReuseList reuseListForIndex(String idxName)
reuseListForIndex
in interface IgniteCacheOffheapManager
idxName
- Index name.public GridCloseableIterator<CacheDataRow> reservedIterator(int part, AffinityTopologyVersion topVer) throws IgniteCheckedException
reservedIterator
in interface IgniteCacheOffheapManager
part
- Partition number.topVer
- Topology version.IgniteCheckedException
- If failed.public IgniteRebalanceIterator rebalanceIterator(IgniteDhtDemandedPartitionsMap parts, AffinityTopologyVersion topVer) throws IgniteCheckedException
rebalanceIterator
in interface IgniteCacheOffheapManager
parts
- Partitions.IgniteCheckedException
- If failed.@Nullable protected @Nullable IgniteHistoricalIterator historicalIterator(CachePartitionPartialCountersMap partCntrs, Set<Integer> missing) throws IgniteCheckedException
partCntrs
- Partition counters map.missing
- Set of partitions need to populate if partition is missing or failed to reserve.IgniteCheckedException
- If failed.public void storeEntries(int partId, Iterator<GridCacheEntryInfo> infos, IgnitePredicateX<CacheDataRow> initPred) throws IgniteCheckedException
storeEntries
in interface IgniteCacheOffheapManager
partId
- Partition number.infos
- Entry infos.initPred
- Applied to all created rows. Each row that not matches the predicate is removed.IgniteCheckedException
- If failed.public final IgniteCacheOffheapManager.CacheDataStore createCacheDataStore(int p) throws IgniteCheckedException
createCacheDataStore
in interface IgniteCacheOffheapManager
p
- Partition.IgniteCheckedException
- If failed.protected IgniteCacheOffheapManager.CacheDataStore createCacheDataStore0(int p) throws IgniteCheckedException
p
- Partition.IgniteCheckedException
- If failed.public Iterable<IgniteCacheOffheapManager.CacheDataStore> cacheDataStores()
cacheDataStores
in interface IgniteCacheOffheapManager
public final void destroyCacheDataStore(IgniteCacheOffheapManager.CacheDataStore store) throws IgniteCheckedException
destroyCacheDataStore
in interface IgniteCacheOffheapManager
store
- Data store.IgniteCheckedException
- If failed.protected void destroyCacheDataStore0(IgniteCacheOffheapManager.CacheDataStore store) throws IgniteCheckedException
store
- Cache data store.IgniteCheckedException
- If failed.protected final String treeName(int p)
p
- Partition.public boolean expire(GridCacheContext cctx, IgniteInClosure2X<GridCacheEntryEx,GridCacheVersion> c, int amount) throws IgniteCheckedException
expire
in interface IgniteCacheOffheapManager
cctx
- Cache context.c
- Closure.amount
- Limit of processed entries by single call, -1
for no limit.True
if unprocessed expired entries remains.IgniteCheckedException
- If failed.public long expiredSize() throws IgniteCheckedException
expiredSize
in interface IgniteCacheOffheapManager
IgniteCheckedException
- If failed to get number of pending entries.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021