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


##########
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/TaskScheduleService.java:
##########
@@ -275,11 +293,14 @@ public List<Metapb.Partition> patrolPartitions() throws 
PDException {
 
                 storeService.storeTurnoff(pair.getValue());
                 partitionService.shardOffline(partition, 
pair.getValue().getId());
+                // shardOffline logs its own failures; report a request, not a 
completed repair.
+                result.offlineShardRequests.put(partition.getId(), 
pair.getValue().getId());

Review Comment:
   ⚠️ Important. Blocking: no. Summary: Patrol can reallocate a shard group 
here without including its ID in `reallocatedShardGroups`. Evidence: when the 
initial shard-count pass skips a group, `storeTurnoff()` removes its tombstoned 
store and calls `reallocShards()`, which persists the replacement; this line 
records only the offline request, so the documented changed-group list stays 
incomplete. Please record IDs changed during tombstone handling and deduplicate 
them against the first pass.



##########
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/TaskAPI.java:
##########
@@ -108,8 +109,12 @@ public String balanceLeaders() {
     }
 
     @GetMapping(value = "/compact")
-    public String dbCompaction() throws PDException {
-        pdRestService.dbCompaction();
-        return "compact ok";
+    public String dbCompaction() {
+        try {
+            pdRestService.dbCompaction();
+            return "compact ok";
+        } catch (PDException e) {
+            return toJSON(e);

Review Comment:
   ⚠️ Important. Blocking: no. Summary: The new `/compact` error body is JSON 
text, but the mapping does not guarantee an `application/json` response. 
Evidence: this `@RestController` method has no `produces` declaration; Spring 
5.3.27's default String converter writes `text/plain` for clients accepting 
`*/*`, unlike the other task routes. Please set the error response content type 
explicitly while preserving or defining the success response contract.



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