aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2018-02-22 09:28:12 -0500
committerRobert Haas <rhaas@postgresql.org>2018-02-22 09:28:12 -0500
commitde6428afe13bb6eb1c99a70aada1a105966bc27e (patch)
tree363e4cf5370f26dff291c2642c7eddeb1151b6bb /src
parent9a5c4f58f36dc7c87619602a7a2ec7de5a287068 (diff)
downloadpostgresql-de6428afe13bb6eb1c99a70aada1a105966bc27e.tar.gz
postgresql-de6428afe13bb6eb1c99a70aada1a105966bc27e.zip
Avoid another valgrind complaint about write() of uninitalized bytes.
Peter Geoghegan, per buildfarm member skink and Andres Freund Discussion: http://postgr.es/m/20180221053426.gp72lw67yfpzkw7a@alap3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/sort/logtape.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/utils/sort/logtape.c b/src/backend/utils/sort/logtape.c
index d6794bf3de1..05dde631ddc 100644
--- a/src/backend/utils/sort/logtape.c
+++ b/src/backend/utils/sort/logtape.c
@@ -739,6 +739,18 @@ LogicalTapeRewindForRead(LogicalTapeSet *lts, int tapenum, size_t buffer_size)
*/
if (lt->dirty)
{
+ /*
+ * As long as we've filled the buffer at least once, its contents
+ * are entirely defined from valgrind's point of view, even though
+ * contents beyond the current end point may be stale. But it's
+ * possible - at least in the case of a parallel sort - to sort
+ * such small amount of data that we do not fill the buffer even
+ * once. Tell valgrind that its contents are defined, so it
+ * doesn't bleat.
+ */
+ VALGRIND_MAKE_MEM_DEFINED(lt->buffer + lt->nbytes,
+ lt->buffer_size - lt->nbytes);
+
TapeBlockSetNBytes(lt->buffer, lt->nbytes);
ltsWriteBlock(lts, lt->curBlockNumber, (void *) lt->buffer);
}