junkaixue commented on code in PR #2559:
URL: https://github.com/apache/helix/pull/2559#discussion_r1268938849
##########
helix-rest/src/main/java/org/apache/helix/rest/server/resources/helix/ClusterAccessor.java:
##########
@@ -765,12 +765,17 @@ public Response
getClusterMaintenanceHistory(@PathParam("clusterId") String clus
@GET
@Path("{clusterId}/controller/maintenanceSignal")
public Response getClusterMaintenanceSignal(@PathParam("clusterId") String
clusterId) {
- HelixDataAccessor dataAccessor = getDataAccssor(clusterId);
- MaintenanceSignal maintenanceSignal =
- dataAccessor.getProperty(dataAccessor.keyBuilder().maintenance());
- if (maintenanceSignal != null) {
- Map<String, String> maintenanceInfo =
maintenanceSignal.getRecord().getSimpleFields();
+ boolean inMaintenanceMode = getHelixAdmin().isInMaintenanceMode(clusterId);
+
+ if (inMaintenanceMode) {
+ HelixDataAccessor dataAccessor = getDataAccssor(clusterId);
+ PropertyKey maintenanceKey = dataAccessor.keyBuilder().maintenance();
+ MaintenanceSignal maintenanceSignal =
dataAccessor.getProperty(maintenanceKey);
Review Comment:
NIT: combine these two line since maintenanceKey is not used for following
code. No need for defining a new variable.
--
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]