Skip to content

Commit

Permalink
Add Integration Test
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Sep 27, 2023
1 parent 9a0bd31 commit 20f87f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.remotestore;

import org.opensearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.opensearch.action.admin.indices.delete.DeleteIndexRequest;
import org.opensearch.action.admin.indices.get.GetIndexRequest;
Expand All @@ -26,6 +27,7 @@
import org.opensearch.index.shard.IndexShard;
import org.opensearch.index.translog.Translog.Durability;
import org.opensearch.indices.IndicesService;
import org.opensearch.indices.recovery.RecoverySettings;
import org.opensearch.indices.recovery.RecoveryState;
import org.opensearch.plugins.Plugin;
import org.opensearch.test.OpenSearchIntegTestCase;
Expand Down Expand Up @@ -120,6 +122,16 @@ public void testPeerRecoveryWithRemoteStoreAndRemoteTranslogFlush() throws Excep
testPeerRecovery(randomIntBetween(2, 5), true);
}

public void testPeerRecoveryWithLowActivityTimeout() throws Exception {
ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings(
Settings.builder()
.put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "20kb")
.put(RecoverySettings.INDICES_RECOVERY_ACTIVITY_TIMEOUT_SETTING.getKey(), "1s")
);
internalCluster().client().admin().cluster().updateSettings(req).get();
testPeerRecovery(randomIntBetween(2, 5), true);
}

public void testPeerRecoveryWithRemoteStoreAndRemoteTranslogNoDataRefresh() throws Exception {
testPeerRecovery(1, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4922,6 +4922,7 @@ private void downloadSegments(
);

final ActionListener<String> segmentsDownloadListener = ActionListener.map(batchDownloadListener, fileName -> {
logger.info("finished file={}", fileName);
onFileSync.run();
if (targetRemoteDirectory != null) {
targetRemoteDirectory.copyFrom(storeDirectory, fileName, fileName, IOContext.DEFAULT);
Expand All @@ -4930,7 +4931,10 @@ private void downloadSegments(
});

final Path indexPath = store.shardPath() == null ? null : store.shardPath().resolveIndex();
toDownloadSegments.forEach(file -> sourceRemoteDirectory.copyTo(file, storeDirectory, indexPath, segmentsDownloadListener));
toDownloadSegments.forEach(file -> {
logger.info("started file={}", file);
sourceRemoteDirectory.copyTo(file, storeDirectory, indexPath, segmentsDownloadListener);
});
completionListener.actionGet();
}

Expand Down

0 comments on commit 20f87f6

Please sign in to comment.