Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGaox committed Oct 19, 2023
1 parent ee6fc37 commit 37b2000
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.apache.helix.rest.common;
package org.apache.helix.rest.clusterMaintenanceService;

/*
* Licensed to the Apache Software Foundation (ASF) under one
Expand Down Expand Up @@ -34,7 +34,6 @@
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.helix.rest.clusterMaintenanceService.MaintenanceManagementService;
import org.apache.helix.rest.server.json.cluster.ClusterTopology;
import org.apache.helix.rest.server.json.instance.StoppableCheck;

Expand Down Expand Up @@ -115,7 +114,7 @@ public void getStoppableInstancesCrossZones() {
* Determines the order of zones. If an order is provided by the user, it will be used directly.
* Otherwise, zones will be ordered by their associated instance count in descending order.
*
* If `isRandom` is true, the order of zones will be randomized regardless of any previous order.
* If `random` is true, the order of zones will be randomized regardless of any previous order.
*
* @param random Indicates whether to randomize the order of zones.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import org.apache.helix.model.InstanceConfig;
import org.apache.helix.rest.clusterMaintenanceService.MaintenanceManagementService;
import org.apache.helix.rest.common.HttpConstants;
import org.apache.helix.rest.common.StoppableInstancesSelector;
import org.apache.helix.rest.clusterMaintenanceService.StoppableInstancesSelector;
import org.apache.helix.rest.server.filters.ClusterAuth;
import org.apache.helix.rest.server.json.cluster.ClusterTopology;
import org.apache.helix.rest.server.json.instance.StoppableCheck;
Expand Down Expand Up @@ -149,7 +149,7 @@ public Response instancesOperations(@PathParam("clusterId") String clusterId,
@QueryParam("continueOnFailures") boolean continueOnFailures,
@QueryParam("skipZKRead") boolean skipZKRead,
@QueryParam("skipHealthCheckCategories") String skipHealthCheckCategories,
@QueryParam("random") boolean random, String content) {
@DefaultValue("false") @QueryParam("random") boolean random, String content) {
Command cmd;
try {
cmd = Command.valueOf(command);
Expand Down Expand Up @@ -233,6 +233,12 @@ private Response batchGetStoppableInstances(String clusterId, JsonNode node, boo
orderOfZone = OBJECT_MAPPER.readValue(
node.get(InstancesAccessor.InstancesProperties.zone_order.name()).toString(),
OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, String.class));
if (!orderOfZone.isEmpty() && random) {
String message =
"Both 'orderOfZone' and 'random' parameters are set. Please specify only one option.";
_logger.error(message);
return badRequest(message);
}
}

// Prepare output result
Expand Down

0 comments on commit 37b2000

Please sign in to comment.