mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
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]
This commit is contained in:
parent
5d0e5ec60c
commit
ce2abcabdd
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user