From 592da23633e49dd3ad97922d64cdcfc22d219d90 Mon Sep 17 00:00:00 2001 From: Nikhil Sontakke Date: Fri, 4 Aug 2023 14:08:03 +0530 Subject: [PATCH] Fix assert in debug wait points Need to ensure that we should try to take a lock only if a valid transaction is around. Otherwise assert is hit due to an error within an error. Fixes #5917 --- src/debug_point.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/debug_point.c b/src/debug_point.c index 2b8b59318..2f679800a 100644 --- a/src/debug_point.c +++ b/src/debug_point.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -177,6 +178,10 @@ ts_debug_point_wait(const char *name, bool blocking) LockAcquireResult lock_acquire_result pg_attribute_unused(); bool lock_release_result pg_attribute_unused(); + /* Ensure that we are in a transaction before trying for locks */ + if (!IsTransactionState()) + return; + debug_point_init(&point, name); ereport(DEBUG3, (errmsg("waiting on debug point '%s'", point.name)));