Skip to content

Commit

Permalink
rafthttp: add snapshot limit const (#11846)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 authored May 5, 2020
1 parent 17ed0c6 commit d9d850c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion etcdserver/api/rafthttp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const (
// throughput bottleneck as well as small enough
// for not causing a read timeout.
connReadLimitByte = 64 * 1024

// snapshotLimitByte limits the snapshot size to 1TB
snapshotLimitByte = 1 * 1024 * 1024 * 1024 * 1024
)

var (
Expand Down Expand Up @@ -215,7 +218,7 @@ func (h *snapshotHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

dec := &messageDecoder{r: r.Body}
// let snapshots be very large since they can exceed 512MB for large installations
m, err := dec.decodeLimit(uint64(1 << 63))
m, err := dec.decodeLimit(snapshotLimitByte)
from := types.ID(m.From).String()
if err != nil {
msg := fmt.Sprintf("failed to decode raft message (%v)", err)
Expand Down

0 comments on commit d9d850c

Please sign in to comment.