postgresql/src/backend/access
Robert Haas 303640199d Fix minor problems with non-exclusive backup cleanup.
The previous coding imagined that it could call before_shmem_exit()
when a non-exclusive backup began and then remove the previously-added
handler by calling cancel_before_shmem_exit() when that backup
ended. However, this only works provided that nothing else in the
system has registered a before_shmem_exit() hook in the interim,
because cancel_before_shmem_exit() is documented to remove a callback
only if it is the latest callback registered. It also only works
if nothing can ERROR out between the time that sessionBackupState
is reset and the time that cancel_before_shmem_exit(), which doesn't
seem to be strictly true.

To fix, leave the handler installed for the lifetime of the session,
arrange to install it just once, and teach it to quietly do nothing if
there isn't a non-exclusive backup in process.

This is a bug, but for now I'm not going to back-patch, because the
consequences are minor. It's possible to cause a spurious warning
to be generated, but that doesn't really matter. It's also possible
to trigger an assertion failure, but production builds shouldn't
have assertions enabled.

Patch by me, reviewed by Kyotaro Horiguchi, Michael Paquier (who
preferred a different approach, but got outvoted), Fujii Masao,
and Tom Lane, and with comments by various others.

Discussion: http://postgr.es/m/CA+TgmobMjnyBfNhGTKQEDbqXYE3_rXWpc4CM63fhyerNCes3mA@mail.gmail.com
2019-12-19 09:06:54 -05:00
..
brin Make the order of the header file includes consistent in backend modules. 2019-11-12 08:30:16 +05:30
common Move heap-specific detoasting logic into a separate function. 2019-12-18 11:08:59 -05:00
gin Fix page modification outside of critical section in GIN 2019-11-20 00:12:33 +03:00
gist Fix yet another crash in page split during GiST index creation. 2019-12-16 13:57:41 +02:00
hash Refactor reloption handling for index AMs in-core 2019-11-25 09:40:53 +09:00
heap Remove duplicated progress reporting during heap scan of VACUUM 2019-12-15 22:05:33 +09:00
index Remove configure --disable-float4-byval 2019-11-21 18:29:21 +01:00
nbtree Rename nbtree tuple macros. 2019-12-16 17:49:45 -08:00
rmgrdesc Remove useless "return;" lines 2019-11-28 16:48:37 -03:00
spgist Refactor reloption handling for index AMs in-core 2019-11-25 09:40:53 +09:00
table Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
tablesample Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
transam Fix minor problems with non-exclusive backup cleanup. 2019-12-19 09:06:54 -05:00
Makefile Introduce access/{table.h, relation.h}, for generic functions from heapam.h. 2019-01-21 10:51:36 -08:00