Skip to content

Commit 68f7fe1

Browse files
Clarify docs on hot standby lock release
Andres Freund and Simon Riggs
1 parent 8f40ad1 commit 68f7fe1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,11 @@ ProcArrayInstallImportedXmin(TransactionId xmin, TransactionId sourcexid)
15641564
* We don't worry about updating other counters, we want to keep this as
15651565
* simple as possible and leave GetSnapshotData() as the primary code for
15661566
* that bookkeeping.
1567+
*
1568+
* Note that if any transaction has overflowed its cached subtransactions
1569+
* then there is no real need include any subtransactions. That isn't a
1570+
* common enough case to worry about optimising the size of the WAL record,
1571+
* and we may wish to see that data for diagnostic purposes anyway.
15671572
*/
15681573
RunningTransactions
15691574
GetRunningTransactionData(void)

src/backend/storage/ipc/standby.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ StandbyTimeoutHandler(void)
540540
* RelationLockList, so we can keep track of the various entries made by
541541
* the Startup process's virtual xid in the shared lock table.
542542
*
543+
* We record the lock against the top-level xid, rather than individual
544+
* subtransaction xids. This means AccessExclusiveLocks held by aborted
545+
* subtransactions are not released as early as possible on standbys.
546+
*
543547
* List elements use type xl_rel_lock, since the WAL record type exactly
544548
* matches the information that we need to keep track of.
545549
*
@@ -673,8 +677,8 @@ StandbyReleaseAllLocks(void)
673677

674678
/*
675679
* StandbyReleaseOldLocks
676-
* Release standby locks held by XIDs that aren't running, as long
677-
* as they're not prepared transactions.
680+
* Release standby locks held by top-level XIDs that aren't running,
681+
* as long as they're not prepared transactions.
678682
*/
679683
void
680684
StandbyReleaseOldLocks(int nxids, TransactionId *xids)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy