Skip to content

Commit

Permalink
Changing variable name from settings to clusterSettings
Browse files Browse the repository at this point in the history
Signed-off-by: Shourya Dutta Biswas <114977491+shourya035@users.noreply.github.com>
  • Loading branch information
shourya035 committed Apr 24, 2024
1 parent 6f9f0c3 commit 5c8df2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@
public class RemoteMigrationIndexMetadataUpdater {
private final DiscoveryNodes discoveryNodes;
private final RoutingTable routingTable;
private final Settings settings;
private final Settings clusterSettings;
private final IndexMetadata indexMetadata;
private final Logger logger;

public RemoteMigrationIndexMetadataUpdater(
DiscoveryNodes discoveryNodes,
RoutingTable routingTable,
IndexMetadata indexMetadata,
Settings settings,
Settings clusterSettings,
Logger logger

) {
this.discoveryNodes = discoveryNodes;
this.routingTable = routingTable;
this.settings = settings;
this.clusterSettings = clusterSettings;
this.indexMetadata = indexMetadata;
this.logger = logger;
}
Expand Down Expand Up @@ -134,7 +134,7 @@ private boolean needsRemoteIndexSettingsUpdate(
public void maybeUpdateRemoteStorePathStrategy(IndexMetadata.Builder indexMetadataBuilder, String index) {
if (indexHasRemotePathMetadata(indexMetadata) == false) {
logger.info("Adding remote store path strategy for index [{}] during migration", index);
indexMetadataBuilder.putCustom(REMOTE_STORE_CUSTOM_KEY, createRemoteStorePathTypeMetadata(settings, discoveryNodes));
indexMetadataBuilder.putCustom(REMOTE_STORE_CUSTOM_KEY, createRemoteStorePathTypeMetadata(clusterSettings, discoveryNodes));
} else {
logger.debug("Index {} already has remote store path strategy", index);
}
Expand All @@ -143,18 +143,18 @@ public void maybeUpdateRemoteStorePathStrategy(IndexMetadata.Builder indexMetada
/**
* Generates the remote store path type information to be added to custom data of index metadata.
*
* @param settings Current Cluster settings from {@link ClusterState}
* @param clusterSettings Current Cluster settings from {@link ClusterState}
* @param discoveryNodes Current {@link DiscoveryNodes} from the cluster state
* @return {@link Map} to be added as custom data in index metadata
*/
private Map<String, String> createRemoteStorePathTypeMetadata(Settings settings, DiscoveryNodes discoveryNodes) {
private Map<String, String> createRemoteStorePathTypeMetadata(Settings clusterSettings, DiscoveryNodes discoveryNodes) {
Version minNodeVersion = discoveryNodes.getMinNodeVersion();
PathType pathType = Version.CURRENT.compareTo(minNodeVersion) <= 0
? CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.get(settings)
? CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING.get(clusterSettings)
: PathType.FIXED;
PathHashAlgorithm pathHashAlgorithm = pathType == PathType.FIXED
? null
: CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING.get(settings);
: CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING.get(clusterSettings);
Map<String, String> remoteCustomData = new HashMap<>();
remoteCustomData.put(PathType.NAME, pathType.name());
if (Objects.nonNull(pathHashAlgorithm)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testMaybeAddRemoteIndexSettingsAllPrimariesAndReplicasOnRemote() thr
allNodes,
routingTable,
existingIndexMetadata,
existingIndexMetadata.getSettings(),
metadata.settings(),
logger
);
migrationIndexMetadataUpdater.maybeAddRemoteIndexSettings(indexMetadataBuilder, indexName, segmentRepoName, tlogRepoName);
Expand All @@ -76,7 +76,7 @@ public void testMaybeAddRemoteIndexSettingsDoesNotRunWhenSettingsAlreadyPresent(
allNodes,
routingTable,
existingIndexMetadata,
existingIndexMetadata.getSettings(),
metadata.settings(),
logger
);
migrationIndexMetadataUpdater.maybeAddRemoteIndexSettings(indexMetadataBuilder, indexName, segmentRepoName, tlogRepoName);
Expand All @@ -96,7 +96,7 @@ public void testMaybeAddRemoteIndexSettingsDoesNotUpdateSettingsWhenAllShardsInD
allNodes,
routingTable,
existingIndexMetadata,
existingIndexMetadata.getSettings(),
metadata.settings(),
logger
);
migrationIndexMetadataUpdater.maybeAddRemoteIndexSettings(indexMetadataBuilder, indexName, segmentRepoName, tlogRepoName);
Expand All @@ -117,7 +117,7 @@ public void testMaybeAddRemoteIndexSettingsUpdatesIndexSettingsWithUnassignedRep
allNodes,
routingTable,
existingIndexMetadata,
existingIndexMetadata.getSettings(),
metadata.settings(),
logger
);
migrationIndexMetadataUpdater.maybeAddRemoteIndexSettings(indexMetadataBuilder, indexName, segmentRepoName, tlogRepoName);
Expand All @@ -139,7 +139,7 @@ public void testMaybeAddRemoteIndexSettingsDoesNotUpdateIndexSettingsWithRelocat
allNodes,
routingTable,
existingIndexMetadata,
existingIndexMetadata.getSettings(),
metadata.settings(),
logger
);
migrationIndexMetadataUpdater.maybeAddRemoteIndexSettings(indexMetadataBuilder, indexName, segmentRepoName, tlogRepoName);
Expand Down

0 comments on commit 5c8df2c

Please sign in to comment.