pgsql: Replace buffer I/O locks with condition variables.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Replace buffer I/O locks with condition variables.
Date: 2021-03-10 21:46:28
Message-ID: E1lK6ey-0003uX-Gk@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Replace buffer I/O locks with condition variables.

1. Backends waiting for buffer I/O are now interruptible.

2. If something goes wrong in a backend that is currently performing
I/O, waiting backends no longer wake up until that backend reaches
AbortBufferIO() and broadcasts on the CV. Previously, any waiters would
wake up (because the I/O lock was automatically released) and then
busy-loop until AbortBufferIO() cleared BM_IO_IN_PROGRESS.

3. LWLockMinimallyPadded is removed, as it would now be unused.

Author: Robert Haas <robertmhaas(at)gmail(dot)com>
Reviewed-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Reviewed-by: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> (earlier version, 2016)
Discussion: https://postgr.es/m/CA%2BhUKGJ8nBFrjLuCTuqKN0pd2PQOwj9b_jnsiGFFMDvUxahj_A%40mail.gmail.com
Discussion: https://postgr.es/m/CA+Tgmoaj2aPti0yho7FeEf2qt-JgQPRWb0gci_o1Hfr=C56Xng@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d87251048a0f293ad20cc1fe26ce9f542de105e6

Modified Files
--------------
doc/src/sgml/monitoring.sgml | 8 ++--
src/backend/postmaster/pgstat.c | 3 ++
src/backend/storage/buffer/README | 13 +++----
src/backend/storage/buffer/buf_init.c | 34 +++++++----------
src/backend/storage/buffer/bufmgr.c | 64 +++++++++-----------------------
src/backend/storage/lmgr/lwlock.c | 5 +--
src/include/pgstat.h | 1 +
src/include/storage/buf_internals.h | 8 ++--
src/include/storage/condition_variable.h | 11 ++++++
src/include/storage/lwlock.h | 29 ---------------
src/tools/pgindent/typedefs.list | 1 +
11 files changed, 61 insertions(+), 116 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2021-03-10 22:03:21 pgsql: C comments: improve description of GiST NSN and GistBuildLSN
Previous Message Tom Lane 2021-03-10 19:22:42 pgsql: Avoid creating duplicate cached plans for inherited FK constrain