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
Modifier and TypeClassDescriptionclass
static class
Nested classes/interfaces inherited from interface org.elasticsearch.repositories.Repository
org.elasticsearch.repositories.Repository.Factory
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Setting 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, TYPE
Fields 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_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, USE_FOR_PEER_RECOVERY_SETTING
Fields inherited from class org.elasticsearch.common.component.AbstractLifecycleComponent
lifecycle
-
Constructor Summary
ConstructorDescriptionMockRepository
(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata, org.elasticsearch.env.Environment environment, org.elasticsearch.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 TypeMethodDescriptionvoid
boolean
blocked()
void
boolean
canUpdateInPlace
(org.elasticsearch.common.settings.Settings updatedSettings, Set<String> ignoredSettings) protected org.elasticsearch.common.blobstore.BlobStore
protected void
doStop()
long
org.elasticsearch.cluster.metadata.RepositoryMetadata
void
void
void
void
void
void
void
Enable blocking a single read ofSnapshotInfo
in case the repo is already blocked on another file.void
void
void
setBlockOnShardLevelSnapFiles
(String indexId) void
void
void
setFailOnIndexLatest
(boolean failOnIndexLatest) void
setFailReadsAfterUnblock
(boolean failReadsAfterUnblock) void
unblock()
Methods inherited from class org.elasticsearch.repositories.fs.FsRepository
chunkSize, hasAtomicOverwrites
Methods inherited from class org.elasticsearch.repositories.blobstore.BlobStoreRepository
assertSnapshotOrGenericThread, awaitIdle, basePath, blobContainer, blobStore, cleanup, cloneShardSnapshot, deleteSnapshots, doClose, doStart, endVerification, executeConsistentStateUpdate, finalizeSnapshot, getBlobStore, getBlobStoreIndexShardSnapshots, getReadBufferSizeInBytes, getRepositoryData, getRestoreThrottleTimeInNanos, getShardSnapshotStatus, getSnapshotGlobalMetadata, getSnapshotIndexMetaData, getSnapshotInfo, getSnapshotThrottleTimeInNanos, 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.core.Releasable
close
Methods 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:
-
-
Constructor Details
-
MockRepository
public MockRepository(org.elasticsearch.cluster.metadata.RepositoryMetadata metadata, org.elasticsearch.env.Environment environment, org.elasticsearch.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 interfaceorg.elasticsearch.repositories.Repository
- Overrides:
getMetadata
in classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
canUpdateInPlace
public boolean canUpdateInPlace(org.elasticsearch.common.settings.Settings updatedSettings, Set<String> ignoredSettings) - Specified by:
canUpdateInPlace
in interfaceorg.elasticsearch.repositories.Repository
- Overrides:
canUpdateInPlace
in classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
doStop
protected void doStop()- Overrides:
doStop
in classorg.elasticsearch.repositories.blobstore.BlobStoreRepository
-
createBlobStore
- Overrides:
createBlobStore
in 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() -
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 ofSnapshotInfo
in case the repo is already blocked on another file. This allows testing very specific timing issues where a read ofSnapshotInfo
is 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)
-