Search in sources :

Example 51 with RepositoryData

use of org.opensearch.repositories.RepositoryData in project OpenSearch by opensearch-project.

the class BlobStoreRepositoryTests method testRepositoryDataConcurrentModificationNotAllowed.

public void testRepositoryDataConcurrentModificationNotAllowed() {
    final BlobStoreRepository repository = setupRepo();
    // write to index generational file
    RepositoryData repositoryData = generateRandomRepoData();
    final long startingGeneration = repositoryData.getGenId();
    final PlainActionFuture<RepositoryData> future1 = PlainActionFuture.newFuture();
    repository.writeIndexGen(repositoryData, startingGeneration, Version.CURRENT, Function.identity(), future1);
    // write repo data again to index generational file, errors because we already wrote to the
    // N+1 generation from which this repository data instance was created
    expectThrows(RepositoryException.class, () -> writeIndexGen(repository, repositoryData.withGenId(startingGeneration + 1), repositoryData.getGenId()));
}
Also used : RepositoryData(org.opensearch.repositories.RepositoryData)

Aggregations

RepositoryData (org.opensearch.repositories.RepositoryData)51 IndexId (org.opensearch.repositories.IndexId)31 Repository (org.opensearch.repositories.Repository)31 IOException (java.io.IOException)28 Collections (java.util.Collections)28 List (java.util.List)28 Map (java.util.Map)28 ClusterState (org.opensearch.cluster.ClusterState)28 ClusterService (org.opensearch.cluster.service.ClusterService)27 Collectors (java.util.stream.Collectors)26 ThreadPool (org.opensearch.threadpool.ThreadPool)26 Version (org.opensearch.Version)25 RepositoriesService (org.opensearch.repositories.RepositoriesService)25 Set (java.util.Set)24 ArrayList (java.util.ArrayList)23 IndexMetadata (org.opensearch.cluster.metadata.IndexMetadata)23 Settings (org.opensearch.common.settings.Settings)23 Collection (java.util.Collection)22 LogManager (org.apache.logging.log4j.LogManager)22 Logger (org.apache.logging.log4j.Logger)22