public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements Comparable<GridDhtLocalPartition>, GridReservable
GridCacheConcurrentMap.CacheMapHolder| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_DELETE_QUEUE_SIZE
Maximum size for delete queue.
|
| Constructor and Description |
|---|
GridDhtLocalPartition(GridCacheSharedContext ctx,
CacheGroupContext grp,
int id,
boolean recovery) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addReservation(GridDhtPartitionsReservation r)
Adds group reservation to this partition.
|
void |
awaitDestroy()
Awaits completion of partition destroy process in case of
EVICTED partition state. |
boolean |
backup(AffinityTopologyVersion topVer) |
void |
beforeApplyBatch(boolean last)
Called before next batch is about to be applied during rebalance.
|
void |
cleanupRemoveQueue()
TODO FIXME Get rid of deferred delete queue https://issues.apache.org/jira/browse/IGNITE-11704
|
void |
clearAsync()
Initiates single clear process if partition is in MOVING state or continues cleaning for RENTING state.
|
int |
compareTo(@NotNull GridDhtLocalPartition part) |
long |
createTime() |
IgniteCacheOffheapManager.CacheDataStore |
dataStore() |
void |
decrementPublicSize(@Nullable GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e)
Decrements public size.
|
void |
destroy()
Destroys partition data store and invokes appropriate callbacks.
|
protected GridCacheConcurrentMap.CacheMapHolder |
entriesMap(GridCacheContext cctx) |
protected @Nullable GridCacheConcurrentMap.CacheMapHolder |
entriesMapIfExists(Integer cacheId) |
boolean |
equals(Object o) |
GridLongList |
finalizeUpdateCounters()
Flushes pending update counters closing all possible gaps.
|
long |
fullSize() |
long |
getAndIncrementUpdateCounter(long delta)
Increments cache update counter on primary node.
|
CacheGroupContext |
group()
Returns group context.
|
int |
hashCode() |
int |
id() |
void |
incrementPublicSize(@Nullable GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e)
Increments public size.
|
long |
initialUpdateCounter() |
int |
internalSize()
Returns the number of key-value mappings in this map.
|
boolean |
isClearing() |
boolean |
isEmpty() |
boolean |
markForDestroy() |
boolean |
markLost() |
void |
moving()
Forcibly moves partition to a MOVING state.
|
long |
nextUpdateCounter(int cacheId,
AffinityTopologyVersion topVer,
boolean primary,
boolean init,
@Nullable Long primaryCntr)
Returns new update counter for primary node or passed counter for backup node.
|
long |
nextUpdateCounter(int cacheId,
IgniteInternalTx tx,
@Nullable Long primaryCntr)
Used for transactions.
|
void |
onCacheStopped(int cacheId) |
void |
onClearFinished(IgniteInClosure<? super IgniteInternalFuture<?>> lsnr)
Adds listener on
clearFuture finish. |
void |
onDeferredDelete(int cacheId,
KeyCacheObject key,
GridCacheVersion ver) |
void |
onRemoved(GridDhtCacheEntry entry) |
void |
onUnlock()
On partition unlock callback.
|
boolean |
own() |
boolean |
primary(AffinityTopologyVersion topVer) |
int |
publicSize(int cacheId)
Returns the number of publicly available key-value mappings in this map.
|
void |
release()
Releases previously reserved partition.
|
protected void |
release(int sizeChange,
GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e) |
void |
removeReservation(GridDhtPartitionsReservation r) |
IgniteInternalFuture<?> |
rent(boolean updateSeq)
Initiates partition eviction process.
|
IgniteInternalFuture<?> |
rent(boolean updateSeq,
boolean alwaysReturnRentingFut)
Initiates partition eviction process.
|
int |
reservations() |
boolean |
reserve()
Reserves a partition so it won't be cleared or evicted.
|
long |
reservedCounter() |
void |
resetUpdateCounter()
Reset partition update counter.
|
void |
restoreState(GridDhtPartitionState stateToRestore) |
void |
setState(GridDhtPartitionState toState)
For testing purposes only.
|
GridDhtPartitionState |
state() |
String |
toString() |
boolean |
tryClear(EvictionContext evictionCtx)
Tries to start partition clear process
clearAll(EvictionContext)). |
void |
tryContinueClearing()
Continues delayed clearing of partition if possible.
|
long |
updateCounter() |
void |
updateCounter(long val) |
boolean |
updateCounter(long start,
long delta)
Updates MVCC cache update counter on backup node.
|
boolean |
valid() |
entries, entrySet, getEntry, putEntryIfObsoleteOrAbsent, putEntryIfObsoleteOrAbsent, removeEntrypublic static final int MAX_DELETE_QUEUE_SIZE
public GridDhtLocalPartition(GridCacheSharedContext ctx, CacheGroupContext grp, int id, boolean recovery)
ctx - Context.grp - Cache group.id - Partition ID.recovery - Flag indicates that partition is created during recovery phase.public int internalSize()
internalSize in interface GridCacheConcurrentMapprotected GridCacheConcurrentMap.CacheMapHolder entriesMap(GridCacheContext cctx)
entriesMap in class GridCacheConcurrentMapImplcctx - Cache context.@Nullable protected @Nullable GridCacheConcurrentMap.CacheMapHolder entriesMapIfExists(Integer cacheId)
entriesMapIfExists in class GridCacheConcurrentMapImplcacheId - Cache ID.public IgniteCacheOffheapManager.CacheDataStore dataStore()
public boolean addReservation(GridDhtPartitionsReservation r)
r - Reservation.false If such reservation already added.public void removeReservation(GridDhtPartitionsReservation r)
r - Reservation.public int id()
public long createTime()
public GridDhtPartitionState state()
public int reservations()
public boolean isEmpty()
True if partition is empty.public boolean valid()
public void onRemoved(GridDhtCacheEntry entry)
entry - Entry to remove.public void cleanupRemoveQueue()
public void onDeferredDelete(int cacheId,
KeyCacheObject key,
GridCacheVersion ver)
cacheId - cacheId Cache ID.key - Removed key.ver - Removed version.public boolean reserve()
reserve in interface GridReservablereserve in class GridCacheConcurrentMapImplTrue if reserved.public void release()
release in interface GridReservablerelease in class GridCacheConcurrentMapImplprotected void release(int sizeChange,
GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e)
release in class GridCacheConcurrentMapImplsizeChange - Size delta.hld - Map holder.e - Map entry.public void restoreState(GridDhtPartitionState stateToRestore)
stateToRestore - State to restore.public void setState(GridDhtPartitionState toState)
toState - State to set.public boolean own()
True if transitioned to OWNING state.public void moving()
public boolean markLost()
True if partition state changed.public IgniteInternalFuture<?> rent(boolean updateSeq)
updateSeq - If true topology update sequence will be updated after eviction is finished.public IgniteInternalFuture<?> rent(boolean updateSeq, boolean alwaysReturnRentingFut)
updateSeq - If true topology update sequence will be updated after eviction is finished.alwaysReturnRentingFut - If true renting future is returned in any way.RENTING or EVICTED.public void clearAsync()
public void tryContinueClearing()
public boolean markForDestroy()
True if partition is marked for destroy.public void destroy()
public void awaitDestroy()
EVICTED partition state.public void onClearFinished(IgniteInClosure<? super IgniteInternalFuture<?>> lsnr)
clearFuture finish.lsnr - Listener.public boolean isClearing()
True if clearing process is running at the moment on the partition.public boolean tryClear(EvictionContext evictionCtx) throws NodeStoppingException
clearAll(EvictionContext)).
Only one thread is allowed to do such process concurrently.
At the end of clearing method completes clearFuture.evictionCtx - Eviction context.false if clearing is not started due to existing reservations.NodeStoppingException - If node is stopping.public void onUnlock()
public boolean primary(AffinityTopologyVersion topVer)
topVer - Topology version.True if local node is primary for this partition.public boolean backup(AffinityTopologyVersion topVer)
topVer - Topology version.True if local node is backup for this partition.public long nextUpdateCounter(int cacheId,
AffinityTopologyVersion topVer,
boolean primary,
boolean init,
@Nullable
@Nullable Long primaryCntr)
Used for non-tx cases.
Counter generation/update logic is delegated to counter implementation.
cacheId - ID of cache initiated counter update.topVer - Topology version for current operation.init - True if initial update.public long nextUpdateCounter(int cacheId,
IgniteInternalTx tx,
@Nullable
@Nullable Long primaryCntr)
cacheId - Cache id.tx - Tx.primaryCntr - Primary counter.public long updateCounter()
public long reservedCounter()
public void updateCounter(long val)
val - Update counter value.public long initialUpdateCounter()
public long getAndIncrementUpdateCounter(long delta)
delta - Value to be added to update counter.public boolean updateCounter(long start,
long delta)
start - Start positiondelta - Delta.public void resetUpdateCounter()
public long fullSize()
public int compareTo(@NotNull
@NotNull GridDhtLocalPartition part)
compareTo in interface Comparable<GridDhtLocalPartition>public int publicSize(int cacheId)
publicSize in interface GridCacheConcurrentMapcacheId - Cache ID.public void incrementPublicSize(@Nullable
@Nullable GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e)
incrementPublicSize in interface GridCacheConcurrentMaphld - Cache map (passed as optimization to avoid cache map lookup for shared groups).e - Entry that caused public size change.public void decrementPublicSize(@Nullable
@Nullable GridCacheConcurrentMap.CacheMapHolder hld,
GridCacheEntryEx e)
decrementPublicSize in interface GridCacheConcurrentMaphld - Cache map (passed as optimization to avoid cache map lookup for shared groups).e - Entry that caused public size change.public CacheGroupContext group()
public void onCacheStopped(int cacheId)
cacheId - Cache ID.public GridLongList finalizeUpdateCounters()
public void beforeApplyBatch(boolean last)
last - True if last batch for partition.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.8.1 Release Date : May 21 2020