Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4f0660

Browse files
committed
Fix autovacuum launcher attachment to its DSA
The autovacuum launcher doesn't actually do anything with its DSA other than creating it and attaching to it, but it's been observed that after longjmp'ing to the standard error handling block (for example after getting SIGINT) the autovacuum enters an infinite loop reporting that it cannot attach to its DSA anymore (which is correct, because it's already attached to it.) Fix by only attempting to attach if not already attached. I introduced this bug together with BRIN autosummarization in 7526e10. Reported-by: Yugo Nagata. Author: Thomas Munro. I added the comment to go with it. Discussion: https://postgr.es/m/[email protected]
1 parent 2a6db5e commit a4f0660

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/postmaster/autovacuum.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ AutoVacLauncherMain(int argc, char *argv[])
612612

613613
/*
614614
* Set up our DSA so that backends can install work-item requests. It may
615-
* already exist as created by a previous launcher.
615+
* already exist as created by a previous launcher; and we may even be
616+
* already attached to it, if we're here after longjmp'ing above.
616617
*/
617618
if (!AutoVacuumShmem->av_dsa_handle)
618619
{
@@ -626,7 +627,7 @@ AutoVacLauncherMain(int argc, char *argv[])
626627
AutoVacuumShmem->av_workitems = InvalidDsaPointer;
627628
LWLockRelease(AutovacuumLock);
628629
}
629-
else
630+
else if (AutoVacuumDSA == NULL)
630631
{
631632
AutoVacuumDSA = dsa_attach(AutoVacuumShmem->av_dsa_handle);
632633
dsa_pin_mapping(AutoVacuumDSA);

0 commit comments

Comments
 (0)