org.apache.ignite.internal.processors.cache

## Class WalStateManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter
  - - org.apache.ignite.internal.processors.cache.WalStateManager

All Implemented Interfaces:
  GridCacheSharedManager

    public class WalStateManager
    extends GridCacheSharedManagerAdapter

Write-ahead log state manager. Manages WAL enable and disable.

### Nested Class Summary

Nested Classes
`static class` `WalStateManager.WALDisableContext`

### Field Summary

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

`cctx, diagnosticLog`

### Constructor Summary

Constructors
Constructor and Description
`WalStateManager(GridKernalContext kernalCtx)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `changeLocalStatesOnExchangeDone(AffinityTopologyVersion topVer, boolean changedBaseline)` Change local WAL state before exchange is done.
`IgniteInternalFuture<Boolean>` `init(Collection<String> cacheNames, boolean enabled)` Initiate WAL mode change operation.
`boolean` `isDisabled(int grpId)` Checks WAL disabled for cache group.
`void` `onAck(WalStateAckMessage msg)` Handle ack message.
`void` `onCachesInfoCollected()` Callback invoked when caches info is collected inside cache processor start routine.
`void` `onDisconnected(IgniteFuture reconnectFut)`
`void` `onFinishDiscovery(WalStateFinishMessage msg)` Handle finish message in discovery thread.
`void` `onGroupRebalanceFinished(int grpId, AffinityTopologyVersion topVer)` Callback when group rebalancing is finished.
`void` `onKernalStart()` Handle cache processor kernal start.
`void` `onNodeLeft(UUID nodeId)` Handle node leave event.
`void` `onProposeDiscovery(WalStateProposeMessage msg)` Handle propose message in discovery thread.
`void` `onProposeExchange(WalStateProposeMessage msg)` Handle propose message which is synchronized with other cache state actions through exchange thread.
`void` `onReconnected(boolean active)`
`boolean` `prohibitWALDisabling()` Reports whether WAL disabling with subsequent `init(Collection, boolean)` is denied.
`void` `prohibitWALDisabling(boolean val)` Denies or allows WAL disabling with subsequent `init(Collection, boolean)` call.
`void` `runWithOutWAL(IgniteRunnable cls)` None record will be logged in closure call.
`protected void` `start0()`
`protected void` `stop0(boolean cancel)`
`WalStateManager.WALDisableContext` `walDisableContext()`

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

`context, isStopping, kernalStartInfo, kernalStopInfo, log, onKernalStart, onKernalStart0, onKernalStop, onKernalStop0, printMemoryStats, start, startInfo, stop, stopInfo, toString`

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

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

### Constructor Detail

#### WalStateManager

    public WalStateManager(GridKernalContext kernalCtx)

Constructor.

Parameters:
  `kernalCtx` - Kernal context.

### Method Detail

#### start0

    protected void start0()
                   throws IgniteCheckedException

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

#### stop0

    protected void stop0(boolean cancel)

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

#### onCachesInfoCollected

    public void onCachesInfoCollected()

Callback invoked when caches info is collected inside cache processor start routine. Discovery is not active at this point.

#### onKernalStart

    public void onKernalStart()

Handle cache processor kernal start. At this point we already collected discovery data from other nodes (discovery already active), but exchange worker is not active yet. We need to iterate over available group descriptors and perform top operations, taking in count that no cache operations are possible at this point, so checkpoint is not needed.

#### onDisconnected

    public void onDisconnected(IgniteFuture reconnectFut)

Specified by:
  `onDisconnected` in interface `GridCacheSharedManager`
Overrides:
  `onDisconnected` in class `GridCacheSharedManagerAdapter`
Parameters:
  `reconnectFut` - Reconnect future.

#### onReconnected

    public void onReconnected(boolean active)

Specified by:
  `onReconnected` in interface `GridCacheSharedManager`
Overrides:
  `onReconnected` in class `GridCacheSharedManagerAdapter`
Parameters:
  `active` - Active flag.

#### prohibitWALDisabling

    public void prohibitWALDisabling(boolean val)

Denies or allows WAL disabling with subsequent `init(Collection, boolean)` call.

Parameters:
  `val` - denial status.

#### prohibitWALDisabling

    public boolean prohibitWALDisabling()

Reports whether WAL disabling with subsequent `init(Collection, boolean)` is denied.

Returns:
  denial status.

#### init

    public IgniteInternalFuture<Boolean> init(Collection<String> cacheNames,
                                              boolean enabled)

Initiate WAL mode change operation.

Parameters:
  `cacheNames` - Cache names.
  `enabled` - Enabled flag.
Returns:
  Future completed when operation finished.

#### changeLocalStatesOnExchangeDone

    public void changeLocalStatesOnExchangeDone(AffinityTopologyVersion topVer,
                                                boolean changedBaseline)

Change local WAL state before exchange is done. This method will disable WAL for groups without partitions in OWNING state if such feature is enabled.

Parameters:
  `topVer` - Topology version.
  `changedBaseline` - The exchange is caused by Baseline Topology change.

#### onGroupRebalanceFinished

    public void onGroupRebalanceFinished(int grpId,
                                         AffinityTopologyVersion topVer)

Callback when group rebalancing is finished. If there are no pending groups, it should trigger checkpoint and change partition states.

Parameters:
  `grpId` - Group ID.
  `topVer` - Topology version.

#### onProposeDiscovery

    public void onProposeDiscovery(WalStateProposeMessage msg)

Handle propose message in discovery thread.

Parameters:
  `msg` - Message.

#### onProposeExchange

    public void onProposeExchange(WalStateProposeMessage msg)

Handle propose message which is synchronized with other cache state actions through exchange thread. If operation is no-op (i.e. state is not changed), then no additional processing is needed, and coordinator will trigger finish request right away. Otherwise all nodes start asynchronous checkpoint flush, and send responses to coordinator. Once all responses are received, coordinator node will trigger finish message.

Parameters:
  `msg` - Message.

#### onAck

    public void onAck(WalStateAckMessage msg)

Handle ack message.

Parameters:
  `msg` - Ack message.

#### onFinishDiscovery

    public void onFinishDiscovery(WalStateFinishMessage msg)

Handle finish message in discovery thread.

Parameters:
  `msg` - Message.

#### onNodeLeft

    public void onNodeLeft(UUID nodeId)

Handle node leave event.

Parameters:
  `nodeId` - Node ID.

#### isDisabled

    public boolean isDisabled(int grpId)

Checks WAL disabled for cache group.

Parameters:
  `grpId` - Group id.
Returns:
  `True` if WAL disable for group. `False` If not.

#### walDisableContext

    public WalStateManager.WALDisableContext walDisableContext()

Returns:
  WAL disable context.

#### runWithOutWAL

    public void runWithOutWAL(IgniteRunnable cls)
                       throws IgniteCheckedException

None record will be logged in closure call.

Parameters:
  `cls` - Closure to execute out of WAL scope.
Throws:
  `IgniteCheckedException` - If operation failed.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.1
Release Date | : May 21 2020