mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vendor: update github.com/klauspost/compress from v1.13.0 to v1.13.1
This commit is contained in:
parent
a90012ef26
commit
7b283ee91c
6 changed files with 45 additions and 24 deletions
2
go.mod
2
go.mod
|
@ -19,7 +19,7 @@ require (
|
|||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/snappy v0.0.3
|
||||
github.com/influxdata/influxdb v1.9.2
|
||||
github.com/klauspost/compress v1.13.0
|
||||
github.com/klauspost/compress v1.13.1
|
||||
github.com/mattn/go-isatty v0.0.13 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/prometheus/common v0.28.0 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -588,8 +588,8 @@ github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0
|
|||
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||
github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.13.0 h1:2T7tUoQrQT+fQWdaY5rjWztFGAFwbGD04iPJg90ZiOs=
|
||||
github.com/klauspost/compress v1.13.0/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ=
|
||||
github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
|
||||
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg=
|
||||
github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
|
|
4
vendor/github.com/klauspost/compress/zstd/blockdec.go
generated
vendored
4
vendor/github.com/klauspost/compress/zstd/blockdec.go
generated
vendored
|
@ -168,10 +168,10 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
|
|||
|
||||
// Read block data.
|
||||
if cap(b.dataStorage) < cSize {
|
||||
if b.lowMem {
|
||||
if b.lowMem || cSize > maxCompressedBlockSize {
|
||||
b.dataStorage = make([]byte, 0, cSize)
|
||||
} else {
|
||||
b.dataStorage = make([]byte, 0, maxBlockSize)
|
||||
b.dataStorage = make([]byte, 0, maxCompressedBlockSize)
|
||||
}
|
||||
}
|
||||
if cap(b.dst) <= maxSize {
|
||||
|
|
21
vendor/github.com/klauspost/compress/zstd/decoder_options.go
generated
vendored
21
vendor/github.com/klauspost/compress/zstd/decoder_options.go
generated
vendored
|
@ -17,6 +17,7 @@ type decoderOptions struct {
|
|||
lowMem bool
|
||||
concurrent int
|
||||
maxDecodedSize uint64
|
||||
maxWindowSize uint64
|
||||
dicts []dict
|
||||
}
|
||||
|
||||
|
@ -25,6 +26,7 @@ func (o *decoderOptions) setDefault() {
|
|||
// use less ram: true for now, but may change.
|
||||
lowMem: true,
|
||||
concurrent: runtime.GOMAXPROCS(0),
|
||||
maxWindowSize: MaxWindowSize,
|
||||
}
|
||||
o.maxDecodedSize = 1 << 63
|
||||
}
|
||||
|
@ -52,7 +54,6 @@ func WithDecoderConcurrency(n int) DOption {
|
|||
// WithDecoderMaxMemory allows to set a maximum decoded size for in-memory
|
||||
// non-streaming operations or maximum window size for streaming operations.
|
||||
// This can be used to control memory usage of potentially hostile content.
|
||||
// For streaming operations, the maximum window size is capped at 1<<30 bytes.
|
||||
// Maximum and default is 1 << 63 bytes.
|
||||
func WithDecoderMaxMemory(n uint64) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
|
@ -81,3 +82,21 @@ func WithDecoderDicts(dicts ...[]byte) DOption {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// WithDecoderMaxWindow allows to set a maximum window size for decodes.
|
||||
// This allows rejecting packets that will cause big memory usage.
|
||||
// The Decoder will likely allocate more memory based on the WithDecoderLowmem setting.
|
||||
// If WithDecoderMaxMemory is set to a lower value, that will be used.
|
||||
// Default is 512MB, Maximum is ~3.75 TB as per zstandard spec.
|
||||
func WithDecoderMaxWindow(size uint64) DOption {
|
||||
return func(o *decoderOptions) error {
|
||||
if size < MinWindowSize {
|
||||
return errors.New("WithMaxWindowSize must be at least 1KB, 1024 bytes")
|
||||
}
|
||||
if size > (1<<41)+7*(1<<38) {
|
||||
return errors.New("WithMaxWindowSize must be less than (1<<41) + 7*(1<<38) ~ 3.75TB")
|
||||
}
|
||||
o.maxWindowSize = size
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
28
vendor/github.com/klauspost/compress/zstd/framedec.go
generated
vendored
28
vendor/github.com/klauspost/compress/zstd/framedec.go
generated
vendored
|
@ -22,10 +22,6 @@ type frameDec struct {
|
|||
|
||||
WindowSize uint64
|
||||
|
||||
// maxWindowSize is the maximum windows size to support.
|
||||
// should never be bigger than max-int.
|
||||
maxWindowSize uint64
|
||||
|
||||
// In order queue of blocks being decoded.
|
||||
decoding chan *blockDec
|
||||
|
||||
|
@ -50,8 +46,11 @@ type frameDec struct {
|
|||
}
|
||||
|
||||
const (
|
||||
// The minimum Window_Size is 1 KB.
|
||||
// MinWindowSize is the minimum Window Size, which is 1 KB.
|
||||
MinWindowSize = 1 << 10
|
||||
|
||||
// MaxWindowSize is the maximum encoder window size
|
||||
// and the default decoder maximum window size.
|
||||
MaxWindowSize = 1 << 29
|
||||
)
|
||||
|
||||
|
@ -61,12 +60,11 @@ var (
|
|||
)
|
||||
|
||||
func newFrameDec(o decoderOptions) *frameDec {
|
||||
if o.maxWindowSize > o.maxDecodedSize {
|
||||
o.maxWindowSize = o.maxDecodedSize
|
||||
}
|
||||
d := frameDec{
|
||||
o: o,
|
||||
maxWindowSize: MaxWindowSize,
|
||||
}
|
||||
if d.maxWindowSize > o.maxDecodedSize {
|
||||
d.maxWindowSize = o.maxDecodedSize
|
||||
}
|
||||
return &d
|
||||
}
|
||||
|
@ -251,13 +249,17 @@ func (d *frameDec) reset(br byteBuffer) error {
|
|||
}
|
||||
}
|
||||
|
||||
if d.WindowSize > d.maxWindowSize {
|
||||
printf("window size %d > max %d\n", d.WindowSize, d.maxWindowSize)
|
||||
if d.WindowSize > uint64(d.o.maxWindowSize) {
|
||||
if debugDecoder {
|
||||
printf("window size %d > max %d\n", d.WindowSize, d.o.maxWindowSize)
|
||||
}
|
||||
return ErrWindowSizeExceeded
|
||||
}
|
||||
// The minimum Window_Size is 1 KB.
|
||||
if d.WindowSize < MinWindowSize {
|
||||
if debugDecoder {
|
||||
println("got window size: ", d.WindowSize)
|
||||
}
|
||||
return ErrWindowSizeTooSmall
|
||||
}
|
||||
d.history.windowSize = int(d.WindowSize)
|
||||
|
@ -352,8 +354,8 @@ func (d *frameDec) checkCRC() error {
|
|||
|
||||
func (d *frameDec) initAsync() {
|
||||
if !d.o.lowMem && !d.SingleSegment {
|
||||
// set max extra size history to 10MB.
|
||||
d.history.maxSize = d.history.windowSize + maxBlockSize*5
|
||||
// set max extra size history to 2MB.
|
||||
d.history.maxSize = d.history.windowSize + maxBlockSize
|
||||
}
|
||||
// re-alloc if more than one extra block size.
|
||||
if d.o.lowMem && cap(d.history.b) > d.history.maxSize+maxBlockSize {
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -128,7 +128,7 @@ github.com/jmespath/go-jmespath
|
|||
github.com/jstemmer/go-junit-report
|
||||
github.com/jstemmer/go-junit-report/formatter
|
||||
github.com/jstemmer/go-junit-report/parser
|
||||
# github.com/klauspost/compress v1.13.0
|
||||
# github.com/klauspost/compress v1.13.1
|
||||
## explicit
|
||||
github.com/klauspost/compress/flate
|
||||
github.com/klauspost/compress/fse
|
||||
|
|
Loading…
Reference in a new issue