aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 6b7c10bcfca..66bfcced8d7 100644
--- a/src/backend/utils/sort/logtape.c
+++ b/src/backend/utils/sort/logtape.c
@@ -86,6 +86,7 @@
#include "storage/buffile.h"
#include "utils/builtins.h"
#include "utils/logtape.h"
+#include "utils/memdebug.h"
#include "utils/memutils.h"
/*
@@ -874,6 +875,17 @@ LogicalTapeFreeze(LogicalTapeSet *lts, int tapenum, TapeShare *share)
*/
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);
lt->writing = false;