org.apache.ignite.internal.processors.cache.persistence

## Class GridCacheDatabaseSharedManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
  - - org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager
    - - org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager

All Implemented Interfaces:
  GridCacheSharedManager, CheckpointLockStateChecker, IgniteChangeGlobalStateSupport

    public class GridCacheDatabaseSharedManager
    extends IgniteCacheDatabaseSharedManager

### Nested Class Summary

Nested Classes
`class` `GridCacheDatabaseSharedManager.Checkpointer`
`class` `GridCacheDatabaseSharedManager.CheckpointHistory` Checkpoint history.

### Field Summary

Fields
`static Long` `DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE` Default checkpointing page buffer size (may be adjusted by Ignite).
`static String` `IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC`

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager

`dfltMemPlc, memMetricsMap, memPlcMap`

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`cctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheDatabaseSharedManager(GridKernalContext ctx)`

### Method Summary

Methods
`void` `addCheckpointListener(DbCheckpointListener lsnr)`
`void` `beforeExchange(GridDhtPartitionsExchangeFuture fut)`
`static long` `checkpointBufferSize(IgniteConfiguration cfg)` Get checkpoint buffer size for the given configuration.
`File` `checkpointDirectory()`
`GridCacheDatabaseSharedManager.CheckpointHistory` `checkpointHistory()`
`boolean` `checkpointLockIsHeldByThread()`
`void` `checkpointReadLock()` Gets the checkpoint read lock.
`void` `checkpointReadUnlock()` Releases the checkpoint read lock.
`protected void` `checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg, MemoryConfiguration dbCfg)`
`protected PageMemory` `createPageMemory(DirectMemoryProvider memProvider, MemoryConfiguration memCfg, MemoryPolicyConfiguration plcCfg, MemoryMetricsImpl memMetrics)` Creates PageMemory with given size and memory provider.
`IgniteInternalFuture<Void>` `enableCheckpoints(boolean enable)` For test use only.
`GridCacheDatabaseSharedManager.Checkpointer` `getCheckpointer()`
`IgniteInternalFuture` `indexRebuildFuture(int cacheId)`
`protected void` `initPageMemoryDataStructures(MemoryConfiguration dbCfg)`
`void` `lock()`
`void` `onActivate(GridKernalContext ctx)` Called when cluster performing activation.
`void` `onCacheGroupsStopped(Collection<IgniteBiTuple<CacheGroupContext,Boolean>> stoppedGrps)`
`void` `onDeActivate(GridKernalContext kctx)` Called when cluster performing deactivation.
`protected void` `onKernalStop0(boolean cancel)`
`boolean` `persistenceEnabled()`
`PersistenceMetrics` `persistentStoreMetrics()`
`PersistenceMetricsImpl` `persistentStoreMetricsImpl()`
`void` `readCheckpointAndRestoreMemory(List<DynamicCacheDescriptor> cachesToStart)`
`void` `releaseHistoryForExchange()` Release reserved update history.
`void` `releaseHistoryForPreloading()` Release reserved update history.
`void` `removeCheckpointListener(DbCheckpointListener lsnr)`
`Map<T2<Integer,Integer>,T2<Long,WALPointer>>` `reservedForPreloading()` For debugging only.
`Map<Integer,Map<Integer,Long>>` `reserveHistoryForExchange()` Reserve update history for exchange.
`boolean` `reserveHistoryForPreloading(int grpId, int partId, long cntr)` Reserve update history for preloading.
`WALPointer` `searchPartitionCounter(int grpId, int part, Long partCntrSince)` Tries to search for a WAL pointer for the given partition counter start.
`protected void` `start0()`
`void` `unLock()`
`void` `waitForCheckpoint(String reason)` Waits until current state is checkpointed.
`IgniteInternalFuture` `wakeupForCheckpoint(String reason)`

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager

`buildAllocPath, buildPath, dumpStatistics, ensureFreeSpace, freeList, initPageMemoryPolicies, memoryMetrics, memoryMetrics, memoryPolicies, memoryPolicy, pageSize, prepareCachesStop, reuseList, setPageSize, stop0, systemMemoryPolicyName`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter

`context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStop, printMemoryStats, start, startInfo, stop, stopInfo, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC

    public static final String IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC

See Also:
  Constant Field Values

#### DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE

    public static final Long DFLT_CHECKPOINTING_PAGE_BUFFER_SIZE

Default checkpointing page buffer size (may be adjusted by Ignite).

### Constructor Detail

#### GridCacheDatabaseSharedManager

    public GridCacheDatabaseSharedManager(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### getCheckpointer

    public GridCacheDatabaseSharedManager.Checkpointer getCheckpointer()

#### enableCheckpoints

    public IgniteInternalFuture<Void> enableCheckpoints(boolean enable)

For test use only.

#### start0

    protected void start0()
                   throws IgniteCheckedException

Overrides:
  `start0` in class `IgniteCacheDatabaseSharedManager`
Throws:
  `IgniteCheckedException` - If failed.

#### checkpointBufferSize

    public static long checkpointBufferSize(IgniteConfiguration cfg)

Get checkpoint buffer size for the given configuration.

Parameters:
  `cfg` - Configuration.
Returns:
  Checkpoint buffer size.

#### initPageMemoryDataStructures

    protected void initPageMemoryDataStructures(MemoryConfiguration dbCfg)
                                         throws IgniteCheckedException

Overrides:
  `initPageMemoryDataStructures` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `dbCfg` - Database config.
Throws:
  `IgniteCheckedException` - If failed.

#### onActivate

    public void onActivate(GridKernalContext ctx)
                    throws IgniteCheckedException

Called when cluster performing activation.

Specified by:
  `onActivate` in interface `IgniteChangeGlobalStateSupport`
Overrides:
  `onActivate` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `ctx` - Kernal context.
Throws:
  `IgniteCheckedException` - If failed.

#### onDeActivate

    public void onDeActivate(GridKernalContext kctx)

Called when cluster performing deactivation.

Specified by:
  `onDeActivate` in interface `IgniteChangeGlobalStateSupport`
Overrides:
  `onDeActivate` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `kctx` - Kernal context.

#### readCheckpointAndRestoreMemory

    public void readCheckpointAndRestoreMemory(List<DynamicCacheDescriptor> cachesToStart)
                                        throws IgniteCheckedException

Overrides:
  `readCheckpointAndRestoreMemory` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `cachesToStart` - Started caches.
Throws:
  `IgniteCheckedException` - If failed.

#### lock

    public void lock()
              throws IgniteCheckedException

Overrides:
  `lock` in class `IgniteCacheDatabaseSharedManager`
Throws:
  `IgniteCheckedException`

#### unLock

    public void unLock()

Overrides:
  `unLock` in class `IgniteCacheDatabaseSharedManager`

#### onKernalStop0

    protected void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `GridCacheSharedManagerAdapter`
Parameters:
  `cancel` - Cancel flag.

#### createPageMemory

    protected PageMemory createPageMemory(DirectMemoryProvider memProvider,
                              MemoryConfiguration memCfg,
                              MemoryPolicyConfiguration plcCfg,
                              MemoryMetricsImpl memMetrics)

Creates PageMemory with given size and memory provider.

Overrides:
  `createPageMemory` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `memProvider` - Memory provider.
  `memCfg` - Memory configuartion.
  `plcCfg` - Memory policy configuration.
  `memMetrics` - MemoryMetrics to collect memory usage metrics.
Returns:
  PageMemory instance.

#### checkPolicyEvictionProperties

    protected void checkPolicyEvictionProperties(MemoryPolicyConfiguration plcCfg,
                                     MemoryConfiguration dbCfg)
                                          throws IgniteCheckedException

Overrides:
  `checkPolicyEvictionProperties` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `plcCfg` - MemoryPolicyConfiguration to validate.
  `dbCfg` - Memory configuration.
Throws:
  `IgniteCheckedException` - If config is invalid.

#### beforeExchange

    public void beforeExchange(GridDhtPartitionsExchangeFuture fut)
                        throws IgniteCheckedException

Overrides:
  `beforeExchange` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `fut` - Before exchange for the given discovery event.
Throws:
  `IgniteCheckedException`

#### indexRebuildFuture

    @Nullable
    public IgniteInternalFuture indexRebuildFuture(int cacheId)

Overrides:
  `indexRebuildFuture` in class `IgniteCacheDatabaseSharedManager`
Returns:
  Future that will be completed when indexes for given cache are restored.

#### persistenceEnabled

    public boolean persistenceEnabled()

Overrides:
  `persistenceEnabled` in class `IgniteCacheDatabaseSharedManager`

#### onCacheGroupsStopped

    public void onCacheGroupsStopped(Collection<IgniteBiTuple<CacheGroupContext,Boolean>> stoppedGrps)

Overrides:
  `onCacheGroupsStopped` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `stoppedGrps` - A collection of tuples (cache group, destroy flag).

#### checkpointReadLock

    public void checkpointReadLock()

Gets the checkpoint read lock. While this lock is held, checkpoint thread will not acquiSnapshotWorkerre memory state.

Overrides:
  `checkpointReadLock` in class `IgniteCacheDatabaseSharedManager`

#### checkpointLockIsHeldByThread

    public boolean checkpointLockIsHeldByThread()

Specified by:
  `checkpointLockIsHeldByThread` in interface `CheckpointLockStateChecker`
Overrides:
  `checkpointLockIsHeldByThread` in class `IgniteCacheDatabaseSharedManager`
Returns:
  true if checkpoint lock is held by current thread

#### checkpointReadUnlock

    public void checkpointReadUnlock()

Releases the checkpoint read lock.

Overrides:
  `checkpointReadUnlock` in class `IgniteCacheDatabaseSharedManager`

#### reserveHistoryForExchange

    public Map<Integer,Map<Integer,Long>> reserveHistoryForExchange()

Reserve update history for exchange.

Overrides:
  `reserveHistoryForExchange` in class `IgniteCacheDatabaseSharedManager`
Returns:
  Reserved update counters per cache and partition.

#### releaseHistoryForExchange

    public void releaseHistoryForExchange()

Release reserved update history.

Overrides:
  `releaseHistoryForExchange` in class `IgniteCacheDatabaseSharedManager`

#### reserveHistoryForPreloading

    public boolean reserveHistoryForPreloading(int grpId,
                                      int partId,
                                      long cntr)

Reserve update history for preloading.

Overrides:
  `reserveHistoryForPreloading` in class `IgniteCacheDatabaseSharedManager`
Parameters:
  `grpId` - Cache group ID.
  `partId` - Partition Id.
  `cntr` - Update counter.
Returns:
  True if successfully reserved.

#### releaseHistoryForPreloading

    public void releaseHistoryForPreloading()

Release reserved update history.

Overrides:
  `releaseHistoryForPreloading` in class `IgniteCacheDatabaseSharedManager`

#### reservedForPreloading

    public Map<T2<Integer,Integer>,T2<Long,WALPointer>> reservedForPreloading()

For debugging only. TODO: remove.

#### wakeupForCheckpoint

    @Nullable
    public IgniteInternalFuture wakeupForCheckpoint(String reason)

Overrides:
  `wakeupForCheckpoint` in class `IgniteCacheDatabaseSharedManager`

#### waitForCheckpoint

    public void waitForCheckpoint(String reason)
                           throws IgniteCheckedException

Waits until current state is checkpointed.

Overrides:
  `waitForCheckpoint` in class `IgniteCacheDatabaseSharedManager`
Throws:
  `IgniteCheckedException` - If failed.

#### searchPartitionCounter

    @Nullable
    public WALPointer searchPartitionCounter(int grpId,
                                             int part,
                                             @Nullable
                                             Long partCntrSince)

Tries to search for a WAL pointer for the given partition counter start.

Parameters:
  `grpId` - Cache group ID.
  `part` - Partition ID.
  `partCntrSince` - Partition counter or `null` to search for minimal counter.
Returns:
  Checkpoint entry or `null` if failed to search.

#### checkpointHistory

    public GridCacheDatabaseSharedManager.CheckpointHistory checkpointHistory()

Returns:
  Checkpoint history. For tests only.

#### checkpointDirectory

    public File checkpointDirectory()

Returns:
  Checkpoint directory.

#### addCheckpointListener

    public void addCheckpointListener(DbCheckpointListener lsnr)

Parameters:
  `lsnr` - Listener.

#### removeCheckpointListener

    public void removeCheckpointListener(DbCheckpointListener lsnr)

Parameters:
  `lsnr` - Listener.

#### persistentStoreMetrics

    public PersistenceMetrics persistentStoreMetrics()

Overrides:
  `persistentStoreMetrics` in class `IgniteCacheDatabaseSharedManager`
Returns:
  PersistenceMetrics if persistence is enabled or `null` otherwise.

#### persistentStoreMetricsImpl

    public PersistenceMetricsImpl persistentStoreMetricsImpl()

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017