mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: remove quorum() dependency from readOnly
This now delegates the quorum computation to r.prs, which will allow it to generalize in a straightforward way when etcd-io/etcd#7625 is addressed.
This commit is contained in:
@@ -1000,6 +1000,8 @@ func stepLeader(r *raft, m pb.Message) error {
|
||||
switch r.readOnly.option {
|
||||
case ReadOnlySafe:
|
||||
r.readOnly.addRequest(r.raftLog.committed, m)
|
||||
// The local node automatically acks the request.
|
||||
r.readOnly.recvAck(r.id, m.Entries[0].Data)
|
||||
r.bcastHeartbeatWithCtx(m.Entries[0].Data)
|
||||
case ReadOnlyLeaseBased:
|
||||
ri := r.raftLog.committed
|
||||
@@ -1097,8 +1099,7 @@ func stepLeader(r *raft, m pb.Message) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
ackCount := r.readOnly.recvAck(m)
|
||||
if ackCount < r.prs.quorum() {
|
||||
if !r.prs.hasQuorum(r.readOnly.recvAck(m.From, m.Context)) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user