You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2021/12/08 06:26:12 UTC
[GitHub] [helix] xyuanlu commented on a change in pull request #1918: Add take/free instance implementation and test
xyuanlu commented on a change in pull request #1918:
URL: https://github.com/apache/helix/pull/1918#discussion_r764579968
##########
File path: helix-rest/src/main/java/org/apache/helix/rest/clusterMaintenanceService/MaintenanceManagementService.java
##########
@@ -268,30 +301,92 @@ public StoppableCheck getInstanceStoppableCheck(String clusterId, String instanc
public Map<String, StoppableCheck> batchGetInstancesStoppableChecks(String clusterId,
List<String> instances, String jsonContent) throws IOException {
- Map<String, StoppableCheck> finalStoppableChecks = new HashMap<>();
// helix instance check
+ Map<String, StoppableCheck> finalStoppableChecks = new HashMap<>();
+
List<String> instancesForCustomInstanceLevelChecks =
batchHelixInstanceStoppableCheck(clusterId, instances, finalStoppableChecks);
- // custom check
+ // custom check, includes partition check.
batchCustomInstanceStoppableCheck(clusterId, instancesForCustomInstanceLevelChecks,
finalStoppableChecks, getMapFromJsonPayload(jsonContent));
return finalStoppableChecks;
}
+ private MaintenanceManagementInstanceInfo takeFreeSingleInstanceHelper(String clusterId,
+ String instanceName, List<String> healthChecks, Map<String, String> healthCheckConfig,
+ List<String> operations, Map<String, String> operationConfig, boolean performOperation,
+ boolean isTakeInstance) {
+
+ if (operations == null) {
+ operations = new ArrayList<>();
+ }
+
+ try {
+ MaintenanceManagementInstanceInfo instanceInfo;
+ if (isTakeInstance) {
+ if (healthChecks == null) {
+ healthChecks = new ArrayList<>();
+ }
+ instanceInfo =
+ batchInstanceHealthCheck(clusterId, ImmutableList.of(instanceName), healthChecks,
+ healthCheckConfig).getOrDefault(instanceName, new MaintenanceManagementInstanceInfo(
+ MaintenanceManagementInstanceInfo.OperationalStatus.SUCCESS));
+ if (!instanceInfo.isSuccessful()) {
Review comment:
I think bypassing an operation check should be handled at implementation level not API level. The operation check will return `SUCCESS` if bypassed and add the failure note in message.
Or we can add a new state 'ByPassed or non-blocking check' in instanceInfo?
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org