pallavithegod commented on code in PR #3359:
URL: https://github.com/apache/hugegraph/pull/3359#discussion_r4316719555


##########
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/PDRestService.java:
##########
@@ -137,11 +138,38 @@ public Map<Integer, Metapb.ShardGroup> 
getShardGroupCache() {
     }
 
     public List<Metapb.Store> patrolStores() throws PDException {
-        return monitorService.patrolStores();
+        return runLeaderTask(() -> monitorService.patrolStores());
     }
 
     public List<Metapb.Partition> patrolPartitions() throws PDException {
-        return monitorService.patrolPartitions();
+        return runLeaderTask(() -> monitorService.patrolPartitions());
+    }
+
+    public TaskScheduleService.PartitionPatrolResult 
patrolPartitionsWithResult() throws PDException {
+        return runLeaderTask(() -> 
monitorService.patrolPartitionsWithResult());
+    }
+
+    private <T> T runLeaderTask(LeaderTask<T> task) throws PDException {
+        checkTaskLeader();
+        T result = task.run();

Review Comment:
   Fixed in 14a91a497: the compaction wrapper now propagates the scheduler 
refusal even if the node has regained leadership. The regression checks the 
structured NOT_LEADER response and unchanged compact ok success; all 15 focused 
cases, clean compilation, RAT and repository Checkstyle pass.



-- 
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]

Reply via email to