You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "junkaixue (via GitHub)" <gi...@apache.org> on 2023/07/20 05:08:44 UTC
[GitHub] [helix] junkaixue commented on a diff in pull request #2559: Correctly state cluster is in maintenance mode when maintenance znode is empty
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: 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