Skip to content

Commit

Permalink
[Remote Store] Change remote_store setting validation message to make…
Browse files Browse the repository at this point in the history
… it more clear (opensearch-project#4199)

* Change remote_store setting validation message to make it more clear

Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
sachinpkale authored and Sachin Kale committed Sep 2, 2022
1 parent ce84f82 commit 85bc986
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ public void validate(final Boolean value, final Map<Setting<?>, Object> settings
final Object replicationType = settings.get(INDEX_REPLICATION_TYPE_SETTING);
if (replicationType != ReplicationType.SEGMENT && value == true) {
throw new IllegalArgumentException(
"Settings "
"To enable "
+ INDEX_REMOTE_STORE_ENABLED_SETTING.getKey()
+ " cannot be enabled when "
+ ", "
+ INDEX_REPLICATION_TYPE_SETTING.getKey()
+ " is set to "
+ settings.get(INDEX_REPLICATION_TYPE_SETTING)
+ " should be set to "
+ ReplicationType.SEGMENT
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,7 @@ public void testEnablingRemoteStoreFailsWhenReplicationTypeIsDocument() {
IllegalArgumentException.class,
() -> IndexMetadata.INDEX_REMOTE_STORE_ENABLED_SETTING.get(indexSettings)
);
assertEquals(
"Settings index.remote_store.enabled cannot be enabled when index.replication.type is set to DOCUMENT",
iae.getMessage()
);
assertEquals("To enable index.remote_store.enabled, index.replication.type should be set to SEGMENT", iae.getMessage());
}

public void testEnablingRemoteStoreFailsWhenReplicationTypeIsDefault() {
Expand All @@ -819,9 +816,6 @@ public void testEnablingRemoteStoreFailsWhenReplicationTypeIsDefault() {
IllegalArgumentException.class,
() -> IndexMetadata.INDEX_REMOTE_STORE_ENABLED_SETTING.get(indexSettings)
);
assertEquals(
"Settings index.remote_store.enabled cannot be enabled when index.replication.type is set to DOCUMENT",
iae.getMessage()
);
assertEquals("To enable index.remote_store.enabled, index.replication.type should be set to SEGMENT", iae.getMessage());
}
}

0 comments on commit 85bc986

Please sign in to comment.