mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: permit very large v2 snapshots
v2 snapshots were hitting the 512MB message decode limit, causing sending snapshots to new members to fail for being too big.
This commit is contained in:
@@ -48,12 +48,16 @@ var (
|
||||
)
|
||||
|
||||
func (dec *messageDecoder) decode() (raftpb.Message, error) {
|
||||
return dec.decodeLimit(readBytesLimit)
|
||||
}
|
||||
|
||||
func (dec *messageDecoder) decodeLimit(numBytes uint64) (raftpb.Message, error) {
|
||||
var m raftpb.Message
|
||||
var l uint64
|
||||
if err := binary.Read(dec.r, binary.BigEndian, &l); err != nil {
|
||||
return m, err
|
||||
}
|
||||
if l > readBytesLimit {
|
||||
if l > numBytes {
|
||||
return m, ErrExceedSizeLimit
|
||||
}
|
||||
buf := make([]byte, int(l))
|
||||
|
||||
Reference in New Issue
Block a user