SzyWilliam commented on code in PR #11571:
URL: https://github.com/apache/iotdb/pull/11571#discussion_r1398618183
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -327,21 +331,25 @@ public DataSet read(ConsensusGroupId groupId,
IConsensusRequest request)
throw new ConsensusGroupNotExistException(groupId);
}
+ // perform linearizable read under following two conditions:
+ // 1. Read.Option is linearizable
+ // 2. First probing read when Read.Option is default
final boolean isLinearizableRead =
- !canServeStaleRead.computeIfAbsent(groupId, id -> new
AtomicBoolean(false)).get();
+ readOption == RatisConfig.Read.Option.LINEARIZABLE
+ || !canServeStaleRead.computeIfAbsent(groupId, id -> new
AtomicBoolean(false)).get();
RaftClientReply reply;
try {
reply = doRead(raftGroupId, request, isLinearizableRead);
// allow stale read if current linearizable read returns successfully
- if (isLinearizableRead) {
+ if (readOption == RatisConfig.Read.Option.DEFAULT && isLinearizableRead)
{
Review Comment:
Done
##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java:
##########
@@ -766,6 +774,14 @@ private RaftClientReply sendReconfiguration(RaftGroup
newGroupConf)
return reply;
}
+ private void onLeaderChanged(RaftGroupMemberId groupMemberId, RaftPeerId
leaderId) {
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]