summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-10-23 10:26:06 +0900
committerMichael Paquier <michael@paquier.xyz>2019-10-23 10:26:06 +0900
commit21c343b903888e8030306f479630746e852fa8f8 (patch)
treec8999e9d2c8a6f39b2c9983ac6ab34a3673ea1ab
parentaebe3ef0e4b32ba2ee0af062d20eedb914d5e2bc (diff)
Clean up properly error_context_stack in autovacuum worker on exception
Any callback set would have no meaning in the context of an exception. As an autovacuum worker exits quickly in this context, this could be only an issue within EmitErrorReport(), where the elog hook is for example called. That's unlikely to going to be a problem, but let's be clean and consistent with other code paths handling exceptions. This is present since 2909419, which introduced autovacuum. Author: Ashwin Agrawal Reviewed-by: Tom Lane, Michael Paquier Discussion: https://postgr.es/m/CALfoeisM+_+dgmAdAOHAu0k-ZpEHHqSSG=GRf3pKJGm8OqWX0w@mail.gmail.com Backpatch-through: 9.4
-rw-r--r--src/backend/postmaster/autovacuum.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index f40147a3477..9d79effa914 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1570,6 +1570,9 @@ AutoVacWorkerMain(int argc, char *argv[])
*/
if (sigsetjmp(local_sigjmp_buf, 1) != 0)
{
+ /* since not using PG_TRY, must reset error stack by hand */
+ error_context_stack = NULL;
+
/* Prevents interrupts while cleaning up */
HOLD_INTERRUPTS();