follower state machine ignore read operation. (#7989)

This commit is contained in:
赵延 2022-03-25 15:07:42 +08:00 committed by GitHub
parent 2d0a8add41
commit cc549cbac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,6 +107,13 @@ class NacosStateMachine extends StateMachineAdapter {
} else { } else {
final ByteBuffer data = iter.getData(); final ByteBuffer data = iter.getData();
message = ProtoMessageUtil.parse(data.array()); message = ProtoMessageUtil.parse(data.array());
if (message instanceof ReadRequest) {
//'iter.done() == null' means current node is follower, ignore read operation
applied++;
index++;
iter.next();
continue;
}
} }
LoggerUtils.printIfDebugEnabled(Loggers.RAFT, "receive log : {}", message); LoggerUtils.printIfDebugEnabled(Loggers.RAFT, "receive log : {}", message);