Fix typo in GetRunningTransactionData()
authorAlexander Korotkov <[email protected]>
Wed, 3 Jul 2024 23:05:27 +0000 (02:05 +0300)
committerAlexander Korotkov <[email protected]>
Wed, 3 Jul 2024 23:05:27 +0000 (02:05 +0300)
e85662df44 made GetRunningTransactionData() calculate the oldest running
transaction id within the current database.  However, because of the typo,
the new code uses oldestRunningXid instead of oldestDatabaseRunningXid
in comparison before updating oldestDatabaseRunningXid.  This commit fixes
that issue.

Reported-by: Noah Misch
Discussion: https://postgr.es/m/20240630231816.bf.nmisch%40google.com
Backpatch-through: 17

src/backend/storage/ipc/procarray.c

index 387b4a405b0bb7ad1b4278ee399a496d9f345e66..9fc930e98f845c461cebc3ceb6eb05456b89ac7f 100644 (file)
@@ -2779,7 +2779,7 @@ GetRunningTransactionData(void)
         * Also, update the oldest running xid within the current database.
         */
        if (proc->databaseId == MyDatabaseId &&
-           TransactionIdPrecedes(xid, oldestRunningXid))
+           TransactionIdPrecedes(xid, oldestDatabaseRunningXid))
            oldestDatabaseRunningXid = xid;
 
        if (ProcGlobal->subxidStates[index].overflowed)