Skip to content

Commit

Permalink
[Snapshot V2] Support pinned timestamp in clone flow (#15524) (#15787)
Browse files Browse the repository at this point in the history
(cherry picked from commit debd040)

Signed-off-by: Anshu Agarwal <anshukag@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 8a119fa commit 076e7cb
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 @@ -145,7 +144,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 @@ -336,7 +335,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 @@ -444,7 +443,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 @@ -457,7 +456,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 @@ -609,7 +608,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 @@ -620,7 +619,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 @@ -698,7 +697,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 076e7cb

Please sign in to comment.