-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] pd /v1/partitions method returns data partition ID are all 0 #2595
Comments
The partition IDs in the shards list of the Here is the relevant part of the code: for (Metapb.Shard shard : pdRestService.getShardList(pt.getId())) {
Map<Long, Metapb.ShardStats> finalShardStats = shardStats;
partition.getShards().add(new Shard() {{
storeId = Long.toString(shard.getStoreId());
role = shard.getRole();
address = pdRestService.getStore(shard.getStoreId()).getAddress();
if (finalShardStats.containsKey(shard.getStoreId())) {
state = finalShardStats.get(shard.getStoreId()).getState().toString();
progress = finalShardStats.get(shard.getStoreId()).getProgress();
role = finalShardStats.get(shard.getStoreId()).getRole();
}
HashMap<Integer, Metapb.RaftStats> storeRaftStats = raftMap.get(shard.getStoreId());
if (storeRaftStats != null) {
Metapb.RaftStats raftStats = storeRaftStats.get(partition.getId());
if (raftStats != null) {
committedIndex = Long.toString(raftStats.getCommittedIndex());
}
}
}});
} To fix this issue, you need to set the for (Metapb.Shard shard : pdRestService.getShardList(pt.getId())) {
Map<Long, Metapb.ShardStats> finalShardStats = shardStats;
partition.getShards().add(new Shard() {{
storeId = Long.toString(shard.getStoreId());
role = shard.getRole();
address = pdRestService.getStore(shard.getStoreId()).getAddress();
partitionId = pt.getId(); // Set the partitionId here
if (finalShardStats.containsKey(shard.getStoreId())) {
state = finalShardStats.get(shard.getStoreId()).getState().toString();
progress = finalShardStats.get(shard.getStoreId()).getProgress();
role = finalShardStats.get(shard.getStoreId()).getRole();
}
HashMap<Integer, Metapb.RaftStats> storeRaftStats = raftMap.get(shard.getStoreId());
if (storeRaftStats != null) {
Metapb.RaftStats raftStats = storeRaftStats.get(partition.getId());
if (raftStats != null) {
committedIndex = Long.toString(raftStats.getCommittedIndex());
}
}
}});
} By adding |
Bug Type (问题类型)
rest-api (结果不合预期)
Before submit
Environment (环境信息)
Expected & Actual behavior (期望与实际表现)
curl http://xxx:8620/v1/partitions
results:
the partition IDs in the shards list of the returned data are all 0
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response
The text was updated successfully, but these errors were encountered: