Class MockRepository

java.lang.Object
org.elasticsearch.common.component.AbstractLifecycleComponent
org.elasticsearch.repositories.blobstore.BlobStoreRepository
org.elasticsearch.repositories.fs.FsRepository
org.elasticsearch.snapshots.mockstore.MockRepository
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, org.elasticsearch.common.component.LifecycleComponent, org.elasticsearch.common.lease.Releasable, org.elasticsearch.repositories.Repository

public class MockRepository
extends org.elasticsearch.repositories.fs.FsRepository
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    class  MockRepository.MockBlobStore  
    static class  MockRepository.Plugin  

    Nested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository

    org.elasticsearch.repositories.Repository.Factory
  • Field Summary

    Fields inherited from class org.elasticsearch.repositories.fs.FsRepository

    CHUNK_SIZE_SETTING, COMPRESS_SETTING, LOCATION_SETTING, REPOSITORIES_CHUNK_SIZE_SETTING, REPOSITORIES_COMPRESS_SETTING, REPOSITORIES_LOCATION_SETTING, TYPE

    Fields inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository

    ALLOW_CONCURRENT_MODIFICATION, bigArrays, BUFFER_SIZE_SETTING, bufferSize, CACHE_REPOSITORY_DATA, GLOBAL_METADATA_FORMAT, INDEX_FILE_PREFIX, INDEX_LATEST_BLOB, INDEX_METADATA_FORMAT, INDEX_SHARD_SNAPSHOT_FORMAT, INDEX_SHARD_SNAPSHOTS_FORMAT, MAX_SNAPSHOTS_SETTING, metadata, METADATA_NAME_FORMAT, METADATA_PREFIX, READONLY_SETTING_KEY, SNAPSHOT_FORMAT, SNAPSHOT_NAME_FORMAT, SNAPSHOT_PREFIX, SUPPORT_URL_REPO, supportURLRepo, threadPool, UPLOADED_DATA_BLOB_PREFIX, URL_REPOSITORY_TYPE

    Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent

    lifecycle
  • Constructor Summary

    Constructors
    Constructor Description
    MockRepository​(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata, org.elasticsearch.env.Environment environment, org.elasticsearch.common.xcontent.NamedXContentRegistry namedXContentRegistry, org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.common.util.BigArrays bigArrays, org.elasticsearch.indices.recovery.RecoverySettings recoverySettings)  
  • Method Summary

    Modifier and Type Method Description
    boolean blocked()  
    void blockOnDataFiles()  
    protected org.elasticsearch.common.blobstore.BlobStore createBlobStore()  
    protected void doStop()  
    long getFailureCount()  
    org.elasticsearch.cluster.metadata.RepositoryMetadata getMetadata()  
    void setBlockAndFailOnWriteIndexFile()  
    void setBlockAndFailOnWriteSnapFiles()  
    void setBlockOnAnyFiles()  
    void setBlockOnceOnReadSnapshotInfoIfAlreadyBlocked()
    Enable blocking a single read of SnapshotInfo in case the repo is already blocked on another file.
    void setBlockOnDeleteIndexFile()  
    void setBlockOnReadIndexMeta()  
    void setBlockOnWriteIndexFile()  
    void setBlockOnWriteShardLevelMeta()  
    void setFailOnIndexLatest​(boolean failOnIndexLatest)  
    void setFailReadsAfterUnblock​(boolean failReadsAfterUnblock)  
    void unblock()  

    Methods inherited from class org.elasticsearch.repositories.fs.FsRepository

    basePath, chunkSize, hasAtomicOverwrites

    Methods inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository

    assertSnapshotOrGenericThread, blobContainer, blobStore, cleanup, cloneShardSnapshot, deleteSnapshots, doClose, doStart, endVerification, executeConsistentStateUpdate, finalizeSnapshot, getBlobStore, getRepositoryData, getRestoreThrottleTimeInNanos, getShardSnapshotStatus, getSnapshotGlobalMetadata, getSnapshotIndexMetaData, getSnapshotInfo, getSnapshotThrottleTimeInNanos, initializeSnapshot, isCompress, isReadOnly, loadShardSnapshot, maybeRateLimitRestores, maybeRateLimitRestores, maybeRateLimitSnapshots, maybeRateLimitSnapshots, restoreShard, shardContainer, snapshotShard, startVerification, stats, supportURLRepo, threadPool, toString, updateState, verify, writeIndexGen

    Methods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent

    addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent

    addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop

    Methods inherited from interface org.elasticsearch.common.lease.Releasable

    close

    Methods inherited from interface org.elasticsearch.repositories.Repository

    adaptUserMetadata
  • Constructor Details

    • MockRepository

      public MockRepository​(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata, org.elasticsearch.env.Environment environment, org.elasticsearch.common.xcontent.NamedXContentRegistry namedXContentRegistry, org.elasticsearch.cluster.service.ClusterService clusterService, org.elasticsearch.common.util.BigArrays bigArrays, org.elasticsearch.indices.recovery.RecoverySettings recoverySettings)
  • Method Details

    • getFailureCount

      public long getFailureCount()
    • getMetadata

      public org.elasticsearch.cluster.metadata.RepositoryMetadata getMetadata()
      Specified by:
      getMetadata in interface org.elasticsearch.repositories.Repository
      Overrides:
      getMetadata in class org.elasticsearch.repositories.blobstore.BlobStoreRepository
    • doStop

      protected void doStop()
      Overrides:
      doStop in class org.elasticsearch.repositories.blobstore.BlobStoreRepository
    • createBlobStore

      protected org.elasticsearch.common.blobstore.BlobStore createBlobStore() throws java.lang.Exception
      Overrides:
      createBlobStore in class org.elasticsearch.repositories.fs.FsRepository
      Throws:
      java.lang.Exception
    • unblock

      public void unblock()
    • blockOnDataFiles

      public void blockOnDataFiles()
    • setBlockOnAnyFiles

      public void setBlockOnAnyFiles()
    • setBlockAndFailOnWriteSnapFiles

      public void setBlockAndFailOnWriteSnapFiles()
    • setBlockAndFailOnWriteIndexFile

      public void setBlockAndFailOnWriteIndexFile()
    • setBlockOnWriteIndexFile

      public void setBlockOnWriteIndexFile()
    • setBlockOnDeleteIndexFile

      public void setBlockOnDeleteIndexFile()
    • setBlockOnWriteShardLevelMeta

      public void setBlockOnWriteShardLevelMeta()
    • setBlockOnReadIndexMeta

      public void setBlockOnReadIndexMeta()
    • setFailReadsAfterUnblock

      public void setFailReadsAfterUnblock​(boolean failReadsAfterUnblock)
    • setBlockOnceOnReadSnapshotInfoIfAlreadyBlocked

      public void setBlockOnceOnReadSnapshotInfoIfAlreadyBlocked()
      Enable blocking a single read of SnapshotInfo in case the repo is already blocked on another file. This allows testing very specific timing issues where a read of SnapshotInfo is much slower than another concurrent repository operation. See blockExecution() for the exact mechanics of why we need a secondary block defined here. TODO: clean this up to not require a second block set
    • blocked

      public boolean blocked()
    • setFailOnIndexLatest

      public void setFailOnIndexLatest​(boolean failOnIndexLatest)