-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Is your feature request related to a problem? Please describe.
It doesn't look like suitable to load a core node role master
as "additonal roles".
In commit ea31483 / PR #2424, node role 'master' is deprecated, and the alternative role 'cluster_manager' is added.
Since the role 'cluster_manager' is the successor for 'master', the same abbreviation role name 'm' is set to the new role for convenience.
While there is a check to ensure the abbreviation names for node roles are unique:
OpenSearch/server/src/main/java/org/opensearch/cluster/node/DiscoveryNode.java
Lines 608 to 614 in 1510b94
// collect the abbreviation names into a map to ensure that there are not any duplicate abbreviations | |
final Map<String, DiscoveryNodeRole> roleNameAbbreviationToPossibleRoles = Collections.unmodifiableMap( | |
roleNameToPossibleRoles.values() | |
.stream() | |
.collect(Collectors.toMap(DiscoveryNodeRole::roleNameAbbreviation, Function.identity())) | |
); | |
assert roleNameToPossibleRoles.size() == roleNameAbbreviationToPossibleRoles.size() : "roles by name [" |
As a workaround, I added the deprecated node role 'master' after the check, in the method
setAdditionalRoles()
which used to load roles defined by plugins, instead of BUILT_IN_ROLES
:OpenSearch/server/src/main/java/org/opensearch/cluster/node/DiscoveryNodeRole.java
Line 296 in e9c5ce3
public static SortedSet<DiscoveryNodeRole> BUILT_IN_ROLES = Collections.unmodifiableSortedSet( |
public static void setAdditionalRoles(final Set<DiscoveryNodeRole> additionalRoles) { |
final Set<DiscoveryNodeRole> additionalRoles = pluginsService.filterPlugins(Plugin.class) |
Describe the solution you'd like
Load the deprecated master
role in other places, but not in method setAdditionalRoles()
Describe alternatives you've considered
It's fine to keep as it is, because the current code of setting 'master' role is a temporary workaround and will be removed in the next major version.
Additional context