Class IndexMetadataVerifier

java.lang.Object
org.elasticsearch.cluster.metadata.IndexMetadataVerifier

public class IndexMetadataVerifier extends Object
This service is responsible for verifying index metadata when an index is introduced to the cluster, for example when restarting nodes, importing dangling indices, or restoring an index from a snapshot repository. It performs the following: - Verifies the index version is not too old. - Tries to parse the mappings to catch compatibility bugs early. - Identifies unknown and invalid settings and archives them.
  • Constructor Details

  • Method Details

    • verifyIndexMetadata

      public IndexMetadata verifyIndexMetadata(IndexMetadata indexMetadata, IndexVersion minimumIndexCompatibilityVersion, IndexVersion minimumReadOnlyIndexCompatibilityVersion)
      Checks that the index can be upgraded to the current version of the master node.

      If the index does not need upgrade it returns the index metadata unchanged, otherwise it returns a modified index metadata. If index cannot be updated the method throws an exception.

    • isFullySupportedVersion

      public static boolean isFullySupportedVersion(IndexMetadata indexMetadata, IndexVersion minimumIndexCompatibilityVersion)
    • isReadOnlySupportedVersion

      public static boolean isReadOnlySupportedVersion(IndexMetadata indexMetadata, IndexVersion minimumCompatible, IndexVersion minimumReadOnlyCompatible)
      Returns true if the index version is compatible with read-only mode. A regular index is read-only compatible if it was created in version N-2 and if it was marked as read-only on version N-1, a process which involves adding a write block and a special index setting indicating that the shard was "verified". Searchable snapshots and Archives indices created in version N-2 are also read-only compatible by nature as long as they have a write block. Other type of indices like CCR are not read-only compatible.
      Parameters:
      indexMetadata - the index metadata
      minimumCompatible - the min. index compatible version for reading and writing indices (used in assertion)
      minimumReadOnlyCompatible - the min. index compatible version for only reading indices
      Returns:
      true if the index version is compatible in read-only mode, false otherwise.
      Throws:
      IllegalStateException - if the index is read-only compatible but has no write block or no verification index setting in place.
    • isReadOnlyCompatible

      public static boolean isReadOnlyCompatible(IndexMetadata indexMetadata, IndexVersion minimumCompatible, IndexVersion minimumReadOnlyCompatible)
    • isReadOnlyVerified

      public static boolean isReadOnlyVerified(IndexMetadata indexMetadata)