Skip to content

Commit

Permalink
RemoteIndexRecoveryIT.testRerouteRecovery: fix simluated slow down fo…
Browse files Browse the repository at this point in the history
…r remote backed index recovery

Signed-off-by: bansvaru <[email protected]>
  • Loading branch information
linuxpi committed Aug 30, 2023
1 parent 8324b88 commit ba41aa9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private void assertOnGoingRecoveryState(
assertThat(state.getStage(), not(equalTo(Stage.DONE)));
}

private void slowDownRecovery(ByteSizeValue shardSize) {
public void slowDownRecovery(ByteSizeValue shardSize) {
long chunkSize = Math.max(1, shardSize.getBytes() / 10);
assertTrue(
client().admin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.util.FeatureFlags;
import org.opensearch.core.common.unit.ByteSizeUnit;
import org.opensearch.core.common.unit.ByteSizeValue;
import org.opensearch.index.IndexModule;
import org.opensearch.index.IndexSettings;
import org.opensearch.indices.recovery.IndexRecoveryIT;
Expand Down Expand Up @@ -171,4 +173,25 @@ public void testDisconnectsDuringRecovery() {
public void testReplicaRecovery() {

}

/**
* Slowing down recoveries for remote backed indices requires to limit download bytes for remote repository
*/
@Override
public void slowDownRecovery(ByteSizeValue shardSize) {
long chunkSize = Math.max(1, shardSize.getBytes() / 10);
assertAcked(
client().admin()
.cluster()
.preparePutRepository(REPOSITORY_NAME)
.setType("fs")
.setSettings(
Settings.builder()
.put("location", absolutePath)
.put("max_remote_download_bytes_per_sec", chunkSize, ByteSizeUnit.BYTES)
.put("chunk_size", chunkSize, ByteSizeUnit.BYTES)

)
);
}
}

0 comments on commit ba41aa9

Please sign in to comment.