Skip to content

Commit

Permalink
[Snapshot V2] Support pinned timestamp in clone flow (#15524)
Browse files Browse the repository at this point in the history
Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
  • Loading branch information
anshu1106 committed Sep 6, 2024
1 parent 6f45a74 commit debd040
Show file tree
Hide file tree
Showing 4 changed files with 713 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import java.util.List;
import java.util.concurrent.ExecutionException;

import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings;
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
Expand Down Expand Up @@ -127,7 +126,7 @@ public void testShardClone() throws Exception {
}

public void testCloneSnapshotIndex() throws Exception {
internalCluster().startClusterManagerOnlyNode();
internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS);
internalCluster().startDataOnlyNode();
final String repoName = "repo-name";
createRepository(repoName, "fs");
Expand Down Expand Up @@ -318,7 +317,7 @@ public void testClonePreventsSnapshotDelete() throws Exception {
indexRandomDocs(indexName, randomIntBetween(20, 100));

final String targetSnapshot = "target-snapshot";
blockNodeOnAnyFiles(repoName, clusterManagerName);
blockClusterManagerOnWriteIndexFile(repoName);
final ActionFuture<AcknowledgedResponse> cloneFuture = startClone(repoName, sourceSnapshot, targetSnapshot, indexName);
waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L));
assertFalse(cloneFuture.isDone());
Expand Down Expand Up @@ -426,7 +425,7 @@ public void testLongRunningSnapshotAllowsConcurrentClone() throws Exception {
}

public void testDeletePreventsClone() throws Exception {
final String clusterManagerName = internalCluster().startClusterManagerOnlyNode();
final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS);
internalCluster().startDataOnlyNode();
final String repoName = "repo-name";
createRepository(repoName, "mock");
Expand All @@ -439,7 +438,7 @@ public void testDeletePreventsClone() throws Exception {
indexRandomDocs(indexName, randomIntBetween(20, 100));

final String targetSnapshot = "target-snapshot";
blockNodeOnAnyFiles(repoName, clusterManagerName);
blockClusterManagerOnWriteIndexFile(repoName);
final ActionFuture<AcknowledgedResponse> deleteFuture = startDeleteSnapshot(repoName, sourceSnapshot);
waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L));
assertFalse(deleteFuture.isDone());
Expand Down Expand Up @@ -591,7 +590,7 @@ public void testClusterManagerFailoverDuringCloneStep2() throws Exception {

public void testExceptionDuringShardClone() throws Exception {
// large snapshot pool so blocked snapshot threads from cloning don't prevent concurrent snapshot finalizations
internalCluster().startClusterManagerOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS);
internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS);
internalCluster().startDataOnlyNode();
final String repoName = "test-repo";
createRepository(repoName, "mock");
Expand All @@ -602,7 +601,7 @@ public void testExceptionDuringShardClone() throws Exception {
createFullSnapshot(repoName, sourceSnapshot);

final String targetSnapshot = "target-snapshot";
blockClusterManagerFromFinalizingSnapshotOnSnapFile(repoName);
blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName);
final ActionFuture<AcknowledgedResponse> cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex);
awaitNumberOfSnapshotsInProgress(1);
final String clusterManagerNode = internalCluster().getClusterManagerName();
Expand Down Expand Up @@ -680,7 +679,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw
}

public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws Exception {
final String clusterManagerName = internalCluster().startClusterManagerOnlyNode();
final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS);
internalCluster().startDataOnlyNode();
final String repoName = "test-repo";
createRepository(repoName, "mock");
Expand Down
Loading

0 comments on commit debd040

Please sign in to comment.