pgsql: Teach relation_needs_vacanalyze() to always compute scores.

2026-04-03 Thread Nathan Bossart
Teach relation_needs_vacanalyze() to always compute scores. Presently, this function only computes component scores when the corresponding threshold is reached. A follow-up commit will add a view that shows tables' autovacuum scores, and we anticipate that users will want to use this view to disc

pgsql: Make data checksum tests more resilient for slow machines

2026-04-03 Thread Daniel Gustafsson
Make data checksum tests more resilient for slow machines The test for re-running checksum enabling was only checking for the data checksum state to transition to 'on', but didn't account for the launcher process having had time to exit, thus getting an error instead of the expected no-op. Adding

pgsql: Add elevel parameter to relation_needs_vacanalyze().

2026-04-03 Thread Nathan Bossart
Add elevel parameter to relation_needs_vacanalyze(). This will be used in a follow-up commit to avoid emitting debug logs from this function. Author: Sami Imseih Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com Branch -- master Details -

pgsql: Online enabling and disabling of data checksums

2026-04-03 Thread Daniel Gustafsson
Online enabling and disabling of data checksums This allows data checksums to be enabled, or disabled, in a running cluster without restricting access to the cluster during processing. Data checksums could prior to this only be enabled during initdb or when the cluster is offline using the pg_che

pgsql: Remove bogus "safety margin" from predicate.c shmem estimates

2026-04-03 Thread Heikki Linnakangas
Remove bogus "safety margin" from predicate.c shmem estimates The 10% safety margin was copy-pasted from lock.c when the predicate locking code was originally added. However, we later (commit 7c797e7194) added the HASH_FIXED_SIZE flag to the hash tables, which means that they cannot actually use t

pgsql: Remove 10% safety margin from lock manager hash table estimates

2026-04-03 Thread Heikki Linnakangas
Remove 10% safety margin from lock manager hash table estimates As the comment says, the hash table sizes are just estimates, but that doesn't mean we need a "safety margin" here. hash_estimate_size() estimates the needed size in bytes pretty accurately for the given number of elements, so if we w

pgsql: Make the lock hash tables fixed-sized

2026-04-03 Thread Heikki Linnakangas
Make the lock hash tables fixed-sized This prevents the LOCK table from "stealing" space that was originally calculated for the PROLOCK table, and vice versa. That was weirdly indeterministic so that if you e.g. took a lot of locks consuming all the available shared memory for the LOCK table, subs

pgsql: Change default of max_locks_per_transactions to 128

2026-04-03 Thread Heikki Linnakangas
Change default of max_locks_per_transactions to 128 The previous commits reduced the amount of memory available for locks by eliminating the "safety margins" and by settling the split between LOCK and PROCLOCK tables at startup. The allocation is now more deterministic, but it also means that you

pgsql: oauth: Let validators provide failure DETAILs

2026-04-03 Thread Jacob Champion
oauth: Let validators provide failure DETAILs At the moment, the only way for a validator module to report error details on failure is to log them separately before returning from validate_cb. Independently of that problem, the ereport() calls that we make during validation failure partially dupli

pgsql: More tar portability adjustments.

2026-04-03 Thread Thomas Munro
More tar portability adjustments. For the three implementations that have caused problems so far: * GNU and BSD (libarchive) tar both understand --format=ustar * ustar doesn't support large UID/GID values, so set them to 0 to avoid a hard error from at least GNU tar * OpenBSD tar needs -F ustar

pgsql: More tar portability adjustments.

2026-04-03 Thread Thomas Munro
More tar portability adjustments. For the three implementations that have caused problems so far: * GNU and BSD (libarchive) tar both understand --format=ustar * ustar doesn't support large UID/GID values, so set them to 0 to avoid a hard error from at least GNU tar * OpenBSD tar needs -F ustar

pgsql: Merge init and max size options on shmem hash tables

2026-04-03 Thread Heikki Linnakangas
Merge init and max size options on shmem hash tables Replace the separate init and max size options with a single size option. We didn't make much use of the feature, all callers except the ones in wait_event.c already used the same size for both, and the hash tables in wait_event.c are small so t

pgsql: Remove HASH_DIRSIZE, always use the default algorithm to select

2026-04-03 Thread Heikki Linnakangas
Remove HASH_DIRSIZE, always use the default algorithm to select it It's not very useful to specify a non-standard directory size. The HASH_DIRSIZE option was only used for shared memory hash tables, and those always used hash_select_dirsize() to choose the size, which in turn just uses the default

pgsql: Allocate all parts of shmem hash table from a single contiguous

2026-04-03 Thread Heikki Linnakangas
Allocate all parts of shmem hash table from a single contiguous area Previously, the shared header (HASHHDR) and the directory were allocated by the caller, and passed to hash_create(), while the actual elements were allocated separately with ShmemAlloc(). After this commit, all the memory needed

pgsql: Prevent shared memory hash tables from growing beyond initial si

2026-04-03 Thread Heikki Linnakangas
Prevent shared memory hash tables from growing beyond initial size Set HASH_FIXED_SIZE on all shared memory hash tables, to prevent them from growing after the initial allocation. It was always weirdly indeterministic that if one hash table used up all the unused shared memory, you could not use t

pgsql: Refactor relation_needs_vacanalyze().

2026-04-03 Thread Nathan Bossart
Refactor relation_needs_vacanalyze(). This commit adds an early return to this function, allowing us to remove a level of indentation on a decent chunk of code. This is preparatory work for follow-up commits that will add a new system view to show tables' autovacuum scores. Reviewed-by: Sami Ims