incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

[Bug] GET / endpoint always returns memberSize:0 regardless of actual PD member count

Open bitflicker64 opened this issue 7 months ago • 5 comments

Bug Type (问题类型)

other exception / error (其他异常报错)

Before submit

  • [x] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: 1.7.0 (latest Docker image)
  • Backend: hstore 3 nodes
  • OS: macOS (Apple M4), Docker Desktop
  • Data Size: N/A — reproducible on fresh cluster

Expected & Actual behavior (期望与实际表现)

The memberSize field in the response from GET / (IndexAPI) always returns 0 regardless of how many PD nodes are actually in the cluster.

Actual: curl -u store:store http://localhost:8620/ {"state":"Cluster_Not_Ready","leader":"pd2:8686","memberSize":0,"storeSize":3,...}

Expected: memberSize should return 3 for a 3-node PD cluster.

Root cause: IndexAPI.index() sets storeSize, graphSize, partitionSize, leader but never sets memberSize on the BriefStatistics object. The field defaults to 0.

The /v1/cluster endpoint in the same file does it correctly: statistics.memberSize = pdList.size();

Fix: add the equivalent line in index() using RaftEngine.getInstance().getMembers().size()

bitflicker64 avatar Apr 19 '26 06:04 bitflicker64

@bitflicker64 I can confirm this bug. Looking at the IndexAPI class, the index() method populates leader, state, storeSize, graphSize, and partitionSize on the BriefStatistics object but never sets memberSize [1].

Meanwhile, the cluster() method correctly does statistics.memberSize = pdList.size() [2].

One nuance worth noting: index() uses BriefStatistics [3] while cluster() uses a separate Statistics class [4]. The BriefStatistics class itself may not even have the memberSize field, so the fix would likely involve both adding the field to BriefStatistics and setting it in index() — not just adding the assignment line.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about hugegraph Share Dosu with your team

dosubot[bot] avatar Apr 19 '26 06:04 dosubot[bot]

@bitflicker64 I can confirm this bug. Looking at the IndexAPI class, the index() method populates leader, state, storeSize, graphSize, and partitionSize on the BriefStatistics object but never sets memberSize [1].

Meanwhile, the cluster() method correctly does statistics.memberSize = pdList.size() [2].

One nuance worth noting: index() uses BriefStatistics [3] while cluster() uses a separate Statistics class [4]. The BriefStatistics class itself may not even have the memberSize field, so the fix would likely involve both adding the field to BriefStatistics and setting it in index() — not just adding the assignment line.

To reply, just mention @dosu.

Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about hugegraph Share Dosu with your team

@dosubot Thanks for confirming. One correction though , BriefStatistics already has the memberSize field defined, it just never gets assigned in index(). So the fix is purely adding the assignment line: javastatistics.memberSize = RaftEngine.getInstance().getMembers().size(); No changes needed to the BriefStatistics class itself.

bitflicker64 avatar Apr 19 '26 06:04 bitflicker64

@bitflicker64 Thanks for the correction — you're right, BriefStatistics already declares int memberSize [1], so no class changes are needed.

One thing worth double-checking: the cluster() method in the same file uses pdService.getMembers().size() to populate memberSize [2], not RaftEngine.getInstance().getMembers().size(). You may want to verify which one is appropriate for the index() method context, since pdService is already available there and would keep the implementation consistent with cluster().

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about hugegraph Share Dosu with your team

dosubot[bot] avatar Apr 19 '26 07:04 dosubot[bot]

@bitflicker64 Thanks for the correction — you're right, BriefStatistics already declares int memberSize [1], so no class changes are needed.

One thing worth double-checking: the cluster() method in the same file uses pdService.getMembers().size() to populate memberSize [2], not RaftEngine.getInstance().getMembers().size(). You may want to verify which one is appropriate for the index() method context, since pdService is already available there and would keep the implementation consistent with cluster().

To reply, just mention @dosu.

Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about hugegraph Share Dosu with your team

@dosubot Good point, pdService.getMembers().size() it is consistent with cluster() and keeps it in the service layer. Thanks! , can you add the good first issue label to this?

bitflicker64 avatar Apr 19 '26 07:04 bitflicker64

@bitflicker64 Glad the analysis was helpful! Unfortunately, I'm not able to add labels to issues — I can only help with research and answering questions. A repository maintainer would need to add the good first issue label.

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about hugegraph with Dosu Add Dosu to your team

dosubot[bot] avatar Apr 19 '26 07:04 dosubot[bot]