imbajin commented on code in PR #3003:
URL: https://github.com/apache/hugegraph/pull/3003#discussion_r3110953452
##########
hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/rest/IndexAPI.java:
##########
@@ -66,9 +66,35 @@ public BriefStatistics index() throws PDException,
ExecutionException, Interrupt
BriefStatistics statistics = new BriefStatistics();
statistics.leader = RaftEngine.getInstance().getLeaderGrpcAddress();
statistics.state =
pdService.getStoreNodeService().getClusterStats().getState().toString();
+
+ // Use pdService (consistent with cluster()) rather than RaftEngine
directly
+ CallStreamObserverWrap<Pdpb.GetMembersResponse> membersResp =
+ new CallStreamObserverWrap<>();
+ pdService.getMembers(Pdpb.GetMembersRequest.newBuilder().build(),
membersResp);
+ statistics.memberSize =
membersResp.get().get(0).getMembersList().size();
+
statistics.storeSize =
pdService.getStoreNodeService().getActiveStores().size();
- statistics.graphSize =
pdService.getPartitionService().getGraphs().size();
Review Comment:
The previous fix adds:
`statistics.memberSize = RaftEngine.getInstance().getMembers().size();`
But the cluster() method (the "correct" counterpart) uses the service layer:
```java
pdService.getMembers(Pdpb.GetMembersRequest.newBuilder().build(), response);
statistics.memberSize = pdList.size(); // from pdService, not RaftEngine
```
The issue discussion (comments 3–4 from bitflicker64 and dosubot) explicitly
recommends using pdService.getMembers().size() for consistency with cluster()
and to stay in the service layer. The merged fix goes against this
recommendation.
--
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]