pgsql: Add function for removing arbitrary nodes in binaryheap.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add function for removing arbitrary nodes in binaryheap.
Date: 2023-09-18 21:06:38
Message-ID: E1qiLS1-004d6a-Ma@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add function for removing arbitrary nodes in binaryheap.

This commit introduces binaryheap_remove_node(), which can be used
to remove any node from a binary heap. The implementation is
straightforward. The target node is replaced with the last node in
the heap, and then we sift as needed to preserve the heap property.
This new function is intended for use in a follow-up commit that
will improve the performance of pg_restore.

Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/3612876.1689443232%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c103d073819a2189d849c0a93d51c726be524c48

Modified Files
--------------
src/common/binaryheap.c | 29 +++++++++++++++++++++++++++++
src/include/lib/binaryheap.h | 3 +++
2 files changed, 32 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2023-09-18 23:32:06 pgsql: Fix assertion failure with PL/Python exceptions
Previous Message Nathan Bossart 2023-09-18 19:47:14 pgsql: Fix MSVC build for changes to binaryheap.