Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Bafna <gbbafna@amazon.com>
  • Loading branch information
gbbafna committed Sep 20, 2024
1 parent 16063da commit e69972b
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public void testConcurrentSnapshotV2CreateOperation_MasterChange() throws Interr
assertThat(repositoryData.getSnapshotIds().size(), greaterThanOrEqualTo(1));
thread.join();
}

public void testCreateSnapshotV2WithRedIndex() throws Exception {
internalCluster().startClusterManagerOnlyNode(pinnedTimestampSettings());
internalCluster().startDataOnlyNode(pinnedTimestampSettings());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
import org.opensearch.test.OpenSearchIntegTestCase;

import java.nio.file.Path;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;

@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
public class CloneSnapshotV2IT extends AbstractSnapshotIntegTestCase {
Expand Down Expand Up @@ -135,11 +136,24 @@ public void testCloneShallowCopyV2() throws Exception {
awaitClusterManagerFinishRepoOperations();

// Validate that snapshot is present in repository data
PlainActionFuture<RepositoryData> repositoryDataPlainActionFutureClone = new PlainActionFuture<>();
repository.getRepositoryData(repositoryDataPlainActionFutureClone);
waitUntil(
() -> {
PlainActionFuture<RepositoryData> repositoryDataPlainActionFutureClone = new PlainActionFuture<>();
repository.getRepositoryData(repositoryDataPlainActionFutureClone);

RepositoryData repositoryData1 = null;
try {
repositoryData1 = repositoryDataPlainActionFutureClone.get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
logger.info("Testing it now ");
return (repositoryData1.getSnapshotIds().size() == 2);
}, 90, TimeUnit.SECONDS
);

repositoryData = repositoryDataPlainActionFutureClone.get();
assertEquals(repositoryData.getSnapshotIds().size(), 2);
boolean foundCloneInRepoData = false;
SnapshotId cloneSnapshotId = null;
for (SnapshotId snapshotId : repositoryData.getSnapshotIds()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,8 @@ public static Entry startClone(
source,
Map.of(),
remoteStoreIndexShallowCopyV2,
remoteStoreIndexShallowCopyV2// initialising to false, will be updated in startCloning method of SnapshotsService while updating
// entry with
// clone jobs
remoteStoreIndexShallowCopyV2// initialising to false, will be updated in startCloning method of SnapshotsService
// while updating entry with clone jobs
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ public void updateState(ClusterState state) {
+ "] to generation ["
+ metadata.generation()
+ "]";
logger.debug("Updated repository generation from [{}] to [{}]", previousBest, metadata.generation());
logger.info("Updated repository generation from [{}] to [{}]", previousBest, metadata.generation());
}
}
}
Expand Down Expand Up @@ -2868,6 +2868,8 @@ public void getRepositoryData(ActionListener<RepositoryData> listener) {
}
final Tuple<Long, BytesReference> cached = latestKnownRepositoryData.get();
// Fast path loading repository data directly from cache if we're in fully consistent mode and the cache matches up with
// Fast path loading repository data directly from cache if we're in fully consistent mode and the cache matches up with
// Fast path loading repository data directly from cache if we're in fully consistent mode and the cache matches up with
// the latest known repository generation
if (bestEffortConsistency == false && cached != null && cached.v1() == latestKnownRepoGen.get()) {
try {
Expand Down
Loading

0 comments on commit e69972b

Please sign in to comment.