pgsql: Optimize GenerationAlloc() and SlabAlloc()

2024-03-03 Thread David Rowley
Optimize GenerationAlloc() and SlabAlloc() In a similar effort to 413c18401, separate out the hot and cold paths in GenerationAlloc() and SlabAlloc() to avoid having to setup the stack frame for the hot path. This additionally adjusts how we use the GenerationContext's freeblock. Freeblock, when

pgsql: Support partition pruning on boolcol IS [NOT] UNKNOWN

2024-03-03 Thread David Rowley
Support partition pruning on boolcol IS [NOT] UNKNOWN While working on 4c2369ac5, I noticed we went out of our way not to support clauses on boolean partitioned tables in the form of "IS UNKNOWN" and "IS NOT UNKNOWN". It's almost as much code to disallow this as it is to allow it, so let's allow

pgsql: Add PostgreSQL::Test::Cluster::wait_for_event()

2024-03-03 Thread Michael Paquier
Add PostgreSQL::Test::Cluster::wait_for_event() Per a demand from the author and the reviewer of this commit, this adds to Cluster.pm a helper routine that can be used to monitor when a process reaches a wanted wait event. This can be used in combination with the module injection_points for the

pgsql: Add regression test for restart points during promotion

2024-03-03 Thread Michael Paquier
Add regression test for restart points during promotion This test serves as a way to demonstrate how to use the features introduced in 37b369dc67bc, while providing coverage for 7863ee4def65 that caused the startup process to throw "PANIC: could not locate a valid checkpoint record" when starting

pgsql: injection_points: Add wait and wakeup of processes

2024-03-03 Thread Michael Paquier
injection_points: Add wait and wakeup of processes This commit adds two features to the in-core module for injection points: - A new callback called "wait" that can be attached to an injection point to make it wait. - A new SQL function to update the shared state and broadcast the update using a

pgsql: Replace BackendIds with 0-based ProcNumbers

2024-03-03 Thread Heikki Linnakangas
Replace BackendIds with 0-based ProcNumbers Now that BackendId was just another index into the proc array, it was redundant with the 0-based proc numbers used in other places. Replace all usage of backend IDs with proc numbers. The only place where the term "backend id" remains is in a few

pgsql: Redefine backend ID to be an index into the proc array

2024-03-03 Thread Heikki Linnakangas
Redefine backend ID to be an index into the proc array Previously, backend ID was an index into the ProcState array, in the shared cache invalidation manager (sinvaladt.c). The entry in the ProcState array was reserved at backend startup by scanning the array for a free entry, and that was also

pgsql: GUC table: Add description to computed variables

2024-03-03 Thread Alvaro Herrera
GUC table: Add description to computed variables Per suggestion from Kyotaro Horiguchi Discussion: https://postgr.es/m/20240229.130404.1411153273308142188.horikyota@gmail.com Branch -- master Details ---