aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-02-25 16:58:48 -0800
committerAndres Freund <andres@anarazel.de>2022-02-25 17:04:39 -0800
commitfe0972ee5e6f8a663c5cf3f24ef98987c503da95 (patch)
tree6e631076d93f18709b1a73e7a9eb719bbcff955d /src/backend/utils/init
parent638300fef541fb9393caa1ee8821a639816301d1 (diff)
downloadpostgresql-fe0972ee5e6f8a663c5cf3f24ef98987c503da95.tar.gz
postgresql-fe0972ee5e6f8a663c5cf3f24ef98987c503da95.zip
Add further debug info to help debug 019_replslot_limit.pl failures.
See also afdeff10526. Failures after that commit provided a few more hints, but not yet enough to understand what's going on. In 019_replslot_limit.pl shut down nodes with fast instead of immediate mode if we observe the failure mode. That should tell us whether the failures we're observing are just a timing issue under high load. PGCTLTIMEOUT should prevent buildfarm animals from hanging endlessly. Also adds a bit more logging to replication slot drop and ShutdownPostgres(). Discussion: https://postgr.es/m/20220225192941.hqnvefgdzaro6gzg@alap3.anarazel.de
Diffstat (limited to 'src/backend/utils/init')
-rw-r--r--src/backend/utils/init/postinit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index a29fa0b3e6a..86d193c89fc 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -1262,6 +1262,23 @@ ShutdownPostgres(int code, Datum arg)
* them explicitly.
*/
LockReleaseAll(USER_LOCKMETHOD, true);
+
+ /*
+ * temp debugging aid to analyze 019_replslot_limit failures
+ *
+ * If an error were thrown outside of a transaction nothing up to now
+ * would have released lwlocks. We probably will add an
+ * LWLockReleaseAll(). But for now make it easier to understand such cases
+ * by warning if any lwlocks are held.
+ */
+#ifdef USE_ASSERT_CHECKING
+ {
+ int held_lwlocks = LWLockHeldCount();
+ if (held_lwlocks)
+ elog(WARNING, "holding %d lwlocks at the end of ShutdownPostgres()",
+ held_lwlocks);
+ }
+#endif
}