postgresql/src/test
Andres Freund 999dec9ec6 aio: Don't wait for already in-progress IO
When a backend attempts to start a read IO and finds the first buffer already
has I/O in progress, previously it waited for that I/O to complete before
initiating reads for any of the subsequent buffers.

Although it must wait for the I/O to finish when acquiring the buffer, there's
no reason for it to wait when setting up the read operation. Waiting at this
point prevents starting I/O on subsequent buffers and can significantly reduce
concurrency.

This matters in two workloads:
1) When multiple backends scan the same relation concurrently.
2) When a single backend requests the same block multiple times within the
   readahead distance.

Waiting each time an in-progress read is encountered effectively degenerates
the access pattern into synchronous I/O.

To fix this, when encountering an already in-progress IO for the head buffer,
the wait reference is now recorded and waiting is deferred until
WaitReadBuffers(), when the buffer actually needs to be acquired.

In rare cases, a backend may still need to wait synchronously at IO
start time: If another backend has set BM_IO_IN_PROGRESS on the buffer
but has not yet set the wait reference. Such windows should be brief and
uncommon.

Author: Melanie Plageman <melanieplageman@gmail.com>
Author: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/flat/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw%403p3zu522yykv
2026-03-27 19:53:32 -04:00
..
authentication Warn upon successful MD5 password authentication. 2026-02-23 11:22:04 -06:00
examples Force standard_conforming_strings to always be ON. 2026-01-21 15:08:38 -05:00
icu Update copyright for 2026 2026-01-01 13:24:10 -05:00
isolation Remove isolation test lock-stats 2026-03-25 08:48:15 +09:00
kerberos Update copyright for 2026 2026-01-01 13:24:10 -05:00
ldap Update copyright for 2026 2026-01-01 13:24:10 -05:00
locale Update copyright for 2026 2026-01-01 13:24:10 -05:00
mb Fix MB regression tests for WAL-logging of hash indexes. 2017-03-15 07:25:36 -04:00
modules aio: Don't wait for already in-progress IO 2026-03-27 19:53:32 -04:00
perl ssl: Serverside SNI support for libpq 2026-03-18 12:37:11 +01:00
postmaster Update copyright for 2026 2026-01-01 13:24:10 -05:00
recovery Switch to FATAL error for missing checkpoint record without backup_label 2026-03-10 12:00:05 +09:00
regress Align tests for stored and virtual generated columns 2026-03-27 15:49:34 +01:00
ssl ssl: Skip passphrase reload tests in EXEC_BACKEND builds 2026-03-18 22:59:57 +01:00
subscription Add support for EXCEPT TABLE in ALTER PUBLICATION. 2026-03-20 11:36:09 +05:30
Makefile Split some long Makefile lists 2025-12-28 09:17:42 +09:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
README Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

authentication/
  Tests for authentication (but see also below)

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

kerberos/
  Tests for Kerberos/GSSAPI authentication and encryption

ldap/
  Tests for LDAP-based authentication

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

subscription/
  Tests for logical replication