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:
Closeable,AutoCloseable,org.elasticsearch.common.component.LifecycleComponent,org.elasticsearch.core.Releasable,org.elasticsearch.repositories.Repository
public class MockRepository
extends org.elasticsearch.repositories.fs.FsRepository
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic classNested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository
org.elasticsearch.repositories.Repository.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringSetting name for a setting that can be updated dynamically to testcanUpdateInPlace(Settings, Set).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, TYPEFields 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_RESTORE_BYTES_PER_SEC, MAX_SNAPSHOT_BYTES_PER_SEC, 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_TYPEFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionMockRepository(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 TypeMethodDescriptionvoidbooleanblocked()voidbooleancanUpdateInPlace(org.elasticsearch.common.settings.Settings updatedSettings, Set<String> ignoredSettings)protected org.elasticsearch.common.blobstore.BlobStoreprotected voiddoStop()longorg.elasticsearch.cluster.metadata.RepositoryMetadatavoidvoidvoidvoidsetBlockAndOnWriteShardLevelSnapFiles(String indexId)voidvoidEnable blocking a single read ofSnapshotInfoin case the repo is already blocked on another file.voidvoidvoidvoidvoidsetFailOnIndexLatest(boolean failOnIndexLatest)voidsetFailReadsAfterUnblock(boolean failReadsAfterUnblock)voidunblock()Methods inherited from class org.elasticsearch.repositories.fs.FsRepository
basePath, chunkSize, hasAtomicOverwritesMethods inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository
assertSnapshotOrGenericThread, awaitIdle, 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, writeIndexGenMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stopMethods inherited from interface org.elasticsearch.core.Releasable
closeMethods inherited from interface org.elasticsearch.repositories.Repository
adaptUserMetadata, getSnapshotInfo
-
Field Details
-
DUMMY_UPDATABLE_SETTING_NAME
Setting name for a setting that can be updated dynamically to testcanUpdateInPlace(Settings, Set).- See Also:
- Constant Field Values
-
-
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:
getMetadatain interfaceorg.elasticsearch.repositories.Repository- Overrides:
getMetadatain classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
canUpdateInPlace
public boolean canUpdateInPlace(org.elasticsearch.common.settings.Settings updatedSettings, Set<String> ignoredSettings)- Specified by:
canUpdateInPlacein interfaceorg.elasticsearch.repositories.Repository- Overrides:
canUpdateInPlacein classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
doStop
protected void doStop()- Overrides:
doStopin classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
createBlobStore
- Overrides:
createBlobStorein classorg.elasticsearch.repositories.fs.FsRepository- Throws:
Exception
-
unblock
public void unblock() -
blockOnDataFiles
public void blockOnDataFiles() -
blockAndFailOnDataFiles
public void blockAndFailOnDataFiles() -
setBlockOnAnyFiles
public void setBlockOnAnyFiles() -
setBlockAndFailOnWriteSnapFiles
public void setBlockAndFailOnWriteSnapFiles() -
setBlockAndOnWriteShardLevelSnapFiles
-
setBlockAndFailOnWriteIndexFile
public void setBlockAndFailOnWriteIndexFile() -
setBlockOnWriteIndexFile
public void setBlockOnWriteIndexFile() -
setBlockOnDeleteIndexFile
public void setBlockOnDeleteIndexFile() -
setBlockOnWriteShardLevelMeta
public void setBlockOnWriteShardLevelMeta() -
setBlockAndFailOnWriteShardLevelMeta
public void setBlockAndFailOnWriteShardLevelMeta() -
setBlockOnReadIndexMeta
public void setBlockOnReadIndexMeta() -
setFailReadsAfterUnblock
public void setFailReadsAfterUnblock(boolean failReadsAfterUnblock) -
setBlockOnceOnReadSnapshotInfoIfAlreadyBlocked
public void setBlockOnceOnReadSnapshotInfoIfAlreadyBlocked()Enable blocking a single read ofSnapshotInfoin case the repo is already blocked on another file. This allows testing very specific timing issues where a read ofSnapshotInfois much slower than another concurrent repository operation. SeeblockExecution()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)
-