pgsql: Fix a bug in pairing heap removal code. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Fix a bug in pairing heap removal code.
Date
Msg-id E1YNpFu-00013u-Gv@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix a bug in pairing heap removal code.

After removal, the next_sibling pointer of a node was sometimes incorrectly
left to point to another node in the heap, which meant that a node was
sometimes linked twice into the heap. Surprisingly that didn't cause any
crashes in my testing, but it was clearly wrong and could easily segfault
in other scenarios.

Also always keep the prev_or_parent pointer as NULL on the root node. That
was not a correctness issue AFAICS, but let's be tidy.

Add a debugging function, to dump the contents of a pairing heap as a
string. It's #ifdef'd out, as it's not used for anything in any normal
code, but it was highly useful in debugging this. Let's keep it handy for
further reference.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/931bf3eb9b203ca02d729f5122a44cc250c27695

Modified Files
--------------
src/backend/lib/pairingheap.c |   59 +++++++++++++++++++++++++++++++++++++++++
src/include/lib/pairingheap.h |   11 ++++++++
2 files changed, 70 insertions(+)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix knn-GiST queue comparison function to return heap tuples fir
Next
From: Tom Lane
Date:
Subject: pgsql: Fix EXPLAIN output for cases where parent table is excluded by c