Class MetaStateService

java.lang.Object
org.elasticsearch.gateway.MetaStateService

public class MetaStateService extends Object
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 Details

    • nodeEnv

      public final NodeEnvironment nodeEnv
    • namedXContentRegistry

      public final org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry
  • Constructor Details

    • MetaStateService

      public MetaStateService(NodeEnvironment nodeEnv, org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry)
  • Method Details

    • loadFullState

      public org.elasticsearch.core.Tuple<Manifest,Metadata> loadFullState() throws IOException
      Loads the full state, which includes both the global state and all the indices meta data.
      When loading, manifest file is consulted (represented by Manifest 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 and Metadata 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

      @Nullable public IndexMetadata loadIndexState(Index index) throws IOException
      Loads the index state for the provided index name, returning null if doesn't exists.
      Throws:
      IOException
    • unreferenceAll

      public void unreferenceAll() throws IOException
      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

      public void deleteAll() throws IOException
      Removes manifest file, global metadata and all index metadata
      Throws:
      IOException