aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2023-07-13 13:03:28 -0700
committerAndres Freund <andres@anarazel.de>2023-07-13 13:03:28 -0700
commit83ecfa9fad11448af2cbac6c9f2a03507e6317cf (patch)
tree9ec9269ae89420997589cb4ba271b944a4d9ef3d /src
parent8aac9759bb855a9349ae39944901d25a858b4751 (diff)
downloadpostgresql-83ecfa9fad11448af2cbac6c9f2a03507e6317cf.tar.gz
postgresql-83ecfa9fad11448af2cbac6c9f2a03507e6317cf.zip
Release lock after encountering bogs row in vac_truncate_clog()
When vac_truncate_clog() encounters bogus datfrozenxid / datminmxid values, it returns early. Unfortunately, until now, it did not release WrapLimitsVacuumLock. If the backend later tries to acquire WrapLimitsVacuumLock, the session / autovacuum worker hangs in an uncancellable way. Similarly, other sessions will hang waiting for the lock. However, if the backend holding the lock exited or errored out for some reason, the lock was released. The bug was introduced as a side effect of 566372b3d643. It is interesting that there are no production reports of this problem. That is likely due to a mix of bugs leading to bogus values having gotten less common, process exit releasing locks and instances of hangs being hard to debug for "normal" users. Discussion: https://postgr.es/m/20230621221208.vhsqgduwfpzwxnpg@awork3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/vacuum.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 57ca41add2f..841188f71c0 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -1893,12 +1893,16 @@ vac_truncate_clog(TransactionId frozenXID,
ereport(WARNING,
(errmsg("some databases have not been vacuumed in over 2 billion transactions"),
errdetail("You might have already suffered transaction-wraparound data loss.")));
+ LWLockRelease(WrapLimitsVacuumLock);
return;
}
/* chicken out if data is bogus in any other way */
if (bogus)
+ {
+ LWLockRelease(WrapLimitsVacuumLock);
return;
+ }
/*
* Advance the oldest value for commit timestamps before truncating, so