From ce2abcabdde2cc7ffaf5d4517314953f36147f59 Mon Sep 17 00:00:00 2001 From: Alexey Arno Date: Thu, 14 May 2015 01:17:28 +0300 Subject: [PATCH] dbms: Server: In the code managing asynchronous writes, fill with zeroes the portion of the buffer that is eventually truncated in order to keep Valgrind quiet. [#METR-15090] --- dbms/src/IO/WriteBufferAIO.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dbms/src/IO/WriteBufferAIO.cpp b/dbms/src/IO/WriteBufferAIO.cpp index 84d27e98133..229e21be131 100644 --- a/dbms/src/IO/WriteBufferAIO.cpp +++ b/dbms/src/IO/WriteBufferAIO.cpp @@ -338,14 +338,21 @@ void WriteBufferAIO::prepare() if (read_count < 0) throw Exception("Read error", ErrorCodes::AIO_READ_ERROR); + Position truncation_begin; off_t offset = DEFAULT_AIO_FILE_BLOCK_SIZE - region_right_padding; if (read_count > offset) { ::memcpy(buffer_end, memory_page + offset, read_count - offset); + truncation_begin = buffer_end + (read_count - offset); truncation_count = DEFAULT_AIO_FILE_BLOCK_SIZE - read_count; } else + { + truncation_begin = buffer_end; truncation_count = region_right_padding; + } + + ::memset(truncation_begin, 0, truncation_count); } } }