diff options
Diffstat (limited to 'src/backend/access/transam/twophase.c')
-rw-r--r-- | src/backend/access/transam/twophase.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 3d08e92d3a7..6db46c00109 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -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 |