mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vendor: update github.com/valyala/gozstd from v1.13.0 to v1.14.1
This should reduce memory usage in vmagent when compressing large scrape responses in stream parsing mode
This commit is contained in:
parent
06b0982d6b
commit
9761b7f3ef
4 changed files with 17 additions and 9 deletions
2
go.mod
2
go.mod
|
@ -27,7 +27,7 @@ require (
|
||||||
github.com/valyala/fastjson v1.6.3
|
github.com/valyala/fastjson v1.6.3
|
||||||
github.com/valyala/fastrand v1.1.0
|
github.com/valyala/fastrand v1.1.0
|
||||||
github.com/valyala/fasttemplate v1.2.1
|
github.com/valyala/fasttemplate v1.2.1
|
||||||
github.com/valyala/gozstd v1.13.0
|
github.com/valyala/gozstd v1.14.1
|
||||||
github.com/valyala/quicktemplate v1.7.0
|
github.com/valyala/quicktemplate v1.7.0
|
||||||
golang.org/x/net v0.0.0-20211011170408-caeb26a5c8c0
|
golang.org/x/net v0.0.0-20211011170408-caeb26a5c8c0
|
||||||
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
|
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -958,8 +958,8 @@ github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002
|
||||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||||
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
|
github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
|
||||||
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||||
github.com/valyala/gozstd v1.13.0 h1:M9qgbElBZsHlh8a4jjHO4lY42xLJeb+KWVBwFBAapRo=
|
github.com/valyala/gozstd v1.14.1 h1:xkPAeHe8U/w/ocS6PywjkH406lKdratZuxhb1UTgO/s=
|
||||||
github.com/valyala/gozstd v1.13.0/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
|
github.com/valyala/gozstd v1.14.1/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
|
||||||
github.com/valyala/histogram v1.1.2/go.mod h1:CZAr6gK9dbD7hYx2s8WSPh0p5x5wETjC+2b3PJVtEdg=
|
github.com/valyala/histogram v1.1.2/go.mod h1:CZAr6gK9dbD7hYx2s8WSPh0p5x5wETjC+2b3PJVtEdg=
|
||||||
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
|
github.com/valyala/histogram v1.2.0 h1:wyYGAZZt3CpwUiIb9AU/Zbllg1llXyrtApRS815OLoQ=
|
||||||
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
|
github.com/valyala/histogram v1.2.0/go.mod h1:Hb4kBwb4UxsaNbbbh+RRz8ZR6pdodR57tzWUS3BUzXY=
|
||||||
|
|
18
vendor/github.com/valyala/gozstd/gozstd.go
generated
vendored
18
vendor/github.com/valyala/gozstd/gozstd.go
generated
vendored
|
@ -123,7 +123,6 @@ func compress(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressi
|
||||||
// All OK.
|
// All OK.
|
||||||
return dst[:dstLen+compressedSize]
|
return dst[:dstLen+compressedSize]
|
||||||
}
|
}
|
||||||
|
|
||||||
if C.ZSTD_getErrorCode(result) != C.ZSTD_error_dstSize_tooSmall {
|
if C.ZSTD_getErrorCode(result) != C.ZSTD_error_dstSize_tooSmall {
|
||||||
// Unexpected error.
|
// Unexpected error.
|
||||||
panic(fmt.Errorf("BUG: unexpected error during compression with cd=%p: %s", cd, errStr(result)))
|
panic(fmt.Errorf("BUG: unexpected error during compression with cd=%p: %s", cd, errStr(result)))
|
||||||
|
@ -139,7 +138,12 @@ func compress(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressi
|
||||||
|
|
||||||
result := compressInternal(cctx, cctxDict, dst[dstLen:dstLen+compressBound], src, cd, compressionLevel, true)
|
result := compressInternal(cctx, cctxDict, dst[dstLen:dstLen+compressBound], src, cd, compressionLevel, true)
|
||||||
compressedSize := int(result)
|
compressedSize := int(result)
|
||||||
return dst[:dstLen+compressedSize]
|
dst = dst[:dstLen+compressedSize]
|
||||||
|
if cap(dst)-len(dst) > 4096 {
|
||||||
|
// Re-allocate dst in order to remove superflouos capacity and reduce memory usage.
|
||||||
|
dst = append([]byte{}, dst...)
|
||||||
|
}
|
||||||
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
func compressInternal(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressionLevel int, mustSucceed bool) C.size_t {
|
func compressInternal(cctx, cctxDict *cctxWrapper, dst, src []byte, cd *CDict, compressionLevel int, mustSucceed bool) C.size_t {
|
||||||
|
@ -234,7 +238,7 @@ func decompress(dctx, dctxDict *dctxWrapper, dst, src []byte, dd *DDict) ([]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
dstLen := len(dst)
|
dstLen := len(dst)
|
||||||
if cap(dst)-dstLen >= len(src) {
|
if cap(dst) > dstLen {
|
||||||
// Fast path - try decompressing without dst resize.
|
// Fast path - try decompressing without dst resize.
|
||||||
result := decompressInternal(dctx, dctxDict, dst[dstLen:cap(dst)], src, dd)
|
result := decompressInternal(dctx, dctxDict, dst[dstLen:cap(dst)], src, dd)
|
||||||
decompressedSize := int(result)
|
decompressedSize := int(result)
|
||||||
|
@ -270,8 +274,12 @@ func decompress(dctx, dctxDict *dctxWrapper, dst, src []byte, dd *DDict) ([]byte
|
||||||
result := decompressInternal(dctx, dctxDict, dst[dstLen:dstLen+decompressBound], src, dd)
|
result := decompressInternal(dctx, dctxDict, dst[dstLen:dstLen+decompressBound], src, dd)
|
||||||
decompressedSize := int(result)
|
decompressedSize := int(result)
|
||||||
if decompressedSize >= 0 {
|
if decompressedSize >= 0 {
|
||||||
// All OK.
|
dst = dst[:dstLen+decompressedSize]
|
||||||
return dst[:dstLen+decompressedSize], nil
|
if cap(dst)-len(dst) > 4096 {
|
||||||
|
// Re-allocate dst in order to remove superflouos capacity and reduce memory usage.
|
||||||
|
dst = append([]byte{}, dst...)
|
||||||
|
}
|
||||||
|
return dst, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error during decompression.
|
// Error during decompression.
|
||||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -208,7 +208,7 @@ github.com/valyala/fastrand
|
||||||
# github.com/valyala/fasttemplate v1.2.1
|
# github.com/valyala/fasttemplate v1.2.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/valyala/fasttemplate
|
github.com/valyala/fasttemplate
|
||||||
# github.com/valyala/gozstd v1.13.0
|
# github.com/valyala/gozstd v1.14.1
|
||||||
## explicit
|
## explicit
|
||||||
github.com/valyala/gozstd
|
github.com/valyala/gozstd
|
||||||
# github.com/valyala/histogram v1.2.0
|
# github.com/valyala/histogram v1.2.0
|
||||||
|
|
Loading…
Reference in a new issue