|
9 | 9 | package org.opensearch.remotemigration;
|
10 | 10 |
|
11 | 11 | import org.opensearch.action.DocWriteResponse;
|
12 |
| -import org.opensearch.action.admin.cluster.health.ClusterHealthRequest; |
13 |
| -import org.opensearch.action.admin.cluster.health.ClusterHealthResponse; |
14 | 12 | import org.opensearch.action.admin.cluster.repositories.get.GetRepositoriesRequest;
|
15 | 13 | import org.opensearch.action.admin.cluster.repositories.get.GetRepositoriesResponse;
|
16 | 14 | import org.opensearch.action.bulk.BulkRequest;
|
17 | 15 | import org.opensearch.action.bulk.BulkResponse;
|
18 | 16 | import org.opensearch.action.delete.DeleteResponse;
|
19 | 17 | import org.opensearch.action.index.IndexRequest;
|
20 | 18 | import org.opensearch.action.index.IndexResponse;
|
21 |
| -import org.opensearch.client.Requests; |
22 | 19 | import org.opensearch.cluster.ClusterState;
|
23 |
| -import org.opensearch.cluster.health.ClusterHealthStatus; |
24 | 20 | import org.opensearch.cluster.metadata.RepositoryMetadata;
|
25 | 21 | import org.opensearch.cluster.routing.RoutingNode;
|
26 |
| -import org.opensearch.common.Priority; |
27 | 22 | import org.opensearch.common.UUIDs;
|
28 | 23 | import org.opensearch.common.settings.Settings;
|
29 |
| -import org.opensearch.common.unit.TimeValue; |
30 | 24 | import org.opensearch.repositories.fs.ReloadableFsRepository;
|
31 | 25 | import org.opensearch.test.OpenSearchIntegTestCase;
|
32 | 26 | import org.junit.Before;
|
|
45 | 39 | import static org.opensearch.node.remotestore.RemoteStoreNodeService.REMOTE_STORE_COMPATIBILITY_MODE_SETTING;
|
46 | 40 | import static org.opensearch.repositories.fs.ReloadableFsRepository.REPOSITORIES_FAILRATE_SETTING;
|
47 | 41 | import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
|
48 |
| -import static org.hamcrest.Matchers.equalTo; |
49 | 42 |
|
50 | 43 | public class MigrationBaseTestCase extends OpenSearchIntegTestCase {
|
51 | 44 | protected static final String REPOSITORY_NAME = "test-remote-store-repo";
|
@@ -121,10 +114,6 @@ public void initDocRepToRemoteMigration() {
|
121 | 114 | );
|
122 | 115 | }
|
123 | 116 |
|
124 |
| - public ClusterHealthStatus ensureGreen(String... indices) { |
125 |
| - return ensureGreen(TimeValue.timeValueSeconds(60), indices); |
126 |
| - } |
127 |
| - |
128 | 117 | public BulkResponse indexBulk(String indexName, int numDocs) {
|
129 | 118 | BulkRequest bulkRequest = new BulkRequest();
|
130 | 119 | for (int i = 0; i < numDocs; i++) {
|
@@ -192,12 +181,14 @@ private Thread getIndexingThread() {
|
192 | 181 | long currentDocCount = indexedDocs.incrementAndGet();
|
193 | 182 | if (currentDocCount > 0 && currentDocCount % refreshFrequency == 0) {
|
194 | 183 | if (rarely()) {
|
| 184 | + logger.info("--> [iteration {}] flushing index", currentDocCount); |
195 | 185 | client().admin().indices().prepareFlush(indexName).get();
|
196 |
| - logger.info("Completed ingestion of {} docs. Flushing now", currentDocCount); |
197 | 186 | } else {
|
| 187 | + logger.info("--> [iteration {}] refreshing index", currentDocCount); |
198 | 188 | client().admin().indices().prepareRefresh(indexName).get();
|
199 | 189 | }
|
200 | 190 | }
|
| 191 | + logger.info("Completed ingestion of {} docs", currentDocCount); |
201 | 192 | }
|
202 | 193 | });
|
203 | 194 | }
|
@@ -227,21 +218,4 @@ public void stopShardRebalancing() {
|
227 | 218 | .get()
|
228 | 219 | );
|
229 | 220 | }
|
230 |
| - |
231 |
| - public ClusterHealthStatus waitForRelocation() { |
232 |
| - ClusterHealthRequest request = Requests.clusterHealthRequest() |
233 |
| - .waitForNoRelocatingShards(true) |
234 |
| - .timeout(TimeValue.timeValueSeconds(60)) |
235 |
| - .waitForEvents(Priority.LANGUID); |
236 |
| - ClusterHealthResponse actionGet = client().admin().cluster().health(request).actionGet(); |
237 |
| - if (actionGet.isTimedOut()) { |
238 |
| - logger.info( |
239 |
| - "waitForRelocation timed out, cluster state:\n{}\n{}", |
240 |
| - client().admin().cluster().prepareState().get().getState(), |
241 |
| - client().admin().cluster().preparePendingClusterTasks().get() |
242 |
| - ); |
243 |
| - assertThat("timed out waiting for relocation", actionGet.isTimedOut(), equalTo(false)); |
244 |
| - } |
245 |
| - return actionGet.getStatus(); |
246 |
| - } |
247 | 221 | }
|
0 commit comments