|
10 | 10 |
|
11 | 11 | import org.opensearch.cluster.metadata.IndexMetadata;
|
12 | 12 | import org.opensearch.common.settings.Settings;
|
| 13 | +import org.opensearch.core.common.unit.ByteSizeUnit; |
| 14 | +import org.opensearch.core.common.unit.ByteSizeValue; |
13 | 15 | import org.opensearch.index.IndexModule;
|
14 | 16 | import org.opensearch.index.IndexSettings;
|
15 | 17 | import org.opensearch.indices.recovery.IndexRecoveryIT;
|
| 18 | +import org.opensearch.indices.recovery.RecoverySettings; |
16 | 19 | import org.opensearch.indices.replication.common.ReplicationType;
|
17 | 20 | import org.opensearch.test.OpenSearchIntegTestCase;
|
18 | 21 | import org.hamcrest.Matcher;
|
|
22 | 25 |
|
23 | 26 | import java.nio.file.Path;
|
24 | 27 |
|
| 28 | +import static org.opensearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_CHUNK_SIZE_SETTING; |
25 | 29 | import static org.opensearch.remotestore.RemoteStoreBaseIntegTestCase.remoteStoreClusterSettings;
|
26 | 30 |
|
27 | 31 | @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0)
|
@@ -54,6 +58,26 @@ public Settings indexSettings() {
|
54 | 58 | .build();
|
55 | 59 | }
|
56 | 60 |
|
| 61 | + @Override |
| 62 | + public void slowDownRecovery(ByteSizeValue shardSize) { |
| 63 | + logger.info("--> shardSize: " + shardSize); |
| 64 | + long chunkSize = Math.max(1, shardSize.getBytes() / 50); |
| 65 | + assertTrue( |
| 66 | + client().admin() |
| 67 | + .cluster() |
| 68 | + .prepareUpdateSettings() |
| 69 | + .setTransientSettings( |
| 70 | + Settings.builder() |
| 71 | + // one chunk per sec.. |
| 72 | + .put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), chunkSize, ByteSizeUnit.BYTES) |
| 73 | + // small chunks |
| 74 | + .put(INDICES_RECOVERY_CHUNK_SIZE_SETTING.getKey(), new ByteSizeValue(chunkSize, ByteSizeUnit.BYTES)) |
| 75 | + ) |
| 76 | + .get() |
| 77 | + .isAcknowledged() |
| 78 | + ); |
| 79 | + } |
| 80 | + |
57 | 81 | @After
|
58 | 82 | public void teardown() {
|
59 | 83 | clusterAdmin().prepareCleanupRepository(REPOSITORY_NAME).get();
|
|
0 commit comments