Replace buffer I/O locks with condition variables.
authorThomas Munro <tmunro@postgresql.org>
Wed, 10 Mar 2021 21:05:58 +0000 (10:05 +1300)
committerThomas Munro <tmunro@postgresql.org>
Wed, 10 Mar 2021 21:36:17 +0000 (10:36 +1300)
commitd87251048a0f293ad20cc1fe26ce9f542de105e6
treebe55439cbd689abd9073afe447dbb20a2c507941
parentc3ffe34863688115dd7878f118f2a123bafd8a26
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@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.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
doc/src/sgml/monitoring.sgml
src/backend/postmaster/pgstat.c
src/backend/storage/buffer/README
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/lmgr/lwlock.c
src/include/pgstat.h
src/include/storage/buf_internals.h
src/include/storage/condition_variable.h
src/include/storage/lwlock.h
src/tools/pgindent/typedefs.list