zpinto commented on code in PR #2772:
URL: https://github.com/apache/helix/pull/2772#discussion_r1540267743
##########
helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java:
##########
@@ -722,78 +698,37 @@ public Set<String> getAllInstances() {
}
/**
- * Return all the live nodes that are enabled and assignable
- *
- * @return A new set contains live instance name and that are marked enabled
- */
- public Set<String> getAssignableEnabledLiveInstances() {
- Set<String> enabledLiveInstances = new
HashSet<>(getAssignableLiveInstances().keySet());
- enabledLiveInstances.removeAll(getDisabledInstances());
-
- return enabledLiveInstances;
- }
-
- /**
- * Return all the live nodes that are enabled
+ * Return all the live nodes that are enabled. If a node is enabled, it is
assignable.
* @return A new set contains live instance name and that are marked enabled
*/
public Set<String> getEnabledLiveInstances() {
Set<String> enabledLiveInstances = new
HashSet<>(getLiveInstances().keySet());
- enabledLiveInstances.removeAll(getDisabledInstances());
+ enabledLiveInstances.retainAll(getEnabledInstances());
return enabledLiveInstances;
}
/**
- * Return all nodes that are enabled and assignable.
- *
- * @return A new set contains instance name and that are marked enabled
- */
- public Set<String> getAssignableEnabledInstances() {
- Set<String> enabledNodes = new HashSet<>(getAssignableInstances());
- enabledNodes.removeAll(getDisabledInstances());
-
- return enabledNodes;
- }
-
- /**
- * Return all nodes that are enabled.
+ * Return all nodes that are enabled. If a node is enabled, it is assignable.
* @return A new set contains instance name and that are marked enabled
*/
public Set<String> getEnabledInstances() {
- Set<String> enabledNodes = new HashSet<>(getAllInstances());
- enabledNodes.removeAll(getDisabledInstances());
-
- return enabledNodes;
+ return new
HashSet<>(_derivedInstanceCache.getInstanceConfigMapByInstanceOperation(
+ InstanceConstants.InstanceOperation.ENABLE).keySet());
}
/**
- * Return all the live nodes that are enabled and assignable and tagged with
given instanceTag.
Review Comment:
Discussed offline, backwards compatibility is preserved by HELIX_ENABLED
field being respected in getInstanceOperation. If HELIX_ENABLED is set to
false, it will have InstanceOperation of DISABLE overriding the
InstanceOperation field. If set to true, default to ENABLE InstanceOperation or
use set InstanceOperation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]