-
Notifications
You must be signed in to change notification settings - Fork 567
Open
Labels
Description
Bug Type (问题类型)
other exception / error (其他异常报错)
Before submit
- 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
- Server Version: 1.5.0 (master)
Expected & Actual behavior (期望与实际表现)
There is a reflection call error in the getState method of the PD RaftEngine.java file. This method attempts to retrieve the state field value of a Replicator object through reflection, but incorrectly uses this.raftNode as the parameter instead of the passed Replicator r parameter.
private Replicator.State getState(Replicator r) {
var clz = r.getClass();
try {
var f = clz.getDeclaredField("state");
f.setAccessible(true);
var state = (Replicator.State) f.get(this.raftNode); // Error: should use r instead of this.raftNode
f.setAccessible(false);
return state;
} catch (NoSuchFieldException | IllegalAccessException e) {
log.info("getReplicatorGroup: error {}", e.getMessage());
return null;
}
}