public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdapter implements IgniteChangeGlobalStateSupport, CheckpointLockStateChecker
| Modifier and Type | Field and Description |
|---|---|
static String |
DATA_REGION_PAGE_LIST_VIEW
System view name for page lists.
|
static String |
DATA_REGION_PAGE_LIST_VIEW_DESC
System view description for page lists.
|
protected Map<String,DataRegion> |
dataRegionMap |
protected boolean |
dataRegionsInitialized |
protected DataRegion |
dfltDataRegion |
protected Map<String,CacheFreeList> |
freeListMap |
static Set<String> |
INTERNAL_DATA_REGION_NAMES
DataRegionConfiguration names reserved for various internal needs.
|
protected boolean |
reuseMemory
True to reuse memory on deactive. |
static String |
SYSTEM_DATA_REGION_NAME
DataRegionConfiguration name reserved for internal caches.
|
cctx, diagnosticLog, log| Constructor and Description |
|---|
IgniteCacheDatabaseSharedManager() |
| Modifier and Type | Method and Description |
|---|---|
DataRegion |
addDataRegion(DataStorageConfiguration dataStorageCfg,
DataRegionConfiguration dataRegionCfg,
boolean trackable) |
protected DataRegion |
addDataRegion(DataStorageConfiguration dataStorageCfg,
DataRegionConfiguration dataRegionCfg,
boolean trackable,
PageReadWriteManager pmPageMgr) |
void |
beforeExchange(GridDhtPartitionsExchangeFuture discoEvt) |
protected @Nullable File |
buildAllocPath(DataRegionConfiguration plc)
Builds allocation path for memory mapped file to be used with PageMemory.
|
protected File |
buildPath(String path,
String consId) |
protected void |
checkPageSize(DataStorageConfiguration memCfg) |
boolean |
checkpointLockIsHeldByThread() |
void |
checkpointReadLock()
No-op for non-persistent storage.
|
long |
checkpointReadLockTimeout() |
void |
checkpointReadLockTimeout(long val)
No-op for non-persistent storage.
|
void |
checkpointReadUnlock()
No-op for non-persistent storage.
|
protected void |
checkRegionEvictionProperties(DataRegionConfiguration regCfg,
DataStorageConfiguration dbCfg) |
void |
cleanupCheckpointDirectory()
Clean checkpoint directory
CheckpointMarkersStorage.cpDir. |
void |
cleanupRestoredCaches()
Method will perform cleanup cache page memory and each cache partition store.
|
void |
cleanupTempCheckpointDirectory()
No-op for non-persistent storage.
|
protected PageEvictionTracker |
createPageEvictionTracker(DataRegionConfiguration plc,
PageMemory pageMem) |
protected PageMemory |
createPageMemory(DirectMemoryProvider memProvider,
DataStorageConfiguration memCfg,
DataRegionConfiguration memPlcCfg,
DataRegionMetricsImpl memMetrics,
boolean trackable,
PageReadWriteManager pmPageMgr)
Creates PageMemory with given size and memory provider.
|
@Nullable DataRegion |
dataRegion(@Nullable String memPlcName)
Getting data region by name.
|
protected DataRegionMetricsProvider |
dataRegionMetricsProvider(DataRegionConfiguration dataRegCfg)
Provide that can be used to compute some metrics for provided data region.
|
Collection<DataRegion> |
dataRegions()
Getting registered data regions.
|
void |
dumpStatistics(IgniteLogger log) |
void |
ensureFreeSpace(DataRegion memPlc)
See
GridCacheMapEntry#ensureFreeSpace() |
void |
ensureFreeSpaceForInsert(DataRegion region,
int dataRowSize)
Checks that the given
region has enough space for putting a new entry. |
@Nullable CheckpointProgress |
forceCheckpoint(String reason)
Schedule a new checkpoint.
|
<R> @Nullable CheckpointProgress |
forceNewCheckpoint(String reason,
IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
Schedule a new checkpoint.
|
Collection<GridCacheContext> |
forceRebuildIndexes(Collection<GridCacheContext> contexts)
Initiate an asynchronous forced index rebuild for caches.
|
FreeList |
freeList(String memPlcName) |
protected IgniteOutClosure<Long> |
freeSpaceProvider(DataRegionConfiguration dataRegCfg)
Deprecated.
use
dataRegionMetricsProvider(DataRegionConfiguration) instead. |
protected List<DatabaseLifecycleListener> |
getDatabaseListeners(GridKernalContext kctx) |
protected void |
initAndStartRegions(DataStorageConfiguration cfg) |
protected void |
initDataRegions(DataStorageConfiguration memCfg) |
protected void |
initDataRegions0(DataStorageConfiguration memCfg) |
protected void |
initPageMemoryDataStructures(DataStorageConfiguration dbCfg) |
void |
lastCheckpointInapplicableForWalRebalance(int grpId)
Marks last checkpoint as inapplicable for WAL rebalance for given group
grpId. |
@Nullable WALPointer |
lastCheckpointMarkWalPointer() |
WALPointer |
latestWalPointerReservedForPreloading()
Returns the latest WAL pointer that reserved for preloading or
null. |
Collection<DataRegionMetrics> |
memoryMetrics() |
@Nullable DataRegionMetrics |
memoryMetrics(String dataRegionName) |
MetaStorage |
metaStorage() |
void |
notifyMetaStorageSubscribersOnReadyForRead()
Notifies
MetastorageLifecycleListener that MetaStorage is ready for read. |
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onCacheGroupsStopped(Collection<IgniteBiTuple<CacheGroupContext,Boolean>> stoppedGrps) |
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
onStateRestored(AffinityTopologyVersion topVer)
Called when all partitions have been fully restored and pre-created on node start.
|
int |
pageSize() |
DataStorageMetrics |
persistentStoreMetrics() |
void |
prepareCachesStop()
Needed action before any cache will stop
|
void |
rebuildIndexesIfNeeded(GridDhtPartitionsExchangeFuture fut) |
protected <T> void |
registerMetricsMBean(IgniteConfiguration cfg,
String groupName,
String dataRegionName,
T impl,
Class<T> clazz) |
protected void |
registerMetricsMBeans(IgniteConfiguration cfg)
Registers MBeans for all DataRegionMetrics configured in this instance.
|
void |
releaseHistoryForExchange()
Release reserved update history.
|
void |
releaseHistoryForPreloading()
Release reserved update history.
|
Map<Integer,Map<Integer,Long>> |
reserveHistoryForExchange()
Reserve update history for exchange.
|
boolean |
reserveHistoryForPreloading(Map<T2<Integer,Integer>,Long> reservationMap)
Reserve update history for preloading.
|
ReuseList |
reuseList(String memPlcName) |
protected void |
setPageSize(int pageSize)
Method for fake (standalone) context initialization.
|
protected void |
start0() |
void |
startMemoryRestore(GridKernalContext kctx,
TimeBag startTimer)
Perform memory restore before
GridDiscoveryManager start. |
protected void |
stop0(boolean cancel) |
boolean |
supportsMemoryReuse(DataRegionConfiguration plcCfg) |
String |
systemDateRegionName() |
protected void |
unregisterMetricsMBean(IgniteConfiguration cfg,
String groupName,
String name) |
void |
waitForCheckpoint(String reason)
Waits until current state is checkpointed.
|
<R> void |
waitForCheckpoint(String reason,
IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
Waits until current state is checkpointed and execution listeners after finish.
|
@Nullable IgniteInternalFuture |
wakeupForCheckpoint(String reason) |
boolean |
walEnabled(int grpId,
boolean local) |
void |
walEnabled(int grpId,
boolean enabled,
boolean local)
Marks cache group as with disabled WAL.
|
context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, onKernalStop0, onReconnected, printMemoryStats, start, startInfo, stop, stopInfo, toStringpublic static final String SYSTEM_DATA_REGION_NAME
public static Set<String> INTERNAL_DATA_REGION_NAMES
public static final String DATA_REGION_PAGE_LIST_VIEW
public static final String DATA_REGION_PAGE_LIST_VIEW_DESC
protected final boolean reuseMemory
True to reuse memory on deactive.protected final Map<String,DataRegion> dataRegionMap
protected volatile boolean dataRegionsInitialized
protected DataRegion dfltDataRegion
protected Map<String,CacheFreeList> freeListMap
protected void start0()
throws IgniteCheckedException
start0 in class GridCacheSharedManagerAdapterIgniteCheckedException - If failed.protected <T> void registerMetricsMBean(IgniteConfiguration cfg, String groupName, String dataRegionName, T impl, Class<T> clazz)
cfg - Ignite configuration.groupName - Name of group.dataRegionName - Metrics MBean name.impl - Metrics implementation.clazz - Metrics class type.protected void unregisterMetricsMBean(IgniteConfiguration cfg, String groupName, String name)
cfg - Ignite configuration.groupName - Name of group.name - Name of MBean.protected void registerMetricsMBeans(IgniteConfiguration cfg)
cfg - Ignite configuration.protected void initPageMemoryDataStructures(DataStorageConfiguration dbCfg) throws IgniteCheckedException
dbCfg - Database config.IgniteCheckedException - If failed.public int pageSize()
protected void initDataRegions(DataStorageConfiguration memCfg) throws IgniteCheckedException
memCfg - Database config.IgniteCheckedException - If failed to initialize swap path.protected void initDataRegions0(DataStorageConfiguration memCfg) throws IgniteCheckedException
memCfg - Database config.IgniteCheckedException - If failed to initialize swap path.protected List<DatabaseLifecycleListener> getDatabaseListeners(GridKernalContext kctx)
kctx - Kernal context.public DataRegion addDataRegion(DataStorageConfiguration dataStorageCfg, DataRegionConfiguration dataRegionCfg, boolean trackable) throws IgniteCheckedException
dataStorageCfg - Database config.dataRegionCfg - Data region config.IgniteCheckedException - If failed to initialize swap path.protected DataRegion addDataRegion(DataStorageConfiguration dataStorageCfg, DataRegionConfiguration dataRegionCfg, boolean trackable, PageReadWriteManager pmPageMgr) throws IgniteCheckedException
dataStorageCfg - Database config.dataRegionCfg - Data region config.pmPageMgr - Page manager.IgniteCheckedException - If failed to initialize swap path.@Deprecated protected IgniteOutClosure<Long> freeSpaceProvider(DataRegionConfiguration dataRegCfg)
dataRegionMetricsProvider(DataRegionConfiguration) instead.dataRegCfg - Data region configuration.protected DataRegionMetricsProvider dataRegionMetricsProvider(DataRegionConfiguration dataRegCfg)
dataRegCfg - Data region configuration.protected void checkPageSize(DataStorageConfiguration memCfg)
memCfg - Memory config.protected void checkRegionEvictionProperties(DataRegionConfiguration regCfg, DataStorageConfiguration dbCfg) throws IgniteCheckedException
regCfg - DataRegionConfiguration to validate.dbCfg - Memory configuration.IgniteCheckedException - If config is invalid.public void dumpStatistics(IgniteLogger log)
log - Logger.public Collection<DataRegion> dataRegions()
policies.public Collection<DataRegionMetrics> memoryMetrics()
public DataStorageMetrics persistentStoreMetrics()
null otherwise.@Nullable public @Nullable DataRegionMetrics memoryMetrics(String dataRegionName)
dataRegionName - Name of DataRegion to obtain DataRegionMetrics for.DataRegionMetrics snapshot for specified DataRegion or null if
no DataRegion is configured for specified name.@Nullable public @Nullable DataRegion dataRegion(@Nullable @Nullable String memPlcName) throws IgniteCheckedException
memPlcName - Data region name. In case of null, default data region will be returned.DataRegion instance associated with a given DataRegionConfiguration,
or null if there are no registered data regions.IgniteCheckedException - in case of request for unknown DataRegion.public FreeList freeList(String memPlcName)
memPlcName - DataRegionConfiguration name.FreeList instance associated with a given DataRegionConfiguration.public ReuseList reuseList(String memPlcName)
memPlcName - DataRegionConfiguration name.ReuseList instance associated with a given DataRegionConfiguration.protected void stop0(boolean cancel)
stop0 in class GridCacheSharedManagerAdaptercancel - Cancel flag.public boolean checkpointLockIsHeldByThread()
checkpointLockIsHeldByThread in interface CheckpointLockStateCheckerpublic void checkpointReadLock()
public void checkpointReadUnlock()
public long checkpointReadLockTimeout()
0 for non-persistent storage.public void checkpointReadLockTimeout(long val)
public void cleanupRestoredCaches()
public void cleanupCheckpointDirectory()
throws IgniteCheckedException
CheckpointMarkersStorage.cpDir. The operation
is necessary when local node joined to baseline topology with different consistentId.IgniteCheckedExceptionpublic void cleanupTempCheckpointDirectory()
throws IgniteCheckedException
IgniteCheckedException@Nullable public @Nullable IgniteInternalFuture wakeupForCheckpoint(String reason)
@Nullable public @Nullable WALPointer lastCheckpointMarkWalPointer()
@Nullable public @Nullable CheckpointProgress forceCheckpoint(String reason)
Note: if a checkpoint is already running and the locks have not been taken yet, then a new checkpoint will not be forced.
reason - Reason.@Nullable public <R> @Nullable CheckpointProgress forceNewCheckpoint(String reason, IgniteInClosure<? super IgniteInternalFuture<R>> lsnr)
reason - Reason.lsnr - Listener which will be called on scheduled checkpoint finish.public void waitForCheckpoint(String reason) throws IgniteCheckedException
IgniteCheckedException - If failed.public <R> void waitForCheckpoint(String reason, IgniteInClosure<? super IgniteInternalFuture<R>> lsnr) throws IgniteCheckedException
reason - Reason for checkpoint wakeup if it would be required.lsnr - Listeners which should be called in checkpoint thread after current checkpoint finished.IgniteCheckedException - If failed.public void beforeExchange(GridDhtPartitionsExchangeFuture discoEvt) throws IgniteCheckedException
discoEvt - Before exchange for the given discovery event.IgniteCheckedExceptionpublic void startMemoryRestore(GridKernalContext kctx, TimeBag startTimer) throws IgniteCheckedException
GridDiscoveryManager start.kctx - Current kernal context.startTimer - Holder of start time of stages.IgniteCheckedException - If fails.public void onStateRestored(AffinityTopologyVersion topVer) throws IgniteCheckedException
IgniteCheckedException - If failed.public void rebuildIndexesIfNeeded(GridDhtPartitionsExchangeFuture fut)
fut - Partition exchange future.public Collection<GridCacheContext> forceRebuildIndexes(Collection<GridCacheContext> contexts)
contexts - Cache contexts.public void prepareCachesStop()
public void onCacheGroupsStopped(Collection<IgniteBiTuple<CacheGroupContext,Boolean>> stoppedGrps)
stoppedGrps - A collection of tuples (cache group, destroy flag).public Map<Integer,Map<Integer,Long>> reserveHistoryForExchange()
public void releaseHistoryForExchange()
public boolean reserveHistoryForPreloading(Map<T2<Integer,Integer>,Long> reservationMap)
reservationMap - Map contains of counters for partitions of groups.public void releaseHistoryForPreloading()
public WALPointer latestWalPointerReservedForPreloading()
null.null if nothing reserved.public void ensureFreeSpaceForInsert(DataRegion region, int dataRowSize) throws IgniteOutOfMemoryException
region has enough space for putting a new entry.
This method makes sense then and only then
the data region is not persisted DataRegionConfiguration.isPersistenceEnabled()
and page eviction is disabled DataPageEvictionMode.DISABLED.
The non-persistent region should reserve a number of pages to support a free list AbstractFreeList.
For example, removing a row from underlying store may require allocating a new data page
in order to move a tracked page from one bucket to another one which does not have a free space for a new stripe.
See AbstractFreeList.removeDataRowByLink(long, org.apache.ignite.internal.metric.IoStatisticsHolder).
Therefore, inserting a new entry should be prevented in case of some threshold is exceeded.region - Data region to be checked.dataRowSize - Size of data row to be inserted.IgniteOutOfMemoryException - In case of the given data region does not have enough free space
for putting a new entry.public void ensureFreeSpace(DataRegion memPlc) throws IgniteCheckedException
GridCacheMapEntry#ensureFreeSpace()memPlc - data region.IgniteCheckedExceptionpublic boolean supportsMemoryReuse(DataRegionConfiguration plcCfg)
plcCfg - Policy config.True if policy supports memory reuse.protected PageEvictionTracker createPageEvictionTracker(DataRegionConfiguration plc, PageMemory pageMem)
plc - data region Configuration.pageMem - Page memory.@Nullable protected @Nullable File buildAllocPath(DataRegionConfiguration plc) throws IgniteCheckedException
plc - DataRegionConfiguration.IgniteCheckedException - If resolving swap directory fails.protected PageMemory createPageMemory(DirectMemoryProvider memProvider, DataStorageConfiguration memCfg, DataRegionConfiguration memPlcCfg, DataRegionMetricsImpl memMetrics, boolean trackable, PageReadWriteManager pmPageMgr)
memProvider - Memory provider.memCfg - Memory configuartion.memPlcCfg - data region configuration.memMetrics - DataRegionMetrics to collect memory usage metrics.pmPageMgr - Page manager.protected File buildPath(String path, String consId) throws IgniteCheckedException
path - Path to the working directory.consId - Consistent ID of the local node.IgniteCheckedException - If resolving swap directory fails.public void onActivate(GridKernalContext kctx) throws IgniteCheckedException
onActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.IgniteCheckedException - If failed.protected void initAndStartRegions(DataStorageConfiguration cfg) throws IgniteCheckedException
cfg - Current data storage configuration.IgniteCheckedException - If fails.public void onDeActivate(GridKernalContext kctx)
onDeActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.public String systemDateRegionName()
protected void setPageSize(int pageSize)
pageSize - configured page sizepublic MetaStorage metaStorage()
public void notifyMetaStorageSubscribersOnReadyForRead()
throws IgniteCheckedException
MetastorageLifecycleListener that MetaStorage is ready for read.
This method is called when all processors and managers have already started and right before discovery manager.IgniteCheckedException - If failed.public boolean walEnabled(int grpId,
boolean local)
grpId - Group ID.public void walEnabled(int grpId,
boolean enabled,
boolean local)
grpId - Group id.enabled - flag.public void lastCheckpointInapplicableForWalRebalance(int grpId)
grpId.grpId - Group id.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.0 Release Date : September 11 2021