Interface Repository

    • Method Detail

      • getSnapshotInfo

        SnapshotInfo getSnapshotInfo​(SnapshotId snapshotId)
        Reads snapshot description from repository.
        Parameters:
        snapshotId - snapshot id
        Returns:
        information about snapshot
      • getSnapshotGlobalMetaData

        MetaData getSnapshotGlobalMetaData​(SnapshotId snapshotId)
        Returns global metadata associated with the snapshot.
        Parameters:
        snapshotId - the snapshot id to load the global metadata from
        Returns:
        the global metadata about the snapshot
      • getSnapshotIndexMetaData

        IndexMetaData getSnapshotIndexMetaData​(SnapshotId snapshotId,
                                               IndexId index)
                                        throws java.io.IOException
        Returns the index metadata associated with the snapshot.
        Parameters:
        snapshotId - the snapshot id to load the index metadata from
        index - the IndexId to load the metadata from
        Returns:
        the index metadata about the given index for the given snapshot
        Throws:
        java.io.IOException
      • getRepositoryData

        RepositoryData getRepositoryData()
        Returns a RepositoryData to describe the data in the repository, including the snapshots and the indices across all snapshots found in the repository. Throws a RepositoryException if there was an error in reading the data.
      • initializeSnapshot

        void initializeSnapshot​(SnapshotId snapshotId,
                                java.util.List<IndexId> indices,
                                MetaData metaData)
        Starts snapshotting process
        Parameters:
        snapshotId - snapshot id
        indices - list of indices to be snapshotted
        metaData - cluster metadata
      • finalizeSnapshot

        SnapshotInfo finalizeSnapshot​(SnapshotId snapshotId,
                                      java.util.List<IndexId> indices,
                                      long startTime,
                                      java.lang.String failure,
                                      int totalShards,
                                      java.util.List<SnapshotShardFailure> shardFailures,
                                      long repositoryStateId,
                                      boolean includeGlobalState)
        Finalizes snapshotting process

        This method is called on master after all shards are snapshotted.

        Parameters:
        snapshotId - snapshot id
        indices - list of indices in the snapshot
        startTime - start time of the snapshot
        failure - global failure reason or null
        totalShards - total number of shards
        shardFailures - list of shard failures
        repositoryStateId - the unique id identifying the state of the repository when the snapshot began
        includeGlobalState - include cluster global state
        Returns:
        snapshot description
      • deleteSnapshot

        void deleteSnapshot​(SnapshotId snapshotId,
                            long repositoryStateId)
        Deletes snapshot
        Parameters:
        snapshotId - snapshot id
        repositoryStateId - the unique id identifying the state of the repository when the snapshot deletion began
      • getSnapshotThrottleTimeInNanos

        long getSnapshotThrottleTimeInNanos()
        Returns snapshot throttle time in nanoseconds
      • getRestoreThrottleTimeInNanos

        long getRestoreThrottleTimeInNanos()
        Returns restore throttle time in nanoseconds
      • startVerification

        java.lang.String startVerification()
        Verifies repository on the master node and returns the verification token.

        If the verification token is not null, it's passed to all data nodes for verification. If it's null - no additional verification is required

        Returns:
        verification token that should be passed to all Index Shard Repositories for additional verification or null
      • endVerification

        void endVerification​(java.lang.String verificationToken)
        Called at the end of repository verification process.

        This method should perform all necessary cleanup of the temporary files created in the repository

        Parameters:
        verificationToken - verification request generated by startVerification() command
      • verify

        void verify​(java.lang.String verificationToken,
                    DiscoveryNode localNode)
        Verifies repository settings on data node.
        Parameters:
        verificationToken - value returned by startVerification()
        localNode - the local node information, for inclusion in verification errors
      • isReadOnly

        boolean isReadOnly()
        Returns true if the repository supports only read operations
        Returns:
        true if the repository is read/only
      • snapshotShard

        void snapshotShard​(IndexShard shard,
                           Store store,
                           SnapshotId snapshotId,
                           IndexId indexId,
                           org.apache.lucene.index.IndexCommit snapshotIndexCommit,
                           IndexShardSnapshotStatus snapshotStatus)
        Creates a snapshot of the shard based on the index commit point.

        The index commit point can be obtained by using Engine.acquireLastIndexCommit(boolean) method. Repository implementations shouldn't release the snapshot index commit point. It is done by the method caller.

        As snapshot process progresses, implementation of this method should update IndexShardSnapshotStatus object and check IndexShardSnapshotStatus.isAborted() to see if the snapshot process should be aborted.

        Parameters:
        shard - shard to be snapshotted
        store - store to be snapshotted
        snapshotId - snapshot id
        indexId - id for the index being snapshotted
        snapshotIndexCommit - commit point
        snapshotStatus - snapshot status
      • restoreShard

        void restoreShard​(IndexShard shard,
                          SnapshotId snapshotId,
                          Version version,
                          IndexId indexId,
                          ShardId snapshotShardId,
                          RecoveryState recoveryState)
        Restores snapshot of the shard.

        The index can be renamed on restore, hence different shardId and snapshotShardId are supplied.

        Parameters:
        shard - the shard to restore the index into
        snapshotId - snapshot id
        version - version of elasticsearch that created this snapshot
        indexId - id of the index in the repository from which the restore is occurring
        snapshotShardId - shard id (in the snapshot)
        recoveryState - recovery state
      • getShardSnapshotStatus

        IndexShardSnapshotStatus getShardSnapshotStatus​(SnapshotId snapshotId,
                                                        Version version,
                                                        IndexId indexId,
                                                        ShardId shardId)
        Retrieve shard snapshot status for the stored snapshot
        Parameters:
        snapshotId - snapshot id
        version - version of elasticsearch that created this snapshot
        indexId - the snapshotted index id for the shard to get status for
        shardId - shard id
        Returns:
        snapshot status