Skip to content
Snippets Groups Projects
Commit ebf7b2e0 authored by Michael Paquier's avatar Michael Paquier
Browse files

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 29094193, 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
parent e3267407
No related branches found
Tags
No related merge requests found
...@@ -1530,6 +1530,9 @@ AutoVacWorkerMain(int argc, char *argv[]) ...@@ -1530,6 +1530,9 @@ AutoVacWorkerMain(int argc, char *argv[])
*/ */
if (sigsetjmp(local_sigjmp_buf, 1) != 0) 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 */ /* Prevents interrupts while cleaning up */
HOLD_INTERRUPTS(); HOLD_INTERRUPTS();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment