Re: Bug in batch tuplesort memory CLUSTER case (9.6 only)

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in batch tuplesort memory CLUSTER case (9.6 only)
Date: 2016-07-01 18:23:40
Message-ID: CAM3SWZTOm7tXi1iW94FgNxdo5G5r0sdDwTmjxuOaA2qM0NZaUg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 1, 2016 at 6:23 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> The proposed patch contains no test case and no description of how to
> reproduce the problem. I am not very keen on the idea of trying to
> puzzle that out from first principles.

I thought that the bug was simple enough that it didn't require a
testcase. Besides, as I've often complained about there are no tests
of external sorting in the regression test suite whatsoever. I don't
think you'd just accept it now if I tried to add some.

I could give you steps to reproduce the bug, but they involve creating
a large table using my gensort tool [1]. It isn't trivial. Are you
interested?

> Also, I would appreciate a
> clearer explanation of why this only affects CLUSTER tuplesorts.

As I said, it has the only type of caller tuple that happens to itself
contain a pointer to palloc()'d memory. Clearly that needs to be
updated if the tuple is moved, since it always points to an offset
into the same tuple. I thought that that explanation was simple.

[1] https://github.com/petergeoghegan/gensort
--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-07-01 18:46:47 Re: Forthcoming SQL standards about JSON and Multi-Dimensional Arrays (FYI)
Previous Message Tom Lane 2016-07-01 18:01:42 Re: Broken handling of lwlocknames.h