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,LifecycleComponent,org.elasticsearch.core.Releasable,Repository
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic classNested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository
Repository.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final 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, LOCATION_SETTING, REPOSITORIES_CHUNK_SIZE_SETTING, REPOSITORIES_LOCATION_SETTING, TYPEFields inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository
bigArrays, BUFFER_SIZE_SETTING, bufferSize, CACHE_REPOSITORY_DATA, COMPRESS_SETTING, 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_BLOB_NAME_SUFFIX, METADATA_NAME_FORMAT, METADATA_PREFIX, PROJECT_METADATA_FORMAT, READ_ONLY_USAGE_STATS_NAME, READ_WRITE_USAGE_STATS_NAME, READONLY_SETTING_KEY, SEARCHABLE_SNAPSHOTS_CACHE_FETCH_ASYNC_THREAD_NAME, SEARCHABLE_SNAPSHOTS_CACHE_PREWARMING_THREAD_NAME, SNAPSHOT_FORMAT, SNAPSHOT_INDEX_NAME_FORMAT, SNAPSHOT_INDEX_PREFIX, SNAPSHOT_NAME_FORMAT, SNAPSHOT_PREFIX, STATELESS_CLUSTER_STATE_READ_WRITE_THREAD_NAME, STATELESS_SHARD_PREWARMING_THREAD_NAME, STATELESS_SHARD_READ_THREAD_NAME, STATELESS_SHARD_UPLOAD_PREWARMING_THREAD_NAME, STATELESS_SHARD_WRITE_THREAD_NAME, STATELESS_TRANSLOG_THREAD_NAME, SUPPORT_URL_REPO, supportURLRepo, threadPool, UPLOADED_DATA_BLOB_PREFIX, URL_REPOSITORY_TYPE, USE_FOR_PEER_RECOVERY_SETTINGFields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle -
Constructor Summary
ConstructorsConstructorDescriptionMockRepository(ProjectId projectId, RepositoryMetadata metadata, Environment environment, org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry, ClusterService clusterService, BigArrays bigArrays, RecoverySettings recoverySettings, SnapshotMetrics snapshotMetrics) -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanblocked()voidbooleancanUpdateInPlace(Settings updatedSettings, Set<String> ignoredSettings) protected BlobStoreprotected voiddoStop()longvoidvoidvoidvoidvoidvoidvoidEnable blocking a single read ofSnapshotInfoin case the repo is already blocked on another file.voidvoidvoidsetBlockOnShardLevelSnapFiles(String indexId) voidvoidvoidsetFailOnDeleteContainer(boolean failOnDeleteContainer) Sets the fail-on-delete-container flag, which iftruethrows an exception when deleting aBlobContainer.voidsetFailOnIndexLatest(boolean failOnIndexLatest) voidsetFailReadsAfterUnblock(boolean failReadsAfterUnblock) voidsetMaximumNumberOfFailures(long maximumNumberOfFailures) voidsetRandomControlIOExceptionRate(double randomControlIOExceptionRate) voidsetRandomDataFileIOExceptionRate(double randomDataFileIOExceptionRate) voidsetRandomIOExceptionPattern(String randomIOExceptionPattern) voidsetUseLuceneCorruptionException(boolean useLuceneCorruptionException) voidunblock()Methods inherited from class org.elasticsearch.repositories.fs.FsRepository
chunkSize, hasAtomicOverwritesMethods inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository
awaitIdle, basePath, blobContainer, blobStore, cleanup, cloneShardSnapshot, deleteSnapshots, doClose, doStart, endVerification, finalizeSnapshot, getAnalysisFailureExtraDetail, getBlobStore, getBlobStoreIndexShardSnapshots, getExtraUsageFeatures, getProjectId, getReadBufferSizeInBytes, getRepositoryData, getRepositoryDataBlobName, getShardSnapshotsInProgress, getShardSnapshotStatus, getSnapshotGlobalMetadata, getSnapshotIndexMetaData, getSnapshotInfo, getSnapshotStats, getUsageFeatures, isCompress, isReadOnly, loadShardSnapshot, maybeRateLimitRestores, maybeRateLimitRestores, maybeRateLimitSnapshots, maybeRateLimitSnapshots, restoreShard, shardContainer, snapshotFile, snapshotFiles, snapshotShard, startVerification, stats, supportURLRepo, threadPool, toString, updateState, verify, wrapWithWeakConsistencyProtection, writeIndexGenMethods inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, 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, start, stopMethods inherited from interface org.elasticsearch.core.Releasable
closeMethods inherited from interface org.elasticsearch.repositories.Repository
getProjectRepo, getSnapshotInfo
-
Field Details
-
DUMMY_UPDATABLE_SETTING_NAME
Setting name for a setting that can be updated dynamically to testcanUpdateInPlace(Settings, Set).- See Also:
-
-
Constructor Details
-
MockRepository
public MockRepository(@Nullable ProjectId projectId, RepositoryMetadata metadata, Environment environment, org.elasticsearch.xcontent.NamedXContentRegistry namedXContentRegistry, ClusterService clusterService, BigArrays bigArrays, RecoverySettings recoverySettings, SnapshotMetrics snapshotMetrics)
-
-
Method Details
-
getFailureCount
public long getFailureCount() -
getMetadata
- Specified by:
getMetadatain interfaceRepository- Overrides:
getMetadatain classBlobStoreRepository
-
canUpdateInPlace
- Specified by:
canUpdateInPlacein interfaceRepository- Overrides:
canUpdateInPlacein classBlobStoreRepository
-
doStop
protected void doStop()- Overrides:
doStopin classBlobStoreRepository
-
createBlobStore
- Overrides:
createBlobStorein classFsRepository- Throws:
Exception
-
unblock
public void unblock() -
setMaximumNumberOfFailures
public void setMaximumNumberOfFailures(long maximumNumberOfFailures) -
setUseLuceneCorruptionException
public void setUseLuceneCorruptionException(boolean useLuceneCorruptionException) -
setRandomControlIOExceptionRate
public void setRandomControlIOExceptionRate(double randomControlIOExceptionRate) -
setRandomDataFileIOExceptionRate
public void setRandomDataFileIOExceptionRate(double randomDataFileIOExceptionRate) -
setRandomIOExceptionPattern
-
blockOnDataFiles
public void blockOnDataFiles() -
blockAndFailOnDataFiles
public void blockAndFailOnDataFiles() -
setBlockOnAnyFiles
public void setBlockOnAnyFiles() -
setBlockAndFailOnWriteSnapFiles
public void setBlockAndFailOnWriteSnapFiles() -
setBlockOnShardLevelSnapFiles
-
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) -
setBlockAndFailOnReadSnapFiles
public void setBlockAndFailOnReadSnapFiles() -
setBlockAndFailOnReadIndexFiles
public void setBlockAndFailOnReadIndexFiles() -
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 -
setFailOnDeleteContainer
public void setFailOnDeleteContainer(boolean failOnDeleteContainer) Sets the fail-on-delete-container flag, which iftruethrows an exception when deleting aBlobContainer. -
blocked
public boolean blocked() -
setFailOnIndexLatest
public void setFailOnIndexLatest(boolean failOnIndexLatest)
-