aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/variable.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2024-04-02 22:28:11 -0500
committerNathan Bossart <nathan@postgresql.org>2024-04-02 22:28:11 -0500
commitc627d944e6c2620fb3b28f2e4b27e19212f84045 (patch)
tree6f7c99617576ec8332ad0287bc9a37f83f8fe8af /src/backend/commands/variable.c
parent5bec1d6bc5e3ee44a229228a2749567eb2ab7beb (diff)
downloadpostgresql-c627d944e6c2620fb3b28f2e4b27e19212f84045.tar.gz
postgresql-c627d944e6c2620fb3b28f2e4b27e19212f84045.zip
Add built-in ERROR handling for archive callbacks.
Presently, the archiver process restarts when an archive callback ERRORs. To avoid this, archive module authors can use sigsetjmp(), manage a memory context, etc., but that requires a lot of extra code that will likely look roughly the same between modules. This commit adds basic archive callback ERROR handling to pgarch.c so that module authors won't ordinarily need to worry about this. While this built-in handler attempts to clean up anything that an archive module could conceivably have left behind, it is possible that some modules are doing unexpected things that require additional cleanup. Module authors should be sure to do any extra required cleanup in a PG_CATCH block within the archiving callback. The archiving callback is now called in a short-lived memory context that the archiver process resets between invocations. If a module requires longer-lived storage, it must maintain its own memory context. Thanks to these changes, the basic_archive module can be greatly simplified. Suggested-by: Andres Freund Reviewed-by: Andres Freund, Yong Li Discussion: https://postgr.es/m/20230217215624.GA3131134%40nathanxps13
Diffstat (limited to 'src/backend/commands/variable.c')
0 files changed, 0 insertions, 0 deletions