krishna-st commented on code in PR #17375:
URL: https://github.com/apache/pinot/pull/17375#discussion_r2632386804
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java:
##########
@@ -252,17 +253,20 @@ public SuccessResponse addInstance(
@Authenticate(AccessType.UPDATE)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_PLAIN)
- @ApiOperation(value = "Enable/disable an instance", notes = "Enable/disable
an instance")
+ @ApiOperation(value = "Enable/disable/drain an instance", notes =
"Enable/disable/drain an instance. "
+ + "DRAIN state is only applicable to minion instances and retags them
from minion_untagged to minion_drained, "
Review Comment:
In this scenario, yes, because ideally, if the minion is tagged with
something else, then there are no tasks that are currently being assigned to it
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java:
##########
@@ -282,6 +286,18 @@ public SuccessResponse toggleInstanceState(
"Failed to disable instance '" + instanceName + "': " +
response.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR);
}
+ } else if (StateType.DRAIN.name().equalsIgnoreCase(state)) {
+ if (!InstanceTypeUtils.isMinion(instanceName)) {
+ throw new ControllerApplicationException(LOGGER,
+ "DRAIN state only applies to minion instances. Instance '" +
instanceName + "' is not a minion.",
+ Response.Status.BAD_REQUEST);
+ }
+ PinotResourceManagerResponse response =
_pinotHelixResourceManager.drainMinionInstance(instanceName);
Review Comment:
Yes, that is correct. In case a minion is in drained mode, you would need to
retag them with minion_untagged so that Helix can start assigning tasks. This
is only when the minion is drained, but not removed from the controller
--
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]