Skip to content

Commit baa2e44

Browse files
committed
check for max_prepared_xacts == 0 before locking GXact
1 parent 52677a6 commit baa2e44

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/backend/access/transam/twophase.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,14 @@ LockGXact(const char *gid, Oid user)
631631
before_shmem_exit(AtProcExit_Twophase, 0);
632632
twophaseExitRegistered = true;
633633
}
634+
635+
/* here we know in advance that there are no prepared transactions */
636+
if (max_prepared_xacts == 0)
637+
ereport(ERROR,
638+
(errcode(ERRCODE_UNDEFINED_OBJECT),
639+
errmsg("prepared transaction with identifier \"%s\" does not exist",
640+
gid)));
641+
634642
MyLockedGxact = NULL;
635643
i = string_hash(gid, 0) % max_prepared_xacts;
636644
Retry:

0 commit comments

Comments
 (0)