Search in sources :

Example 1 with FsRepository

use of org.opensearch.repositories.fs.FsRepository in project OpenSearch by opensearch-project.

the class BlobStoreRepositoryTests method testFsRepositoryCompressDeprecated.

public void testFsRepositoryCompressDeprecated() {
    final Path location = OpenSearchIntegTestCase.randomRepoPath(node().settings());
    final Settings settings = Settings.builder().put(node().settings()).put("location", location).build();
    final RepositoryMetadata metadata = new RepositoryMetadata("test-repo", REPO_TYPE, settings);
    Settings useCompressSettings = Settings.builder().put(node().getEnvironment().settings()).put(FsRepository.REPOSITORIES_COMPRESS_SETTING.getKey(), true).build();
    Environment useCompressEnvironment = new Environment(useCompressSettings, node().getEnvironment().configFile());
    new FsRepository(metadata, useCompressEnvironment, null, BlobStoreTestUtil.mockClusterService(), null);
    assertWarnings("[repositories.fs.compress] setting was deprecated in OpenSearch and will be removed in a future release!" + " See the breaking changes documentation for the next major version.");
}
Also used : Path(java.nio.file.Path) RepositoryMetadata(org.opensearch.cluster.metadata.RepositoryMetadata) Environment(org.opensearch.env.Environment) RecoverySettings(org.opensearch.indices.recovery.RecoverySettings) Settings(org.opensearch.common.settings.Settings) FsRepository(org.opensearch.repositories.fs.FsRepository)

Example 2 with FsRepository

use of org.opensearch.repositories.fs.FsRepository in project OpenSearch by opensearch-project.

the class BlobStoreRepositoryRestoreTests method createRepository.

/**
 * Create a {@link Repository} with a random name *
 */
private Repository createRepository() {
    Settings settings = Settings.builder().put("location", randomAlphaOfLength(10)).build();
    RepositoryMetadata repositoryMetadata = new RepositoryMetadata(randomAlphaOfLength(10), FsRepository.TYPE, settings);
    final ClusterService clusterService = BlobStoreTestUtil.mockClusterService(repositoryMetadata);
    final FsRepository repository = new FsRepository(repositoryMetadata, createEnvironment(), xContentRegistry(), clusterService, new RecoverySettings(Settings.EMPTY, new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS))) {

        @Override
        protected void assertSnapshotOrGenericThread() {
        // eliminate thread name check as we create repo manually
        }
    };
    clusterService.addStateApplier(event -> repository.updateState(event.state()));
    // Apply state once to initialize repo properly like RepositoriesService would
    repository.updateState(clusterService.state());
    repository.start();
    return repository;
}
Also used : ClusterService(org.opensearch.cluster.service.ClusterService) ClusterSettings(org.opensearch.common.settings.ClusterSettings) RepositoryMetadata(org.opensearch.cluster.metadata.RepositoryMetadata) RecoverySettings(org.opensearch.indices.recovery.RecoverySettings) ClusterSettings(org.opensearch.common.settings.ClusterSettings) RecoverySettings(org.opensearch.indices.recovery.RecoverySettings) Settings(org.opensearch.common.settings.Settings) FsRepository(org.opensearch.repositories.fs.FsRepository)

Aggregations

RepositoryMetadata (org.opensearch.cluster.metadata.RepositoryMetadata)2 Settings (org.opensearch.common.settings.Settings)2 RecoverySettings (org.opensearch.indices.recovery.RecoverySettings)2 FsRepository (org.opensearch.repositories.fs.FsRepository)2 Path (java.nio.file.Path)1 ClusterService (org.opensearch.cluster.service.ClusterService)1 ClusterSettings (org.opensearch.common.settings.ClusterSettings)1 Environment (org.opensearch.env.Environment)1