From 3dffc6099e9642c916f13ff7e5d3ec1599418821 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 26 Nov 2020 13:27:12 +0200 Subject: [PATCH] vendor: update github.com/VictoriaMetrics/fasthttp from v1.0.8 to v1.0.9 --- go.mod | 2 +- go.sum | 4 ++-- .../github.com/VictoriaMetrics/fasthttp/fs.go | 4 ++-- .../VictoriaMetrics/fasthttp/http.go | 19 +++++++++++-------- vendor/modules.txt | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index bac2050f4..c5993dcf9 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( // Do not use the original github.com/valyala/fasthttp because of issues // like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b - github.com/VictoriaMetrics/fasthttp v1.0.8 + github.com/VictoriaMetrics/fasthttp v1.0.9 github.com/VictoriaMetrics/metrics v1.12.3 github.com/VictoriaMetrics/metricsql v0.7.2 github.com/aws/aws-sdk-go v1.35.31 diff --git a/go.sum b/go.sum index 1dbf626a5..7a9fc6270 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= -github.com/VictoriaMetrics/fasthttp v1.0.8 h1:Vhf0IGbjajV9mqEpy3y1VVISTgGay9yqR04Y9GD0CFI= -github.com/VictoriaMetrics/fasthttp v1.0.8/go.mod h1:3SeUL4zwB/p/a9aEeRc6gdlbrtNHXBJR6N376EgiSHU= +github.com/VictoriaMetrics/fasthttp v1.0.9 h1:Fja1tfcNMNoUD7RJDYpjGx2CsSfXkUbISKY4kNafdN4= +github.com/VictoriaMetrics/fasthttp v1.0.9/go.mod h1:3SeUL4zwB/p/a9aEeRc6gdlbrtNHXBJR6N376EgiSHU= github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= github.com/VictoriaMetrics/metrics v1.12.3 h1:Fe6JHC6MSEKa+BtLhPN8WIvS+HKPzMc2evEpNeCGy7I= github.com/VictoriaMetrics/metrics v1.12.3/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= diff --git a/vendor/github.com/VictoriaMetrics/fasthttp/fs.go b/vendor/github.com/VictoriaMetrics/fasthttp/fs.go index 0d83b6090..268021438 100644 --- a/vendor/github.com/VictoriaMetrics/fasthttp/fs.go +++ b/vendor/github.com/VictoriaMetrics/fasthttp/fs.go @@ -591,8 +591,8 @@ func (r *fsSmallFileReader) WriteTo(w io.Writer) (int64, error) { } curPos := r.startPos - bufv := copyBufPool.Get() - buf := bufv.([]byte) + bufv := copyBufPool.Get().(*copyBuf) + buf := bufv.b[:] for err == nil { tailLen := r.endPos - curPos if tailLen <= 0 { diff --git a/vendor/github.com/VictoriaMetrics/fasthttp/http.go b/vendor/github.com/VictoriaMetrics/fasthttp/http.go index 5fc3bee11..3c7fc56d1 100644 --- a/vendor/github.com/VictoriaMetrics/fasthttp/http.go +++ b/vendor/github.com/VictoriaMetrics/fasthttp/http.go @@ -1476,8 +1476,8 @@ type httpWriter interface { } func writeBodyChunked(w *bufio.Writer, r io.Reader) error { - vbuf := copyBufPool.Get() - buf := vbuf.([]byte) + bufv := copyBufPool.Get().(*copyBuf) + buf := bufv.b[:] var err error var n int @@ -1500,7 +1500,7 @@ func writeBodyChunked(w *bufio.Writer, r io.Reader) error { } } - copyBufPool.Put(vbuf) + copyBufPool.Put(bufv) return err } @@ -1541,16 +1541,19 @@ func writeBodyFixedSize(w *bufio.Writer, r io.Reader, size int64) error { } func copyZeroAlloc(w io.Writer, r io.Reader) (int64, error) { - vbuf := copyBufPool.Get() - buf := vbuf.([]byte) - n, err := io.CopyBuffer(w, r, buf) - copyBufPool.Put(vbuf) + buf := copyBufPool.Get().(*copyBuf) + n, err := io.CopyBuffer(w, r, buf.b[:]) + copyBufPool.Put(buf) return n, err } +type copyBuf struct { + b [4 * 4096]byte +} + var copyBufPool = sync.Pool{ New: func() interface{} { - return make([]byte, 4096) + return ©Buf{} }, } diff --git a/vendor/modules.txt b/vendor/modules.txt index 4ae3a02cb..891ae0124 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -10,7 +10,7 @@ cloud.google.com/go/internal/version cloud.google.com/go/storage # github.com/VictoriaMetrics/fastcache v1.5.7 github.com/VictoriaMetrics/fastcache -# github.com/VictoriaMetrics/fasthttp v1.0.8 +# github.com/VictoriaMetrics/fasthttp v1.0.9 github.com/VictoriaMetrics/fasthttp github.com/VictoriaMetrics/fasthttp/fasthttputil github.com/VictoriaMetrics/fasthttp/stackless