Skip to content

Commit abf1be0

Browse files
author
Shubh Sahu
committed
Added javadoc and test descriptions
Signed-off-by: Shubh Sahu <shubhvs@amazon.com>
1 parent 872f742 commit abf1be0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

server/src/internalClusterTest/java/org/opensearch/remotemigration/ResizeIndexMigrationTestCase.java

+8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public class ResizeIndexMigrationTestCase extends MigrationBaseTestCase {
3232
private final static String STRICT_MODE = "strict";
3333
private final static String MIXED_MODE = "mixed";
3434

35+
/*
36+
* This test will verify the resize request failure, when cluster mode is mixed
37+
* and index is on DocRep node, and migration to remote store is in progress.
38+
* */
3539
public void testFailResizeIndexWhileDocRepToRemoteStoreMigration() throws Exception {
3640

3741
internalCluster().setBootstrapClusterManagerNodeIndex(0);
@@ -120,6 +124,10 @@ public void testFailResizeIndexWhileDocRepToRemoteStoreMigration() throws Except
120124
);
121125
}
122126

127+
/*
128+
* This test will verify the resize request failure, when cluster mode is mixed
129+
* and index is on Remote Store node, and migration to DocRep node is in progress.
130+
* */
123131
public void testFailResizeIndexWhileRemoteStoreToDocRepMigration() throws Exception {
124132

125133
addRemote = true;

server/src/main/java/org/opensearch/action/admin/indices/shrink/TransportResizeAction.java

+12
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,18 @@ protected String getClusterManagerActionName(DiscoveryNode node) {
374374
return super.getClusterManagerActionName(node);
375375
}
376376

377+
/**
378+
* Reject resize request if cluster mode is [Mixed] and migration direction is [RemoteStore] and index is not on
379+
* REMOTE_STORE_ENABLED node or [DocRep] and index is on REMOTE_STORE_ENABLED node.
380+
* @param type resize type
381+
* @param sourceIndexMetadata source index's metadata
382+
* @param clusterSettings cluster settings
383+
* @throws IllegalStateException if cluster mode is [Mixed] and migration direction is [RemoteStore] or [DocRep] and
384+
* index's SETTING_REMOTE_STORE_ENABLED is not equal to the migration direction's value.
385+
* For example, if migration direction is [RemoteStore] and index's SETTING_REMOTE_STORE_ENABLED
386+
* is false, then throw IllegalStateException. If migration direction is [DocRep] and
387+
* index's SETTING_REMOTE_STORE_ENABLED is true, then throw IllegalStateException.
388+
*/
377389
private static void validateClusterModeSettings(
378390
final ResizeType type,
379391
IndexMetadata sourceIndexMetadata,

0 commit comments

Comments
 (0)