mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Update comments that became out-of-date with the PGXACT struct.
When the "hot" members of PGPROC were split off to separate PGXACT structs, many PGPROC fields referred to in comments were moved to PGXACT, but the comments were neglected in the commit. Mostly this is just a search/replace of PGPROC with PGXACT, but the way the dummy PGPROC entries are created for prepared transactions changed more, making some of the comments totally bogus. Noah Misch
This commit is contained in:
@@ -21,10 +21,9 @@
|
||||
* GIDs and aborts the transaction if there already is a global
|
||||
* transaction in prepared state with the same GID.
|
||||
*
|
||||
* A global transaction (gxact) also has a dummy PGPROC that is entered
|
||||
* into the ProcArray array; this is what keeps the XID considered
|
||||
* running by TransactionIdIsInProgress. It is also convenient as a
|
||||
* PGPROC to hook the gxact's locks to.
|
||||
* A global transaction (gxact) also has dummy PGXACT and PGPROC; this is
|
||||
* what keeps the XID considered running by TransactionIdIsInProgress.
|
||||
* It is also convenient as a PGPROC to hook the gxact's locks to.
|
||||
*
|
||||
* In order to survive crashes and shutdowns, all prepared
|
||||
* transactions must be stored in permanent storage. This includes
|
||||
@@ -79,11 +78,6 @@ int max_prepared_xacts = 0;
|
||||
* This struct describes one global transaction that is in prepared state
|
||||
* or attempting to become prepared.
|
||||
*
|
||||
* The first component of the struct is a dummy PGPROC that is inserted
|
||||
* into the global ProcArray so that the transaction appears to still be
|
||||
* running and holding locks. It must be first because we cast pointers
|
||||
* to PGPROC and pointers to GlobalTransactionData back and forth.
|
||||
*
|
||||
* The lifecycle of a global transaction is:
|
||||
*
|
||||
* 1. After checking that the requested GID is not in use, set up an
|
||||
@@ -91,7 +85,7 @@ int max_prepared_xacts = 0;
|
||||
* with locking_xid = my own XID and valid = false.
|
||||
*
|
||||
* 2. After successfully completing prepare, set valid = true and enter the
|
||||
* contained PGPROC into the global ProcArray.
|
||||
* referenced PGPROC into the global ProcArray.
|
||||
*
|
||||
* 3. To begin COMMIT PREPARED or ROLLBACK PREPARED, check that the entry
|
||||
* is valid and its locking_xid is no longer active, then store my current
|
||||
@@ -1069,12 +1063,12 @@ EndPrepare(GlobalTransaction gxact)
|
||||
errmsg("could not close two-phase state file: %m")));
|
||||
|
||||
/*
|
||||
* Mark the prepared transaction as valid. As soon as xact.c marks MyProc
|
||||
* Mark the prepared transaction as valid. As soon as xact.c marks MyPgXact
|
||||
* as not running our XID (which it will do immediately after this
|
||||
* function returns), others can commit/rollback the xact.
|
||||
*
|
||||
* NB: a side effect of this is to make a dummy ProcArray entry for the
|
||||
* prepared XID. This must happen before we clear the XID from MyProc,
|
||||
* prepared XID. This must happen before we clear the XID from MyPgXact,
|
||||
* else there is a window where the XID is not running according to
|
||||
* TransactionIdIsInProgress, and onlookers would be entitled to assume
|
||||
* the xact crashed. Instead we have a window where the same XID appears
|
||||
|
||||
Reference in New Issue
Block a user