org.apache.ignite.internal.processors.cache.mvcc

## Class MvccProcessorImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter
  - - org.apache.ignite.internal.processors.cache.mvcc.MvccProcessorImpl

All Implemented Interfaces:
  GridComponent, MvccProcessor, DatabaseLifecycleListener, GridProcessor

    public class MvccProcessorImpl
    extends GridProcessorAdapter
    implements MvccProcessor, DatabaseLifecycleListener

MVCC processor.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, diagnosticLog, log`

### Constructor Summary

Constructors
Constructor and Description
`MvccProcessorImpl(GridKernalContext ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `ackQueryDone(MvccSnapshot snapshot, long qryId)`
`IgniteInternalFuture<Void>` `ackTxCommit(MvccSnapshot updateVer)`
`IgniteInternalFuture<Void>` `ackTxCommit(MvccVersion updateVer, MvccSnapshot readSnapshot, long qryId)`
`void` `ackTxRollback(MvccVersion updateVer)`
`void` `ackTxRollback(MvccVersion updateVer, MvccSnapshot readSnapshot, long qryTrackerId)`
`void` `addQueryTracker(MvccQueryTracker tracker)`
`void` `afterInitialise(IgniteCacheDatabaseSharedManager mgr)`
`void` `afterMemoryRestore(IgniteCacheDatabaseSharedManager mgr)`
`MvccCoordinator` `assignedCoordinator()`
`void` `beforeMemoryRestore(IgniteCacheDatabaseSharedManager mgr)`
`void` `beforeStop(IgniteCacheDatabaseSharedManager mgr)`
`MvccCoordinator` `currentCoordinator()`
`MvccCoordinator` `currentCoordinator(AffinityTopologyVersion topVer)` Check that the given topology is greater or equals to coordinator's one and returns current coordinator.
`UUID` `currentCoordinatorId()`
`void` `dumpDebugInfo(IgniteLogger log, IgniteDiagnosticPrepareContext diagCtx)`
`void` `ensureStarted()` Starts MVCC processor (i.e. initialises data structures and vacuum) if it has not been started yet.
`boolean` `hasLocalTransaction(long crd, long cntr)`
`boolean` `mvccEnabled()`
`void` `onDiscoveryEvent(int evtType, Collection<ClusterNode> nodes, long topVer, DiscoveryCustomMessage customMsg)`
`void` `onExchangeDone(boolean newCrd, DiscoCache discoCache, Map<UUID,GridLongList> activeQueries)` Exchange done callback.
`void` `onExchangeStart(MvccCoordinator mvccCrd, ExchangeContext exchCtx, ClusterNode exchCrd)` Exchange start callback.
`void` `onInitDataRegions(IgniteCacheDatabaseSharedManager mgr)`
`void` `preProcessCacheConfiguration(CacheConfiguration ccfg)` Pre-processes cache configuration before start.
`void` `processClientActiveQueries(UUID nodeId, GridLongList activeQueries)`
`void` `registerLocalTransaction(long crd, long cntr)`
`void` `removeQueryTracker(Long id)`
`IgniteInternalFuture<MvccSnapshot>` `requestSnapshotAsync(IgniteInternalTx tx)` Requests snapshot on Mvcc coordinator.
`void` `requestSnapshotAsync(IgniteInternalTx tx, MvccSnapshotResponseListener lsnr)` Requests snapshot on Mvcc coordinator.
`void` `requestSnapshotAsync(MvccSnapshotResponseListener lsnr)` Requests snapshot on Mvcc coordinator.
`void` `start()` Starts grid component.
`byte` `state(long crdVer, long cntr)`
`byte` `state(MvccVersion ver)`
`MvccSnapshot` `tryRequestSnapshotLocal()`
`MvccSnapshot` `tryRequestSnapshotLocal(IgniteInternalTx tx)`
`void` `updateCoordinator(MvccCoordinator curCrd)`
`void` `updateState(MvccVersion ver, byte state)`
`void` `updateState(MvccVersion ver, byte state, boolean primary)`
`void` `validateCacheConfiguration(CacheConfiguration ccfg)` Validates cache configuration before start.
`IgniteNodeValidationResult` `validateNode(ClusterNode node)` Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.
`IgniteInternalFuture<Void>` `waitFor(GridCacheContext cctx, MvccVersion locked)`
`IgniteInternalFuture<Void>` `waitTxsFuture(UUID crdId, GridLongList txs)`

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onKernalStop, onReconnected, printMemoryStats, stop, toString, validateNode`

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

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

### Methods inherited from interface org.apache.ignite.internal.GridComponent

`collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onKernalStop, onReconnected, printMemoryStats, stop, validateNode`

### Constructor Detail

#### MvccProcessorImpl

    public MvccProcessorImpl(GridKernalContext ctx)

Parameters:
  `ctx` - Context.

### Method Detail

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### mvccEnabled

    public boolean mvccEnabled()

Specified by:
  `mvccEnabled` in interface `MvccProcessor`
Returns:
  `True` if at least one cache with `CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT` mode is registered.

#### preProcessCacheConfiguration

    public void preProcessCacheConfiguration(CacheConfiguration ccfg)

Pre-processes cache configuration before start.

Specified by:
  `preProcessCacheConfiguration` in interface `MvccProcessor`
Parameters:
  `ccfg` - Cache configuration to pre-process.

#### validateCacheConfiguration

    public void validateCacheConfiguration(CacheConfiguration ccfg)

Validates cache configuration before start.

Specified by:
  `validateCacheConfiguration` in interface `MvccProcessor`
Parameters:
  `ccfg` - Cache configuration to validate.

#### validateNode

    @Nullable
    public IgniteNodeValidationResult validateNode(ClusterNode node)

Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.

Specified by:
  `validateNode` in interface `GridComponent`
Overrides:
  `validateNode` in class `GridProcessorAdapter`
Parameters:
  `node` - Joining node.
Returns:
  Validation result or `null` in case of success.

#### ensureStarted

    public void ensureStarted()
                       throws IgniteCheckedException

Starts MVCC processor (i.e. initialises data structures and vacuum) if it has not been started yet.

Specified by:
  `ensureStarted` in interface `MvccProcessor`
Throws:
  `IgniteCheckedException` - If failed to initialize.

#### beforeStop

    public void beforeStop(IgniteCacheDatabaseSharedManager mgr)

Specified by:
  `beforeStop` in interface `DatabaseLifecycleListener`
Parameters:
  `mgr` - Database shared manager.

#### onInitDataRegions

    public void onInitDataRegions(IgniteCacheDatabaseSharedManager mgr)
                           throws IgniteCheckedException

Specified by:
  `onInitDataRegions` in interface `DatabaseLifecycleListener`
Parameters:
  `mgr` - Database shared manager.
Throws:
  `IgniteCheckedException`

#### afterInitialise

    public void afterInitialise(IgniteCacheDatabaseSharedManager mgr)

Specified by:
  `afterInitialise` in interface `DatabaseLifecycleListener`
Parameters:
  `mgr` - Database shared manager.

#### beforeMemoryRestore

    public void beforeMemoryRestore(IgniteCacheDatabaseSharedManager mgr)
                             throws IgniteCheckedException

Specified by:
  `beforeMemoryRestore` in interface `DatabaseLifecycleListener`
Parameters:
  `mgr` - Page store manager.
Throws:
  `IgniteCheckedException`

#### afterMemoryRestore

    public void afterMemoryRestore(IgniteCacheDatabaseSharedManager mgr)

Specified by:
  `afterMemoryRestore` in interface `DatabaseLifecycleListener`
Parameters:
  `mgr` - Database shared manager.

#### onDiscoveryEvent

    public void onDiscoveryEvent(int evtType,
                                 Collection<ClusterNode> nodes,
                                 long topVer,
                                 @Nullable
                                 DiscoveryCustomMessage customMsg)

Specified by:
  `onDiscoveryEvent` in interface `MvccProcessor`
Parameters:
  `evtType` - Event type.
  `nodes` - Current nodes.
  `topVer` - Topology version.
  `customMsg` - Message

#### onExchangeStart

    public void onExchangeStart(MvccCoordinator mvccCrd,
                                ExchangeContext exchCtx,
                                ClusterNode exchCrd)

Exchange start callback.

Specified by:
  `onExchangeStart` in interface `MvccProcessor`
Parameters:
  `mvccCrd` - Mvcc coordinator.
  `exchCtx` - Exchange context.
  `exchCrd` - Exchange coordinator.

#### onExchangeDone

    public void onExchangeDone(boolean newCrd,
                               DiscoCache discoCache,
                               Map<UUID,GridLongList> activeQueries)

Exchange done callback.

Specified by:
  `onExchangeDone` in interface `MvccProcessor`
Parameters:
  `newCrd` - New coordinator flag.
  `discoCache` - Disco cache.
  `activeQueries` - Active queries.

#### processClientActiveQueries

    public void processClientActiveQueries(UUID nodeId,
                                           @Nullable
                                           GridLongList activeQueries)

Specified by:
  `processClientActiveQueries` in interface `MvccProcessor`
Parameters:
  `nodeId` - Node ID
  `activeQueries` - Active queries.

#### currentCoordinator

    @Nullable
    public MvccCoordinator currentCoordinator()

Specified by:
  `currentCoordinator` in interface `MvccProcessor`
Returns:
  Coordinator.

#### currentCoordinator

    @Nullable
    public MvccCoordinator currentCoordinator(AffinityTopologyVersion topVer)

Check that the given topology is greater or equals to coordinator's one and returns current coordinator.

Specified by:
  `currentCoordinator` in interface `MvccProcessor`
Parameters:
  `topVer` - Topology version.
Returns:
  Mvcc coordinator.

#### assignedCoordinator

    @Nullable
    public MvccCoordinator assignedCoordinator()

Specified by:
  `assignedCoordinator` in interface `MvccProcessor`
Returns:
  Mvcc coordinator received from discovery event.

#### currentCoordinatorId

    public UUID currentCoordinatorId()

Specified by:
  `currentCoordinatorId` in interface `MvccProcessor`
Returns:
  Current coordinator node ID.

#### updateCoordinator

    public void updateCoordinator(MvccCoordinator curCrd)

Specified by:
  `updateCoordinator` in interface `MvccProcessor`
Parameters:
  `curCrd` - Coordinator.

#### state

    public byte state(MvccVersion ver)
               throws IgniteCheckedException

Specified by:
  `state` in interface `MvccProcessor`
Parameters:
  `ver` - Version to check.
Returns:
  State for given mvcc version.
Throws:
  `IgniteCheckedException` - If fails.

#### state

    public byte state(long crdVer,
                      long cntr)
               throws IgniteCheckedException

Specified by:
  `state` in interface `MvccProcessor`
Parameters:
  `crdVer` - Mvcc coordinator version.
  `cntr` - Mvcc counter.
Returns:
  State for given mvcc version.
Throws:
  `IgniteCheckedException` - If fails.

#### updateState

    public void updateState(MvccVersion ver,
                            byte state)
                     throws IgniteCheckedException

Specified by:
  `updateState` in interface `MvccProcessor`
Parameters:
  `ver` - Version.
  `state` - State.
Throws:
  `IgniteCheckedException` - If fails;

#### updateState

    public void updateState(MvccVersion ver,
                            byte state,
                            boolean primary)
                     throws IgniteCheckedException

Specified by:
  `updateState` in interface `MvccProcessor`
Parameters:
  `ver` - Version.
  `state` - State.
  `primary` - Flag if this is primary node.
Throws:
  `IgniteCheckedException` - If fails;

#### registerLocalTransaction

    public void registerLocalTransaction(long crd,
                                         long cntr)

Specified by:
  `registerLocalTransaction` in interface `MvccProcessor`
Parameters:
  `crd` - Mvcc coordinator version.
  `cntr` - Mvcc counter.

#### hasLocalTransaction

    public boolean hasLocalTransaction(long crd,
                                       long cntr)

Specified by:
  `hasLocalTransaction` in interface `MvccProcessor`
Parameters:
  `crd` - Mvcc coordinator version.
  `cntr` - Mvcc counter.
Returns:
  `True` if there is an active local transaction with given version.

#### waitFor

    public IgniteInternalFuture<Void> waitFor(GridCacheContext cctx,
                                              MvccVersion locked)
                                       throws IgniteCheckedException

Specified by:
  `waitFor` in interface `MvccProcessor`
Parameters:
  `cctx` - Cache context.
  `locked` - Version the entry is locked by.
Returns:
  Future, which is completed as soon as the lock is released.
Throws:
  `IgniteCheckedException` - If failed.

#### addQueryTracker

    public void addQueryTracker(MvccQueryTracker tracker)

Specified by:
  `addQueryTracker` in interface `MvccProcessor`
Parameters:
  `tracker` - Query tracker.

#### removeQueryTracker

    public void removeQueryTracker(Long id)

Specified by:
  `removeQueryTracker` in interface `MvccProcessor`
Parameters:
  `id` - Query tracker id.

#### tryRequestSnapshotLocal

    public MvccSnapshot tryRequestSnapshotLocal()
                                         throws ClusterTopologyCheckedException

Specified by:
  `tryRequestSnapshotLocal` in interface `MvccProcessor`
Returns:
  `MvccSnapshot` if this is a coordinator node and coordinator is initialized. `Null` in other cases.
Throws:
  `ClusterTopologyCheckedException` - If coordinator doesn't match locked topology or not assigned.

#### tryRequestSnapshotLocal

    public MvccSnapshot tryRequestSnapshotLocal(@Nullable
                                                IgniteInternalTx tx)
                                         throws ClusterTopologyCheckedException

Specified by:
  `tryRequestSnapshotLocal` in interface `MvccProcessor`
Parameters:
  `tx` - Transaction.
Returns:
  `MvccSnapshot` if this is a coordinator node and coordinator is initialized. `Null` in other cases.
Throws:
  `ClusterTopologyCheckedException` - If coordinator doesn't match locked topology or not assigned.

#### requestSnapshotAsync

    public IgniteInternalFuture<MvccSnapshot> requestSnapshotAsync(IgniteInternalTx tx)

Requests snapshot on Mvcc coordinator.

Specified by:
  `requestSnapshotAsync` in interface `MvccProcessor`
Parameters:
  `tx` - Transaction.
Returns:
  Snapshot future.

#### requestSnapshotAsync

    public void requestSnapshotAsync(MvccSnapshotResponseListener lsnr)

Requests snapshot on Mvcc coordinator.

Specified by:
  `requestSnapshotAsync` in interface `MvccProcessor`
Parameters:
  `lsnr` - Request listener.

#### requestSnapshotAsync

    public void requestSnapshotAsync(IgniteInternalTx tx,
                                     MvccSnapshotResponseListener lsnr)

Requests snapshot on Mvcc coordinator.

Specified by:
  `requestSnapshotAsync` in interface `MvccProcessor`
Parameters:
  `tx` - Transaction
  `lsnr` - Request listener.

#### ackTxCommit

    public IgniteInternalFuture<Void> ackTxCommit(MvccSnapshot updateVer)

Specified by:
  `ackTxCommit` in interface `MvccProcessor`
Parameters:
  `updateVer` - Transaction update version.
Returns:
  Acknowledge future.

#### ackTxCommit

    public IgniteInternalFuture<Void> ackTxCommit(MvccVersion updateVer,
                                                  MvccSnapshot readSnapshot,
                                                  long qryId)

Specified by:
  `ackTxCommit` in interface `MvccProcessor`
Parameters:
  `updateVer` - Transaction update version.
  `readSnapshot` - Transaction read version.
  `qryId` - Query tracker id.
Returns:
  Acknowledge future.

#### ackTxRollback

    public void ackTxRollback(MvccVersion updateVer)

Specified by:
  `ackTxRollback` in interface `MvccProcessor`
Parameters:
  `updateVer` - Transaction update version.

#### ackTxRollback

    public void ackTxRollback(MvccVersion updateVer,
                              MvccSnapshot readSnapshot,
                              long qryTrackerId)

Specified by:
  `ackTxRollback` in interface `MvccProcessor`
Parameters:
  `updateVer` - Transaction update version.
  `readSnapshot` - Transaction read version.
  `qryTrackerId` - Query tracker id.

#### ackQueryDone

    public void ackQueryDone(MvccSnapshot snapshot,
                             long qryId)

Specified by:
  `ackQueryDone` in interface `MvccProcessor`
Parameters:
  `snapshot` - Query version.
  `qryId` - Query tracker ID.

#### waitTxsFuture

    public IgniteInternalFuture<Void> waitTxsFuture(UUID crdId,
                                                    GridLongList txs)

Specified by:
  `waitTxsFuture` in interface `MvccProcessor`
Parameters:
  `crdId` - Coordinator ID.
  `txs` - Transaction IDs.
Returns:
  Future.

#### dumpDebugInfo

    public void dumpDebugInfo(IgniteLogger log,
                              @Nullable
                              IgniteDiagnosticPrepareContext diagCtx)

Specified by:
  `dumpDebugInfo` in interface `MvccProcessor`
Parameters:
  `log` - Logger.
  `diagCtx` - Diagnostic request.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019