@@ -125,25 +125,22 @@ func (rn *RawNode) Ready() Ready {
125
125
return rd
126
126
}
127
127
128
- // SendAppend a log replication messages to a particular node. The message
128
+ // SendAppend sends a log replication messages to a particular node. The message
129
129
// will be available via next Ready.
130
130
//
131
131
// This method is used when Config.EnableLazyAppends is true. Typically, it
132
132
// should be called before processing Ready, for all node IDs in StateReplicate
133
133
// which have pending replication work.
134
134
//
135
- // TODO(pav-kv): this should take and propagate maxBytes down the stack, for
136
- // integration with Admission Control. AC will be calling this method under two
137
- // conditions: the "send queue" is not empty (see EntriesReady), and there are
138
- // some spare send tokens (hence the maxBytes argument).
139
- //
140
- // TODO(pav-kv): as an intermediate step, we should pull Progress.Inflights out
141
- // of internals. This today plays the role of the send tokens tracker.
142
- func (rn * RawNode ) SendAppend (to uint64 ) bool {
135
+ // TODO(pav-kv): integrate with Admission Control, which will be calling this
136
+ // under two conditions: the node's Next <= raftLog.lastIndex (i.e. the "send
137
+ // queue" is not empty), and and there are some spare send tokens (hence the
138
+ // maxSize parameter).
139
+ func (rn * RawNode ) SendAppend (to uint64 , maxSize uint64 ) bool {
143
140
if ! rn .raft .enableLazyAppends || to == rn .raft .id {
144
141
return false
145
142
}
146
- return rn .raft .maybeSendAppendImpl (to , false /* lazy */ )
143
+ return rn .raft .maybeSendAppendImpl (to , entryEncodingSize ( maxSize ), false /* lazy */ )
147
144
}
148
145
149
146
// readyWithoutAccept returns a Ready. This is a read-only operation, i.e. there
0 commit comments