postgresql/src/include/lib
Alexander Korotkov bf1e650806 Use the pairing heap instead of a flat array for LSN replay waiters
06c418e163 introduced pg_wal_replay_wait() procedure allowing to wait for
the particular LSN to be replayed on standby.  The waiters were stored in
the flat array.  Even though scanning small arrays is fast, that might be a
problem at scale (a lot of waiting processes).

This commit replaces the flat shared memory array with the pairing heap,
which holds the waiter with the least LSN at the top.  This gives us O(log N)
complexity for both inserting and removing waiters.

Reported-by: Alvaro Herrera
Discussion: https://postgr.es/m/202404030658.hhj3vfxeyhft%40alvherre.pgsql
2024-04-03 18:15:41 +03:00
..
binaryheap.h Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
bipartite_match.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
bloomfilter.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
dshash.h Fix comments for the dshash_parameters struct. 2024-02-27 09:44:59 -06:00
hyperloglog.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
ilist.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
integerset.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
knapsack.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pairingheap.h Use the pairing heap instead of a flat array for LSN replay waiters 2024-04-03 18:15:41 +03:00
qunique.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
radixtree.h Remove superfluous trailing semicolons 2024-03-29 23:51:43 +01:00
rbtree.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
simplehash.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
sort_template.h Introduce overflow-safe integer comparison functions. 2024-02-16 13:37:02 -06:00
stringinfo.h Add destroyStringInfo function for cleaning up StringInfos 2024-03-16 23:18:28 +01:00