[Bug] Store GET /v1/partitions answers 500 "Not leader" on any Store that follows at least one raft group
Bug Type (问题类型)
rest-api (结果不合预期)
Before submit
- [x] I have confirmed and searched that there are no similar problems in the historical issue and documents
Environment (环境信息)
- Server Version: master
83ef9f3(store imagesha256:7bc0cbd81550) - Backend: HStore, 3 Stores, 12 shard groups, shard count 3
- OS: kind v0.33 (Kubernetes 1.37.0)
Expected & Actual behavior (期望与实际表现)
GET :8520/v1/partitions should list every raft group the Store holds; with 3 replicas per group every Store follows some groups, so in practice the endpoint fails on every node of a healthy cluster:
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is java.lang.IllegalStateException: Not leader
Caused by: java.lang.IllegalStateException: Not leader
at com.alipay.sofa.jraft.core.NodeImpl.listPeers(NodeImpl.java:2965)
at org.apache.hugegraph.store.PartitionEngine.getCurrentConf(PartitionEngine.java:1146)
at ...controller.PartitionAPI.getPartitions(PartitionAPI.java:89)
PartitionAPI.getPartitions calls engine.getCurrentConf() unconditionally, and getCurrentConf() builds a Configuration from raftNode.listPeers(), which jraft only allows on the leader. The same handler already guards setPeers/setLearners behind engine.isLeader() a few lines later, so the guard just needs to extend to the conf (or take the peer list from the local shard group on followers). The per-group GET /v1/partition/{id} works on followers and shows what the plural endpoint should.
Measured 2026-09-22: 500 on all 3 Stores; on a Store leading some groups it still 500s at the first followed group.