Copilot commented on code in PR #2966:
URL: https://github.com/apache/hugegraph/pull/2966#discussion_r2919474145
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/API.java:
##########
@@ -241,6 +241,13 @@ public static boolean checkAndParseAction(String action) {
}
}
+ public static void checkPdModeEnabled(GraphManager manager) {
+ if (!manager.usePD()) {
+ throw new HugeException(
+ "GraphSpace management is not supported in standalone
mode");
+ }
+ }
Review Comment:
`checkPdModeEnabled()` is introduced as `public static` on a widely-used API
base class, which unnecessarily expands the public surface area. Since it’s an
internal guard used by subclasses, consider making it `protected` (or
package-private) to avoid exposing it as a public utility.
##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java:
##########
@@ -193,7 +183,8 @@ protected static void waitTaskStatus(int task, Set<String>
expectedStatus) {
Assert.fail(String.format("Failed to wait for task %s " +
"due to timeout", task));
}
- } while (!expectedStatus.contains(status));
+ }
+ while (!expectedStatus.contains(status));
Review Comment:
This changes the original `do { ... } while (...)` polling into an
empty-body `while (...);` loop, and `status` is no longer updated inside the
loop. This can spin forever (or at least behave incorrectly) if `status` isn’t
already in `expectedStatus`. Restore the polling loop structure so `status` is
refreshed each iteration and the loop has a real body.
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -276,7 +276,7 @@ private static String serviceId(String graphSpace,
Service.ServiceType type,
.replace("_", "-").toLowerCase();
}
- private boolean usePD() {
+ public boolean usePD() {
Review Comment:
For a public boolean accessor, `usePD()` is a bit ambiguous as a getter
name. Consider renaming to a clearer boolean-style accessor (e.g.,
`isPdEnabled()` / `isUsePD()`), which also matches the PR description and
improves readability at call sites.
```suggestion
public boolean isPdEnabled() {
```
--
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]