pgsql: Don't reset 'latest_page_number' when replaying multixid truncat

2026-03-22 Thread Heikki Linnakangas
Don't reset 'latest_page_number' when replaying multixid truncation 'latest_page_number' is set to the correct value, according to nextOffset, early at system startup. Contrary to the comment, it hence should be set up correctly by the time we get to WAL replay. This was committed to back-branche

pgsql: Remove nonfunctional tar file trailer size check.

2026-03-22 Thread Tom Lane
Remove nonfunctional tar file trailer size check. The ASTREAMER_ARCHIVE_TRAILER case in astreamer_tar_parser_content() intended to reject tar files whose trailer exceeded 2 blocks. However, the check compared 'len' after astreamer_buffer_bytes() had already consumed all the data and set len to 0,

pgsql: Fix assorted bugs in archive_waldump.c.

2026-03-22 Thread Tom Lane
Fix assorted bugs in archive_waldump.c. 1. archive_waldump.c called astreamer_finalize() nowhere. This meant that any data retained in decompression buffers at the moment we detect archive EOF would never reach astreamer_waldump_content(), resulting in surprising failures if we actually need the

pgsql: Fix another buglet in archive_waldump.c.

2026-03-22 Thread Tom Lane
Fix another buglet in archive_waldump.c. While re-reading 860359ea0, I noticed another problem: when spilling to a temp file, it did not bother to check the result of fclose(). This is bad since write errors (like ENOSPC) may not be reported until close time. Branch -- master Details --

pgsql: Add fake LSN support to hash index AM.

2026-03-22 Thread Peter Geoghegan
Add fake LSN support to hash index AM. Use fake LSNs in all hash AM critical sections that write a WAL record. This gives us a reliable way (a way that works during scans of both logged and unlogged relations) to detect when an index page was concurrently modified during the window between when th

pgsql: Fix finalization of decompressor astreamers.

2026-03-22 Thread Tom Lane
Fix finalization of decompressor astreamers. Send the correct amount of data to the next astreamer, not the whole allocated buffer size. This bug escaped detection because in present uses the next astreamer is always a tar-file parser which is insensitive to trailing garbage. But that may not be

pgsql: Fix finalization of decompressor astreamers.

2026-03-22 Thread Tom Lane
Fix finalization of decompressor astreamers. Send the correct amount of data to the next astreamer, not the whole allocated buffer size. This bug escaped detection because in present uses the next astreamer is always a tar-file parser which is insensitive to trailing garbage. But that may not be

pgsql: Fix finalization of decompressor astreamers.

2026-03-22 Thread Tom Lane
Fix finalization of decompressor astreamers. Send the correct amount of data to the next astreamer, not the whole allocated buffer size. This bug escaped detection because in present uses the next astreamer is always a tar-file parser which is insensitive to trailing garbage. But that may not be

pgsql: Fix finalization of decompressor astreamers.

2026-03-22 Thread Tom Lane
Fix finalization of decompressor astreamers. Send the correct amount of data to the next astreamer, not the whole allocated buffer size. This bug escaped detection because in present uses the next astreamer is always a tar-file parser which is insensitive to trailing garbage. But that may not be

pgsql: Fix finalization of decompressor astreamers.

2026-03-22 Thread Tom Lane
Fix finalization of decompressor astreamers. Send the correct amount of data to the next astreamer, not the whole allocated buffer size. This bug escaped detection because in present uses the next astreamer is always a tar-file parser which is insensitive to trailing garbage. But that may not be

pgsql: Detect and fix visibility map corruption in more cases

2026-03-22 Thread Melanie Plageman
Detect and fix visibility map corruption in more cases Move VM corruption detection and repair into heap page pruning. This allows VM repair during on-access pruning, not only during vacuum. Also, expand corruption detection to cover pages marked all-visible that contain dead tuples and tuples in

pgsql: Make IndexScanInstrumentation a pointer in executor scan nodes.

2026-03-22 Thread Peter Geoghegan
Make IndexScanInstrumentation a pointer in executor scan nodes. Change the IndexScanInstrumentation fields in IndexScanState, IndexOnlyScanState, and BitmapIndexScanState from inline structs to pointers. This avoids additional space overhead whenever new fields are added to IndexScanInstrumentati

pgsql: Add pruning fast path for all-visible and all-frozen pages

2026-03-22 Thread Melanie Plageman
Add pruning fast path for all-visible and all-frozen pages Because of the SKIP_PAGES_THRESHOLD optimization or a stale prune XID, heap_page_prune_and_freeze() can be invoked for pages with no pruning or freezing work to do. To avoid this, if a page is already all-frozen or it is all-visible and no

pgsql: Add missing deflateEnd() for server-side gzip base backups

2026-03-22 Thread Michael Paquier
Add missing deflateEnd() for server-side gzip base backups The gzip basebackup sink called deflateInit2() in begin_archive() but never called deflateEnd(), leaking zlib's internal compression state (~256KB per archive) until the memory context of the base backup is destroyed. The code tree has al

pgsql: pg_createsubscriber: Introduce module-specific logging functions

2026-03-22 Thread Amit Kapila
pg_createsubscriber: Introduce module-specific logging functions. Replace generic pg_log_* calls with report_createsub_log() and report_createsub_fatal(). This refactor provides the necessary infrastructure to support logging to external files via the -l option. These new functions enable the uti