From 97de50dd4cf02a2c9ac519202000c04774991e35 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 24 Dec 2019 14:40:04 +0200 Subject: [PATCH] app/vmselect/netstorage: improve error message when reading data size in readBytes --- app/vmselect/netstorage/netstorage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 92a9265c2f..3e50ba4aa0 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -1305,8 +1305,8 @@ func writeBool(bc *handshake.BufferedConn, b bool) error { func readBytes(buf []byte, bc *handshake.BufferedConn, maxDataSize int) ([]byte, error) { buf = bytesutil.Resize(buf, 8) - if _, err := io.ReadFull(bc, buf); err != nil { - return buf, fmt.Errorf("error read data size: %s", err) + if n, err := io.ReadFull(bc, buf); err != nil { + return buf, fmt.Errorf("cannot read %d bytes with data size: %s; read only %d bytes", len(buf), err, n) } dataSize := encoding.UnmarshalUint64(buf) if dataSize > uint64(maxDataSize) {