Skip to content

Commit

Permalink
Address PR Comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Harish Bhakuni <[email protected]>
  • Loading branch information
Harish Bhakuni committed Apr 5, 2024
1 parent 5243e93 commit d8f29cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ public static void updateReplicationStrategy(
* @param nodeSettings node settings
*/
public static void updateRemoteStoreSettings(Settings.Builder settingsBuilder, Settings nodeSettings) {
if (isRemoteStoreAttributePresent(nodeSettings)) {
if (RemoteStoreNodeAttribute.isRemoteStoreAttributePresent(nodeSettings)) {
settingsBuilder.put(SETTING_REMOTE_STORE_ENABLED, true)
.put(
SETTING_REMOTE_SEGMENT_STORE_REPOSITORY,
Expand Down
19 changes: 13 additions & 6 deletions server/src/main/java/org/opensearch/snapshots/RestoreService.java
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,19 @@ private String[] getIgnoreSettingsInternal() {

private Settings getOverrideSettingsInternal() {
final Settings.Builder settingsBuilder = Settings.builder();
MetadataCreateIndexService.updateReplicationStrategy(
settingsBuilder,
request.indexSettings(),
clusterService.getSettings(),
null
);

// We will use whatever replication strategy provided by user or from snapshot metadata unless
// cluster is remote store enabled or user have restricted a specific replication type in the
// cluster.
if (RemoteStoreNodeAttribute.isRemoteStoreAttributePresent(clusterService.getSettings()) == true
|| clusterSettings.get(IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING) == true) {
MetadataCreateIndexService.updateReplicationStrategy(

Check warning on line 684 in server/src/main/java/org/opensearch/snapshots/RestoreService.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/snapshots/RestoreService.java#L684

Added line #L684 was not covered by tests
settingsBuilder,
request.indexSettings(),
clusterService.getSettings(),

Check warning on line 687 in server/src/main/java/org/opensearch/snapshots/RestoreService.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/snapshots/RestoreService.java#L686-L687

Added lines #L686 - L687 were not covered by tests
null
);
}
// remote store settings needs to be overridden if the remote store feature is enabled in the
// cluster where snapshot is being restored.
MetadataCreateIndexService.updateRemoteStoreSettings(settingsBuilder, clusterService.getSettings());
Expand Down

0 comments on commit d8f29cd

Please sign in to comment.