pgsql: Avoid valgrind complaint about write() of uninitalized bytes.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid valgrind complaint about write() of uninitalized bytes.
Date: 2018-02-06 19:25:04
Message-ID: E1ej8rY-0005fo-9e@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Avoid valgrind complaint about write() of uninitalized bytes.

LogicalTapeFreeze() may write out its first block when it is dirty but
not full, and then immediately read the first block back in from its
BufFile as a BLCKSZ-width block. This can only occur in rare cases
where very few tuples were written out, which is currently only
possible with parallel external tuplesorts. To avoid valgrind
complaints, tell it to treat the tail of logtape.c's buffer as
defined.

Commit 9da0cc35284bdbe8d442d732963303ff0e0a40bc exposed this problem
but did not create it. LogicalTapeFreeze() has always tended to write
out some amount of garbage bytes, but previously never wrote less than
one block of data in total, so the problem was masked.

Per buildfarm members lousyjack and skink.

Peter Geoghegan, based on a suggestion from Tom Lane and me. Some
comment revisions by me.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9fafa413ac602624e10f61ef44a20c17029d43d8

Modified Files
--------------
src/backend/utils/sort/logtape.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2018-02-06 20:51:05 pgsql: Fix incorrect grammar.
Previous Message Tom Lane 2018-02-06 18:53:15 pgsql: Doc: move info for btree opclass implementors into main document

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-02-06 20:02:05 Why does load_external_function() return PGFunction?
Previous Message Tom Lane 2018-02-06 19:23:07 Re: RelOptInfo -> Relation