mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
Remove node settings from blob store repositories (#45991)
This commit starts from the simple premise that the use of node settings in blob store repositories is a mistake. Here we see that the node settings are used to get default settings for store and restore throttle rates. Yet, since there are not any node settings registered to this effect, there can never be a default setting to fall back to there, and so we always end up falling back to the default rate. Since this was the only use of node settings in blob store repository, we move them. From this, several places fall out where we were chaining settings through only to get them to the blob store repository, so we clean these up as well. That leaves us with the changeset in this commit.
This commit is contained in:
parent
943a016bb2
commit
3d64605075
@ -84,7 +84,7 @@ public class URLRepository extends BlobStoreRepository {
|
|||||||
*/
|
*/
|
||||||
public URLRepository(RepositoryMetaData metadata, Environment environment,
|
public URLRepository(RepositoryMetaData metadata, Environment environment,
|
||||||
NamedXContentRegistry namedXContentRegistry, ThreadPool threadPool) {
|
NamedXContentRegistry namedXContentRegistry, ThreadPool threadPool) {
|
||||||
super(metadata, environment.settings(), false, namedXContentRegistry, threadPool);
|
super(metadata, false, namedXContentRegistry, threadPool);
|
||||||
|
|
||||||
if (URL_SETTING.exists(metadata.settings()) == false && REPOSITORIES_URL_SETTING.exists(environment.settings()) == false) {
|
if (URL_SETTING.exists(metadata.settings()) == false && REPOSITORIES_URL_SETTING.exists(environment.settings()) == false) {
|
||||||
throw new RepositoryException(metadata.name(), "missing url");
|
throw new RepositoryException(metadata.name(), "missing url");
|
||||||
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.settings.Setting;
|
|||||||
import org.elasticsearch.common.settings.Setting.Property;
|
import org.elasticsearch.common.settings.Setting.Property;
|
||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.env.Environment;
|
|
||||||
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
|
||||||
@ -78,9 +77,12 @@ public class AzureRepository extends BlobStoreRepository {
|
|||||||
private final AzureStorageService storageService;
|
private final AzureStorageService storageService;
|
||||||
private final boolean readonly;
|
private final boolean readonly;
|
||||||
|
|
||||||
public AzureRepository(RepositoryMetaData metadata, Environment environment, NamedXContentRegistry namedXContentRegistry,
|
public AzureRepository(
|
||||||
AzureStorageService storageService, ThreadPool threadPool) {
|
final RepositoryMetaData metadata,
|
||||||
super(metadata, environment.settings(), Repository.COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, threadPool);
|
final NamedXContentRegistry namedXContentRegistry,
|
||||||
|
final AzureStorageService storageService,
|
||||||
|
final ThreadPool threadPool) {
|
||||||
|
super(metadata, Repository.COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, threadPool);
|
||||||
this.chunkSize = Repository.CHUNK_SIZE_SETTING.get(metadata.settings());
|
this.chunkSize = Repository.CHUNK_SIZE_SETTING.get(metadata.settings());
|
||||||
this.storageService = storageService;
|
this.storageService = storageService;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class AzureRepositoryPlugin extends Plugin implements RepositoryPlugin, R
|
|||||||
public Map<String, Repository.Factory> getRepositories(Environment env, NamedXContentRegistry namedXContentRegistry,
|
public Map<String, Repository.Factory> getRepositories(Environment env, NamedXContentRegistry namedXContentRegistry,
|
||||||
ThreadPool threadPool) {
|
ThreadPool threadPool) {
|
||||||
return Collections.singletonMap(AzureRepository.TYPE,
|
return Collections.singletonMap(AzureRepository.TYPE,
|
||||||
(metadata) -> new AzureRepository(metadata, env, namedXContentRegistry, azureStoreService, threadPool));
|
(metadata) -> new AzureRepository(metadata, namedXContentRegistry, azureStoreService, threadPool));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.unit.ByteSizeUnit;
|
|||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.env.TestEnvironment;
|
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ public class AzureRepositorySettingsTests extends ESTestCase {
|
|||||||
.put(settings)
|
.put(settings)
|
||||||
.build();
|
.build();
|
||||||
final AzureRepository azureRepository = new AzureRepository(new RepositoryMetaData("foo", "azure", internalSettings),
|
final AzureRepository azureRepository = new AzureRepository(new RepositoryMetaData("foo", "azure", internalSettings),
|
||||||
TestEnvironment.newEnvironment(internalSettings), NamedXContentRegistry.EMPTY, mock(AzureStorageService.class),
|
NamedXContentRegistry.EMPTY, mock(AzureStorageService.class),
|
||||||
mock(ThreadPool.class));
|
mock(ThreadPool.class));
|
||||||
assertThat(azureRepository.getBlobStore(), is(nullValue()));
|
assertThat(azureRepository.getBlobStore(), is(nullValue()));
|
||||||
return azureRepository;
|
return azureRepository;
|
||||||
|
@ -54,7 +54,7 @@ public class GoogleCloudStoragePlugin extends Plugin implements RepositoryPlugin
|
|||||||
public Map<String, Repository.Factory> getRepositories(Environment env, NamedXContentRegistry namedXContentRegistry,
|
public Map<String, Repository.Factory> getRepositories(Environment env, NamedXContentRegistry namedXContentRegistry,
|
||||||
ThreadPool threadPool) {
|
ThreadPool threadPool) {
|
||||||
return Collections.singletonMap(GoogleCloudStorageRepository.TYPE,
|
return Collections.singletonMap(GoogleCloudStorageRepository.TYPE,
|
||||||
metadata -> new GoogleCloudStorageRepository(metadata, env, namedXContentRegistry, this.storageService, threadPool));
|
metadata -> new GoogleCloudStorageRepository(metadata, namedXContentRegistry, this.storageService, threadPool));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.settings.Setting;
|
|||||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.env.Environment;
|
|
||||||
import org.elasticsearch.repositories.RepositoryException;
|
import org.elasticsearch.repositories.RepositoryException;
|
||||||
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
@ -65,10 +64,12 @@ class GoogleCloudStorageRepository extends BlobStoreRepository {
|
|||||||
private final String bucket;
|
private final String bucket;
|
||||||
private final String clientName;
|
private final String clientName;
|
||||||
|
|
||||||
GoogleCloudStorageRepository(RepositoryMetaData metadata, Environment environment,
|
GoogleCloudStorageRepository(
|
||||||
NamedXContentRegistry namedXContentRegistry,
|
final RepositoryMetaData metadata,
|
||||||
GoogleCloudStorageService storageService, ThreadPool threadPool) {
|
final NamedXContentRegistry namedXContentRegistry,
|
||||||
super(metadata, environment.settings(), getSetting(COMPRESS, metadata), namedXContentRegistry, threadPool);
|
final GoogleCloudStorageService storageService,
|
||||||
|
final ThreadPool threadPool) {
|
||||||
|
super(metadata, getSetting(COMPRESS, metadata), namedXContentRegistry, threadPool);
|
||||||
this.storageService = storageService;
|
this.storageService = storageService;
|
||||||
|
|
||||||
String basePath = BASE_PATH.get(metadata.settings());
|
String basePath = BASE_PATH.get(metadata.settings());
|
||||||
|
@ -67,9 +67,12 @@ public final class HdfsRepository extends BlobStoreRepository {
|
|||||||
// TODO: why 100KB?
|
// TODO: why 100KB?
|
||||||
private static final ByteSizeValue DEFAULT_BUFFER_SIZE = new ByteSizeValue(100, ByteSizeUnit.KB);
|
private static final ByteSizeValue DEFAULT_BUFFER_SIZE = new ByteSizeValue(100, ByteSizeUnit.KB);
|
||||||
|
|
||||||
public HdfsRepository(RepositoryMetaData metadata, Environment environment,
|
public HdfsRepository(
|
||||||
NamedXContentRegistry namedXContentRegistry, ThreadPool threadPool) {
|
final RepositoryMetaData metadata,
|
||||||
super(metadata, environment.settings(), metadata.settings().getAsBoolean("compress", false), namedXContentRegistry, threadPool);
|
final Environment environment,
|
||||||
|
final NamedXContentRegistry namedXContentRegistry,
|
||||||
|
final ThreadPool threadPool) {
|
||||||
|
super(metadata, metadata.settings().getAsBoolean("compress", false), namedXContentRegistry, threadPool);
|
||||||
|
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
this.chunkSize = metadata.settings().getAsBytesSize("chunk_size", null);
|
this.chunkSize = metadata.settings().getAsBytesSize("chunk_size", null);
|
||||||
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.logging.DeprecationLogger;
|
|||||||
import org.elasticsearch.common.settings.SecureSetting;
|
import org.elasticsearch.common.settings.SecureSetting;
|
||||||
import org.elasticsearch.common.settings.SecureString;
|
import org.elasticsearch.common.settings.SecureString;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
|
||||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
@ -169,11 +168,12 @@ class S3Repository extends BlobStoreRepository {
|
|||||||
/**
|
/**
|
||||||
* Constructs an s3 backed repository
|
* Constructs an s3 backed repository
|
||||||
*/
|
*/
|
||||||
S3Repository(final RepositoryMetaData metadata,
|
S3Repository(
|
||||||
final Settings settings,
|
final RepositoryMetaData metadata,
|
||||||
final NamedXContentRegistry namedXContentRegistry,
|
final NamedXContentRegistry namedXContentRegistry,
|
||||||
final S3Service service, final ThreadPool threadPool) {
|
final S3Service service,
|
||||||
super(metadata, settings, COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, threadPool);
|
final ThreadPool threadPool) {
|
||||||
|
super(metadata, COMPRESS_SETTING.get(metadata.settings()), namedXContentRegistry, threadPool);
|
||||||
this.service = service;
|
this.service = service;
|
||||||
|
|
||||||
this.repositoryMetaData = metadata;
|
this.repositoryMetaData = metadata;
|
||||||
|
@ -76,17 +76,17 @@ public class S3RepositoryPlugin extends Plugin implements RepositoryPlugin, Relo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// proxy method for testing
|
// proxy method for testing
|
||||||
protected S3Repository createRepository(final RepositoryMetaData metadata,
|
protected S3Repository createRepository(
|
||||||
final Settings settings,
|
final RepositoryMetaData metadata,
|
||||||
final NamedXContentRegistry registry, final ThreadPool threadPool) {
|
final NamedXContentRegistry registry,
|
||||||
return new S3Repository(metadata, settings, registry, service, threadPool);
|
final ThreadPool threadPool) {
|
||||||
|
return new S3Repository(metadata, registry, service, threadPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Repository.Factory> getRepositories(final Environment env, final NamedXContentRegistry registry,
|
public Map<String, Repository.Factory> getRepositories(final Environment env, final NamedXContentRegistry registry,
|
||||||
final ThreadPool threadPool) {
|
final ThreadPool threadPool) {
|
||||||
return Collections.singletonMap(S3Repository.TYPE,
|
return Collections.singletonMap(S3Repository.TYPE, metadata -> createRepository(metadata, registry, threadPool));
|
||||||
metadata -> createRepository(metadata, env.settings(), registry, threadPool));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -270,9 +270,9 @@ public class RepositoryCredentialsTests extends ESSingleNodeTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected S3Repository createRepository(RepositoryMetaData metadata, Settings settings,
|
protected S3Repository createRepository(RepositoryMetaData metadata,
|
||||||
NamedXContentRegistry registry, ThreadPool threadPool) {
|
NamedXContentRegistry registry, ThreadPool threadPool) {
|
||||||
return new S3Repository(metadata, settings, registry, service, threadPool) {
|
return new S3Repository(metadata, registry, service, threadPool) {
|
||||||
@Override
|
@Override
|
||||||
protected void assertSnapshotOrGenericThread() {
|
protected void assertSnapshotOrGenericThread() {
|
||||||
// eliminate thread name check as we create repo manually on test/main threads
|
// eliminate thread name check as we create repo manually on test/main threads
|
||||||
|
@ -103,7 +103,7 @@ public class S3BlobStoreRepositoryTests extends ESBlobStoreRepositoryIntegTestCa
|
|||||||
public Map<String, Repository.Factory> getRepositories(final Environment env, final NamedXContentRegistry registry,
|
public Map<String, Repository.Factory> getRepositories(final Environment env, final NamedXContentRegistry registry,
|
||||||
final ThreadPool threadPool) {
|
final ThreadPool threadPool) {
|
||||||
return Collections.singletonMap(S3Repository.TYPE,
|
return Collections.singletonMap(S3Repository.TYPE,
|
||||||
metadata -> new S3Repository(metadata, env.settings(), registry, new S3Service() {
|
metadata -> new S3Repository(metadata, registry, new S3Service() {
|
||||||
@Override
|
@Override
|
||||||
AmazonS3 buildClient(S3ClientSettings clientSettings) {
|
AmazonS3 buildClient(S3ClientSettings clientSettings) {
|
||||||
return new MockAmazonS3(blobs, bucket, serverSideEncryption, cannedACL, storageClass);
|
return new MockAmazonS3(blobs, bucket, serverSideEncryption, cannedACL, storageClass);
|
||||||
|
@ -120,7 +120,7 @@ public class S3RepositoryTests extends ESTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private S3Repository createS3Repo(RepositoryMetaData metadata) {
|
private S3Repository createS3Repo(RepositoryMetaData metadata) {
|
||||||
return new S3Repository(metadata, Settings.EMPTY, NamedXContentRegistry.EMPTY, new DummyS3Service(), mock(ThreadPool.class)) {
|
return new S3Repository(metadata, NamedXContentRegistry.EMPTY, new DummyS3Service(), mock(ThreadPool.class)) {
|
||||||
@Override
|
@Override
|
||||||
protected void assertSnapshotOrGenericThread() {
|
protected void assertSnapshotOrGenericThread() {
|
||||||
// eliminate thread name check as we create repo manually on test/main threads
|
// eliminate thread name check as we create repo manually on test/main threads
|
||||||
|
@ -196,8 +196,6 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|||||||
|
|
||||||
private static final String DATA_BLOB_PREFIX = "__";
|
private static final String DATA_BLOB_PREFIX = "__";
|
||||||
|
|
||||||
private final Settings settings;
|
|
||||||
|
|
||||||
private final boolean compress;
|
private final boolean compress;
|
||||||
|
|
||||||
private final RateLimiter snapshotRateLimiter;
|
private final RateLimiter snapshotRateLimiter;
|
||||||
@ -229,12 +227,13 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|||||||
/**
|
/**
|
||||||
* Constructs new BlobStoreRepository
|
* Constructs new BlobStoreRepository
|
||||||
* @param metadata The metadata for this repository including name and settings
|
* @param metadata The metadata for this repository including name and settings
|
||||||
* @param settings Settings for the node this repository object is created on
|
|
||||||
* @param threadPool Threadpool to run long running repository manipulations on asynchronously
|
* @param threadPool Threadpool to run long running repository manipulations on asynchronously
|
||||||
*/
|
*/
|
||||||
protected BlobStoreRepository(RepositoryMetaData metadata, Settings settings, boolean compress,
|
protected BlobStoreRepository(
|
||||||
NamedXContentRegistry namedXContentRegistry, ThreadPool threadPool) {
|
final RepositoryMetaData metadata,
|
||||||
this.settings = settings;
|
final boolean compress,
|
||||||
|
final NamedXContentRegistry namedXContentRegistry,
|
||||||
|
final ThreadPool threadPool) {
|
||||||
this.compress = compress;
|
this.compress = compress;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.namedXContentRegistry = namedXContentRegistry;
|
this.namedXContentRegistry = namedXContentRegistry;
|
||||||
@ -704,8 +703,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
|
|||||||
* @return rate limiter or null of no throttling is needed
|
* @return rate limiter or null of no throttling is needed
|
||||||
*/
|
*/
|
||||||
private RateLimiter getRateLimiter(Settings repositorySettings, String setting, ByteSizeValue defaultRate) {
|
private RateLimiter getRateLimiter(Settings repositorySettings, String setting, ByteSizeValue defaultRate) {
|
||||||
ByteSizeValue maxSnapshotBytesPerSec = repositorySettings.getAsBytesSize(setting,
|
ByteSizeValue maxSnapshotBytesPerSec = repositorySettings.getAsBytesSize(setting, defaultRate);
|
||||||
settings.getAsBytesSize(setting, defaultRate));
|
|
||||||
if (maxSnapshotBytesPerSec.getBytes() <= 0) {
|
if (maxSnapshotBytesPerSec.getBytes() <= 0) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,7 @@ public class FsRepository extends BlobStoreRepository {
|
|||||||
*/
|
*/
|
||||||
public FsRepository(RepositoryMetaData metadata, Environment environment, NamedXContentRegistry namedXContentRegistry,
|
public FsRepository(RepositoryMetaData metadata, Environment environment, NamedXContentRegistry namedXContentRegistry,
|
||||||
ThreadPool threadPool) {
|
ThreadPool threadPool) {
|
||||||
super(metadata, environment.settings(), calculateCompress(metadata, environment), namedXContentRegistry, threadPool);
|
super(metadata, calculateCompress(metadata, environment), namedXContentRegistry, threadPool);
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
String location = REPOSITORIES_LOCATION_SETTING.get(metadata.settings());
|
String location = REPOSITORIES_LOCATION_SETTING.get(metadata.settings());
|
||||||
if (location.isEmpty()) {
|
if (location.isEmpty()) {
|
||||||
|
@ -1064,7 +1064,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|||||||
} else {
|
} else {
|
||||||
return metaData -> {
|
return metaData -> {
|
||||||
final Repository repository = new MockEventuallyConsistentRepository(
|
final Repository repository = new MockEventuallyConsistentRepository(
|
||||||
metaData, environment, xContentRegistry(), deterministicTaskQueue.getThreadPool(), blobStoreContext);
|
metaData, xContentRegistry(), deterministicTaskQueue.getThreadPool(), blobStoreContext);
|
||||||
repository.start();
|
repository.start();
|
||||||
return repository;
|
return repository;
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,6 @@ import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
|
|||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.env.Environment;
|
|
||||||
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
import org.elasticsearch.repositories.blobstore.BlobStoreRepository;
|
||||||
import org.elasticsearch.snapshots.SnapshotInfo;
|
import org.elasticsearch.snapshots.SnapshotInfo;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
@ -68,9 +67,12 @@ public class MockEventuallyConsistentRepository extends BlobStoreRepository {
|
|||||||
|
|
||||||
private final NamedXContentRegistry namedXContentRegistry;
|
private final NamedXContentRegistry namedXContentRegistry;
|
||||||
|
|
||||||
public MockEventuallyConsistentRepository(RepositoryMetaData metadata, Environment environment,
|
public MockEventuallyConsistentRepository(
|
||||||
NamedXContentRegistry namedXContentRegistry, ThreadPool threadPool, Context context) {
|
RepositoryMetaData metadata,
|
||||||
super(metadata, environment.settings(), false, namedXContentRegistry, threadPool);
|
NamedXContentRegistry namedXContentRegistry,
|
||||||
|
ThreadPool threadPool,
|
||||||
|
Context context) {
|
||||||
|
super(metadata,false, namedXContentRegistry, threadPool);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.namedXContentRegistry = namedXContentRegistry;
|
this.namedXContentRegistry = namedXContentRegistry;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testReadAfterWriteConsistently() throws IOException {
|
public void testReadAfterWriteConsistently() throws IOException {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
||||||
@ -82,7 +82,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testReadAfterWriteAfterReadThrows() throws IOException {
|
public void testReadAfterWriteAfterReadThrows() throws IOException {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
||||||
@ -98,7 +98,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testReadAfterDeleteAfterWriteThrows() throws IOException {
|
public void testReadAfterDeleteAfterWriteThrows() throws IOException {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
final BlobContainer blobContainer = repository.blobStore().blobContainer(repository.basePath());
|
||||||
@ -116,7 +116,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testOverwriteRandomBlobFails() throws IOException {
|
public void testOverwriteRandomBlobFails() throws IOException {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
final BlobContainer container = repository.blobStore().blobContainer(repository.basePath());
|
final BlobContainer container = repository.blobStore().blobContainer(repository.basePath());
|
||||||
@ -133,7 +133,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testOverwriteShardSnapBlobFails() throws IOException {
|
public void testOverwriteShardSnapBlobFails() throws IOException {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
final BlobContainer container =
|
final BlobContainer container =
|
||||||
@ -151,7 +151,7 @@ public class MockEventuallyConsistentRepositoryTests extends ESTestCase {
|
|||||||
public void testOverwriteSnapshotInfoBlob() {
|
public void testOverwriteSnapshotInfoBlob() {
|
||||||
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
MockEventuallyConsistentRepository.Context blobStoreContext = new MockEventuallyConsistentRepository.Context();
|
||||||
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
try (BlobStoreRepository repository = new MockEventuallyConsistentRepository(
|
||||||
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY), environment,
|
new RepositoryMetaData("testRepo", "mockEventuallyConsistent", Settings.EMPTY),
|
||||||
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
xContentRegistry(), mock(ThreadPool.class), blobStoreContext)) {
|
||||||
repository.start();
|
repository.start();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user