Jackie-Jiang commented on a change in pull request #4560: Refactor
toggleInstanceState API
URL: https://github.com/apache/incubator-pinot/pull/4560#discussion_r317859229
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java
##########
@@ -130,13 +130,17 @@ public SuccessResponse toggleInstanceState(
}
if (StateType.ENABLE.name().equalsIgnoreCase(state)) {
- if
(!pinotHelixResourceManager.enableInstance(instanceName).isSuccessful()) {
- throw new ControllerApplicationException(LOGGER, "Failed to enable
instance " + instanceName,
+ PinotResourceManagerResponse response =
pinotHelixResourceManager.enableInstance(instanceName);
+ if (!response.isSuccessful()) {
+ throw new ControllerApplicationException(LOGGER,
+ "Failed to enable instance " + instanceName + " - " +
response.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR);
}
} else if (StateType.DISABLE.name().equalsIgnoreCase(state)) {
- if
(!pinotHelixResourceManager.disableInstance(instanceName).isSuccessful()) {
- throw new ControllerApplicationException(LOGGER, "Failed to disable
instance " + instanceName,
+ PinotResourceManagerResponse response =
pinotHelixResourceManager.disableInstance(instanceName);
+ if (!response.isSuccessful()) {
+ throw new ControllerApplicationException(LOGGER,
+ "Failed to disable instance " + instanceName + " - " +
response.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR);
}
} else if (StateType.DROP.name().equalsIgnoreCase(state)) {
Review comment:
Not related to this pr, but why the exception for DROP is CONFLICT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]