Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)
Peter Geoghegan <pg@bowt.ie>
Attachments
- 0001-Add-logtape.c-Valgrind-suppression.patch (text/x-patch) patch 0001
On Fri, Feb 2, 2018 at 4:31 PM, Peter Geoghegan <pg@bowt.ie> wrote: > On Fri, Feb 2, 2018 at 1:58 PM, Andres Freund <andres@anarazel.de> wrote: >> Not saying you're wrong, but you should include a comment on why this is >> a benign warning. Presumably it's some padding memory somewhere, but >> it's not obvious from the above bleat. > > Sure. This looks slightly more complicated than first anticipated, but > I'll keep everyone posted. I couldn't make up my mind if it was best to prevent the uninitialized write(), or to instead just add a suppression. I eventually decided upon the suppression -- see attached patch. My proposed commit message has a full explanation of the Valgrind issue, which I won't repeat here. Go read it before reading the rest of this e-mail. It might seem like my suppression is overly broad, or not broad enough, since it essentially targets LogicalTapeFreeze(). I don't think it is, though, because this can occur in two places within LogicalTapeFreeze() -- it can occur in the place we actually saw the issue on lousyjack, from the ltsReadBlock() call within LogicalTapeFreeze(), as well as a second place -- when BufFileExportShared() is called. I found that you have to tweak code to prevent it happening in the first place before you'll see it happen in the second place. I see no point in actually playing whack-a-mole for a totally benign issue like this, though, which made me finally decide upon the suppression approach. Bear in mind that a third way of fixing this would be to allocate logtape.c buffers using palloc0() rather than palloc() (though I don't like that idea at all). For serial external sorts, the logtape.c buffers are guaranteed to have been written to/initialized at least once as part of spilling a sort to disk. Parallel external sorts don't quite guarantee that, which is why we run into this Valgrind issue. -- Peter Geoghegan
Commits
-
Support parallel btree index builds.
- 9da0cc35284b 11.0 landed
-
Report an ERROR if a parallel worker fails to start properly.
- 2badb5afb89c 11.0 cited
-
Transfer state pertaining to pending REINDEX operations to workers.
- 29d58fd3adae 11.0 landed
-
Add a barrier primitive for synchronizing backends.
- 1145acc70deb 11.0 cited
-
Allow DML commands that create tables to use parallel query.
- e9baa5e9fa14 11.0 cited
-
Refactor GetOldestXmin() to use flags
- af4b1a0869bd 10.0 cited
-
Fix regression in parallel planning against inheritance tables.
- 2609e91fcf9d 10.0 cited
-
Don't create "holes" in BufFiles, in the new logtape code.
- 7ac4a389a7db 10.0 cited
-
Simplify the code for logical tape read buffers.
- b75f467b6eec 10.0 cited
-
Fix excessive memory consumption in the new sort pre-reading code.
- b56fb691b003 10.0 cited
-
Implement binary heap replace-top operation in a smarter way.
- 24598337c8d2 10.0 cited
-
Cosmetic code cleanup in commands/extension.c.
- 25794e841e5b 10.0 cited
-
Speed up planner's scanning for parallel-query hazards.
- da1c91631e35 10.0 cited
-
Read from the same worker repeatedly until it returns no tuple.
- bc7fcab5e36b 9.6.0 cited
-
Improve tuplesort.c to support variable merge order. The original coding
- df700e6b4019 8.2.0 cited