|
8 | 8 |
|
9 | 9 | package org.opensearch.remotemigration; |
10 | 10 |
|
11 | | -import org.opensearch.action.admin.cluster.configuration.AddVotingConfigExclusionsAction; |
12 | | -import org.opensearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest; |
13 | 11 | import org.opensearch.cluster.ClusterState; |
14 | 12 | import org.opensearch.cluster.health.ClusterHealthStatus; |
15 | 13 | import org.opensearch.cluster.metadata.IndexMetadata; |
16 | 14 | import org.opensearch.cluster.node.DiscoveryNodes; |
17 | 15 | import org.opensearch.cluster.routing.ShardRouting; |
18 | 16 | import org.opensearch.cluster.routing.allocation.command.MoveAllocationCommand; |
19 | 17 | import org.opensearch.common.settings.Settings; |
20 | | -import org.opensearch.core.util.FileSystemUtils; |
21 | | -import org.opensearch.index.remote.RemoteIndexPath; |
22 | | -import org.opensearch.index.remote.RemoteIndexPathUploader; |
23 | | -import org.opensearch.index.remote.RemoteStoreEnums; |
24 | 18 | import org.opensearch.indices.replication.common.ReplicationType; |
25 | 19 | import org.opensearch.test.InternalTestCluster; |
26 | 20 | import org.opensearch.test.OpenSearchIntegTestCase; |
27 | 21 |
|
28 | | -import java.nio.file.Path; |
29 | | -import java.util.Arrays; |
30 | 22 | import java.util.List; |
31 | 23 | import java.util.function.Function; |
32 | 24 | import java.util.stream.Collectors; |
33 | 25 |
|
34 | | -import static org.opensearch.indices.RemoteStoreSettings.CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING; |
35 | 26 | import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; |
36 | 27 |
|
37 | 28 | @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) |
@@ -471,80 +462,80 @@ public void testRemotePathMetadataAddedWithFirstPrimaryMovingToRemote() throws E |
471 | 462 | * exclude docrep nodes, assert that remote index path file exists |
472 | 463 | * when shards start relocating to the remote nodes. |
473 | 464 | */ |
474 | | - public void testRemoteIndexPathFileExistsAfterMigration() throws Exception { |
475 | | - String docrepClusterManager = internalCluster().startClusterManagerOnlyNode(); |
476 | | - |
477 | | - logger.info("---> Starting 2 docrep nodes"); |
478 | | - addRemote = false; |
479 | | - internalCluster().startDataOnlyNodes(2, Settings.builder().put("node.attr._type", "docrep").build()); |
480 | | - internalCluster().validateClusterFormed(); |
481 | | - |
482 | | - logger.info("---> Creating index with 1 primary and 1 replica"); |
483 | | - String indexName = "migration-index"; |
484 | | - Settings oneReplica = Settings.builder() |
485 | | - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) |
486 | | - .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
487 | | - .build(); |
488 | | - createIndexAndAssertDocrepProperties(indexName, oneReplica); |
489 | | - |
490 | | - String indexUUID = internalCluster().client() |
491 | | - .admin() |
492 | | - .indices() |
493 | | - .prepareGetSettings(indexName) |
494 | | - .get() |
495 | | - .getSetting(indexName, IndexMetadata.SETTING_INDEX_UUID); |
496 | | - |
497 | | - logger.info("---> Starting indexing in parallel"); |
498 | | - AsyncIndexingService indexingService = new AsyncIndexingService(indexName); |
499 | | - indexingService.startIndexing(); |
500 | | - |
501 | | - logger.info("---> Adding 2 remote enabled nodes to the cluster & cluster manager"); |
502 | | - initDocRepToRemoteMigration(); |
503 | | - addRemote = true; |
504 | | - internalCluster().startClusterManagerOnlyNode(); |
505 | | - internalCluster().startDataOnlyNodes(2, Settings.builder().put("node.attr._type", "remote").build()); |
506 | | - internalCluster().validateClusterFormed(); |
507 | | - |
508 | | - assertTrue( |
509 | | - internalCluster().client() |
510 | | - .admin() |
511 | | - .cluster() |
512 | | - .prepareUpdateSettings() |
513 | | - .setPersistentSettings( |
514 | | - Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), RemoteStoreEnums.PathType.HASHED_PREFIX) |
515 | | - ) |
516 | | - .get() |
517 | | - .isAcknowledged() |
518 | | - ); |
519 | | - |
520 | | - // elect cluster manager with remote-cluster state enabled |
521 | | - internalCluster().client() |
522 | | - .execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(docrepClusterManager)) |
523 | | - .get(); |
524 | | - |
525 | | - internalCluster().validateClusterFormed(); |
526 | | - |
527 | | - logger.info("---> Excluding docrep nodes from allocation"); |
528 | | - excludeNodeSet("type", "docrep"); |
529 | | - |
530 | | - waitForRelocation(); |
531 | | - waitNoPendingTasksOnAll(); |
532 | | - indexingService.stopIndexing(); |
533 | | - |
534 | | - // validate remote index path file exists |
535 | | - logger.info("---> Asserting remote index path file exists"); |
536 | | - String fileNamePrefix = String.join(RemoteIndexPathUploader.DELIMITER, indexUUID, "7", RemoteIndexPath.DEFAULT_VERSION); |
537 | | - |
538 | | - assertTrue(FileSystemUtils.exists(translogRepoPath.resolve(RemoteIndexPath.DIR))); |
539 | | - Path[] files = FileSystemUtils.files(translogRepoPath.resolve(RemoteIndexPath.DIR)); |
540 | | - assertEquals(1, files.length); |
541 | | - assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix))); |
542 | | - |
543 | | - assertTrue(FileSystemUtils.exists(segmentRepoPath.resolve(RemoteIndexPath.DIR))); |
544 | | - files = FileSystemUtils.files(segmentRepoPath.resolve(RemoteIndexPath.DIR)); |
545 | | - assertEquals(1, files.length); |
546 | | - assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix))); |
547 | | - } |
| 465 | + // public void testRemoteIndexPathFileExistsAfterMigration() throws Exception { |
| 466 | + // String docrepClusterManager = internalCluster().startClusterManagerOnlyNode(); |
| 467 | + // |
| 468 | + // logger.info("---> Starting 2 docrep nodes"); |
| 469 | + // addRemote = false; |
| 470 | + // internalCluster().startDataOnlyNodes(2, Settings.builder().put("node.attr._type", "docrep").build()); |
| 471 | + // internalCluster().validateClusterFormed(); |
| 472 | + // |
| 473 | + // logger.info("---> Creating index with 1 primary and 1 replica"); |
| 474 | + // String indexName = "migration-index"; |
| 475 | + // Settings oneReplica = Settings.builder() |
| 476 | + // .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) |
| 477 | + // .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
| 478 | + // .build(); |
| 479 | + // createIndexAndAssertDocrepProperties(indexName, oneReplica); |
| 480 | + // |
| 481 | + // String indexUUID = internalCluster().client() |
| 482 | + // .admin() |
| 483 | + // .indices() |
| 484 | + // .prepareGetSettings(indexName) |
| 485 | + // .get() |
| 486 | + // .getSetting(indexName, IndexMetadata.SETTING_INDEX_UUID); |
| 487 | + // |
| 488 | + // logger.info("---> Starting indexing in parallel"); |
| 489 | + // AsyncIndexingService indexingService = new AsyncIndexingService(indexName); |
| 490 | + // indexingService.startIndexing(); |
| 491 | + // |
| 492 | + // logger.info("---> Adding 2 remote enabled nodes to the cluster & cluster manager"); |
| 493 | + // initDocRepToRemoteMigration(); |
| 494 | + // addRemote = true; |
| 495 | + // internalCluster().startClusterManagerOnlyNode(); |
| 496 | + // internalCluster().startDataOnlyNodes(2, Settings.builder().put("node.attr._type", "remote").build()); |
| 497 | + // internalCluster().validateClusterFormed(); |
| 498 | + // |
| 499 | + // assertTrue( |
| 500 | + // internalCluster().client() |
| 501 | + // .admin() |
| 502 | + // .cluster() |
| 503 | + // .prepareUpdateSettings() |
| 504 | + // .setPersistentSettings( |
| 505 | + // Settings.builder().put(CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.getKey(), RemoteStoreEnums.PathType.HASHED_PREFIX) |
| 506 | + // ) |
| 507 | + // .get() |
| 508 | + // .isAcknowledged() |
| 509 | + // ); |
| 510 | + // |
| 511 | + // // elect cluster manager with remote-cluster state enabled |
| 512 | + // internalCluster().client() |
| 513 | + // .execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(docrepClusterManager)) |
| 514 | + // .get(); |
| 515 | + // |
| 516 | + // internalCluster().validateClusterFormed(); |
| 517 | + // |
| 518 | + // logger.info("---> Excluding docrep nodes from allocation"); |
| 519 | + // excludeNodeSet("type", "docrep"); |
| 520 | + // |
| 521 | + // waitForRelocation(); |
| 522 | + // waitNoPendingTasksOnAll(); |
| 523 | + // indexingService.stopIndexing(); |
| 524 | + // |
| 525 | + // // validate remote index path file exists |
| 526 | + // logger.info("---> Asserting remote index path file exists"); |
| 527 | + // String fileNamePrefix = String.join(RemoteIndexPathUploader.DELIMITER, indexUUID, "7", RemoteIndexPath.DEFAULT_VERSION); |
| 528 | + // |
| 529 | + // assertTrue(FileSystemUtils.exists(translogRepoPath.resolve(RemoteIndexPath.DIR))); |
| 530 | + // Path[] files = FileSystemUtils.files(translogRepoPath.resolve(RemoteIndexPath.DIR)); |
| 531 | + // assertEquals(1, files.length); |
| 532 | + // assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix))); |
| 533 | + // |
| 534 | + // assertTrue(FileSystemUtils.exists(segmentRepoPath.resolve(RemoteIndexPath.DIR))); |
| 535 | + // files = FileSystemUtils.files(segmentRepoPath.resolve(RemoteIndexPath.DIR)); |
| 536 | + // assertEquals(1, files.length); |
| 537 | + // assertTrue(Arrays.stream(files).anyMatch(file -> file.toString().contains(fileNamePrefix))); |
| 538 | + // } |
548 | 539 |
|
549 | 540 | /** |
550 | 541 | * Scenario: |
|
0 commit comments