org.apache.ignite.internal.processors.query.aware

## Class IndexBuildStatusStorage

- java.lang.Object
- - org.apache.ignite.internal.processors.query.aware.IndexBuildStatusStorage

All Implemented Interfaces:
  CheckpointListener, MetastorageLifecycleListener

    public class IndexBuildStatusStorage
    extends Object
    implements MetastorageLifecycleListener, CheckpointListener

Holder of up-to-date information about cache index building operations (rebuilding indexes, building new indexes). Avoids index inconsistency when operations have completed, a checkpoint has not occurred, and the node has been restarted.

For rebuild indexes, use `onStartRebuildIndexes(org.apache.ignite.internal.processors.cache.GridCacheContext)` and `onFinishRebuildIndexes(java.lang.String)`. For build new indexes, use `onStartBuildNewIndex(org.apache.ignite.internal.processors.cache.GridCacheContext)` and `onFinishBuildNewIndex(java.lang.String)`. Use `rebuildCompleted(java.lang.String)` to check that the index rebuild is complete.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.cache.persistence.checkpoint.CheckpointListener

`CheckpointListener.Context`

### Field Summary

Fields
`static String` `KEY_PREFIX` Key prefix for the MetaStorage.

### Constructor Summary

Constructors
Constructor and Description
`IndexBuildStatusStorage(GridKernalContext ctx)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `afterCheckpointEnd(CheckpointListener.Context ctx)` Do some actions after checkpoint end.
`void` `beforeCheckpointBegin(CheckpointListener.Context ctx)` Do some actions before checkpoint write lock.
`void` `onCacheKernalStart()` Callback on start of `GridCacheProcessor`.
`void` `onCheckpointBegin(CheckpointListener.Context ctx)`
`void` `onFinishBuildNewIndex(String cacheName)` Callback on the finish of building a new cache index.
`void` `onFinishRebuildIndexes(String cacheName)` Callback on the finish of rebuilding cache indexes.
`void` `onMarkCheckpointBegin(CheckpointListener.Context ctx)`
`void` `onReadyForRead(ReadOnlyMetastorage metastorage)` Is called when metastorage is made ready for read-only operations very early on node startup phase.
`void` `onReadyForReadWrite(ReadWriteMetastorage metastorage)` Fully functional metastore capable of performing reading and writing operations.
`void` `onStartBuildNewIndex(GridCacheContext cacheCtx)` Callback on the start of building a new cache index.
`void` `onStartRebuildIndexes(GridCacheContext cacheCtx)` Callback on the start of rebuilding cache indexes.
`boolean` `rebuildCompleted(String cacheName)` Check if rebuilding of indexes for the cache has been completed.
`void` `start()` Callback on start of `GridQueryProcessor`.
`void` `stop()` Callback on kernel stop.

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

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

### Field Detail

#### KEY_PREFIX

    public static final String KEY_PREFIX

Key prefix for the MetaStorage.

See Also:
  Constant Field Values

### Constructor Detail

#### IndexBuildStatusStorage

    public IndexBuildStatusStorage(GridKernalContext ctx)

Constructor.

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### start

    public void start()

Callback on start of `GridQueryProcessor`.

#### onCacheKernalStart

    public void onCacheKernalStart()

Callback on start of `GridCacheProcessor`.

#### stop

    public void stop()

Callback on kernel stop.

#### onStartRebuildIndexes

    public void onStartRebuildIndexes(GridCacheContext cacheCtx)

Callback on the start of rebuilding cache indexes.

Registers the start of rebuilding cache indexes, for persistent cache writes a entry to the MetaStorage so that if a failure occurs, the indexes are automatically rebuilt.

Parameters:
  `cacheCtx` - Cache context.
See Also:
  `onFinishRebuildIndexes(java.lang.String)`

#### onStartBuildNewIndex

    public void onStartBuildNewIndex(GridCacheContext cacheCtx)

Callback on the start of building a new cache index.

Registers the start of building a new cache index, for persistent cache writes a entry to the MetaStorage so that if a failure occurs, the indexes are automatically rebuilt.

Parameters:
  `cacheCtx` - Cache context.
See Also:
  `onFinishBuildNewIndex(java.lang.String)`

#### onFinishRebuildIndexes

    public void onFinishRebuildIndexes(String cacheName)

Callback on the finish of rebuilding cache indexes.

Registers the finish of rebuilding cache indexes, if all operations have been completed for persistent cache, then the entry will be deleted from the MetaStorage at the end of the checkpoint, otherwise for the in-memory cache the status will be deleted immediately.

Parameters:
  `cacheName` - Cache name.
See Also:
  `onStartRebuildIndexes(org.apache.ignite.internal.processors.cache.GridCacheContext)`

#### onFinishBuildNewIndex

    public void onFinishBuildNewIndex(String cacheName)

Callback on the finish of building a new cache index.

Registers the finish of building a new cache index, if all operations have been completed for persistent cache, then the entry will be deleted from the MetaStorage at the end of the checkpoint, otherwise for the in-memory cache the status will be deleted immediately.

Parameters:
  `cacheName` - Cache name.
See Also:
  `onStartBuildNewIndex(org.apache.ignite.internal.processors.cache.GridCacheContext)`

#### rebuildCompleted

    public boolean rebuildCompleted(String cacheName)

Check if rebuilding of indexes for the cache has been completed.

Parameters:
  `cacheName` - Cache name.
Returns:
  `True` if completed.

#### onReadyForReadWrite

    public void onReadyForReadWrite(ReadWriteMetastorage metastorage)

Fully functional metastore capable of performing reading and writing operations. Components interested in using metastore are allowed to keep reference passed into the method in their fields.

Specified by:
  `onReadyForReadWrite` in interface `MetastorageLifecycleListener`
Parameters:
  `metastorage` - Fully functional meta storage.

#### onReadyForRead

    public void onReadyForRead(ReadOnlyMetastorage metastorage)

Is called when metastorage is made ready for read-only operations very early on node startup phase. Reference for read-only metastorage should be used only within this method and shouldn't be stored to any field.

Specified by:
  `onReadyForRead` in interface `MetastorageLifecycleListener`
Parameters:
  `metastorage` - Read-only meta storage.

#### onMarkCheckpointBegin

    public void onMarkCheckpointBegin(CheckpointListener.Context ctx)

Specified by:
  `onMarkCheckpointBegin` in interface `CheckpointListener`

#### onCheckpointBegin

    public void onCheckpointBegin(CheckpointListener.Context ctx)

Specified by:
  `onCheckpointBegin` in interface `CheckpointListener`

#### beforeCheckpointBegin

    public void beforeCheckpointBegin(CheckpointListener.Context ctx)

Do some actions before checkpoint write lock.

Specified by:
  `beforeCheckpointBegin` in interface `CheckpointListener`

#### afterCheckpointEnd

    public void afterCheckpointEnd(CheckpointListener.Context ctx)

Do some actions after checkpoint end.

Specified by:
  `afterCheckpointEnd` in interface `CheckpointListener`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.14.0
Release Date | : September 29 2022