Package org.elasticsearch.gateway
Class MetaStateService
java.lang.Object
org.elasticsearch.gateway.MetaStateService
Handles writing and loading
Manifest
, Metadata
and IndexMetadata
as used for cluster state persistence in
versions prior to Version.V_7_6_0
, used to read this older format during an upgrade from these versions.-
Field Summary
Modifier and TypeFieldDescriptionfinal org.elasticsearch.xcontent.NamedXContentRegistry
final NodeEnvironment
-
Constructor Summary
ConstructorDescriptionMetaStateService
(NodeEnvironment nodeEnv, org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes manifest file, global metadata and all index metadataLoads the full state, which includes both the global state and all the indices meta data.loadIndexState
(Index index) Loads the index state for the provided index name, returning null if doesn't exists.void
Creates empty cluster state file on disk, deleting global metadata and unreferencing all index metadata (only used for dangling indices at that point).
-
Field Details
-
nodeEnv
-
namedXContentRegistry
public final org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry
-
-
Constructor Details
-
MetaStateService
public MetaStateService(NodeEnvironment nodeEnv, org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry)
-
-
Method Details
-
loadFullState
Loads the full state, which includes both the global state and all the indices meta data.
When loading, manifest file is consulted (represented byManifest
class), to load proper generations.
If there is no manifest file on disk, this method fallbacks to BWC mode, where latest generation of global and indices metadata is loaded. Please note that currently there is no way to distinguish between manifest file being removed and manifest file was not yet created. It means that this method always fallbacks to BWC mode, if there is no manifest file.- Returns:
- tuple of
Manifest
andMetadata
with global metadata and indices metadata. If there is no state on disk, meta state with globalGeneration -1 and empty meta data is returned. - Throws:
IOException
- if some IOException when loading files occurs or there is no metadata referenced by manifest file.
-
loadIndexState
Loads the index state for the provided index name, returning null if doesn't exists.- Throws:
IOException
-
unreferenceAll
Creates empty cluster state file on disk, deleting global metadata and unreferencing all index metadata (only used for dangling indices at that point).- Throws:
IOException
-
deleteAll
Removes manifest file, global metadata and all index metadata- Throws:
IOException
-