summaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xact.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r--src/backend/access/transam/xact.c96
1 files changed, 50 insertions, 46 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 1c1121e3e1..fd401e963e 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.131 2002/08/30 22:18:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.132 2002/09/04 20:31:13 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -265,7 +265,6 @@ SetTransactionFlushEnabled(bool state)
{
TransactionFlushState = (state == true);
}
-
#endif
@@ -421,7 +420,7 @@ CommandCounterIncrement(void)
TransactionState s = CurrentTransactionState;
s->commandId += 1;
- if (s->commandId == FirstCommandId) /* check for overflow */
+ if (s->commandId == FirstCommandId) /* check for overflow */
elog(ERROR, "You may only have 2^32-1 commands per transaction");
/* Propagate new command ID into query snapshots, if set */
@@ -517,8 +516,8 @@ void
RecordTransactionCommit(void)
{
/*
- * If we made neither any XLOG entries nor any temp-rel updates,
- * we can omit recording the transaction commit at all.
+ * If we made neither any XLOG entries nor any temp-rel updates, we
+ * can omit recording the transaction commit at all.
*/
if (MyXactMadeXLogEntry || MyXactMadeTempRelUpdate)
{
@@ -531,10 +530,10 @@ RecordTransactionCommit(void)
START_CRIT_SECTION();
/*
- * We only need to log the commit in xlog if the transaction made any
- * transaction-controlled XLOG entries. (Otherwise, its XID appears
- * nowhere in permanent storage, so no one else will ever care if it
- * committed.)
+ * We only need to log the commit in xlog if the transaction made
+ * any transaction-controlled XLOG entries. (Otherwise, its XID
+ * appears nowhere in permanent storage, so no one else will ever
+ * care if it committed.)
*/
if (MyLastRecPtr.xrecoff != 0)
{
@@ -560,20 +559,20 @@ RecordTransactionCommit(void)
}
/*
- * We must flush our XLOG entries to disk if we made any XLOG entries,
- * whether in or out of transaction control. For example, if we
- * reported a nextval() result to the client, this ensures that any
- * XLOG record generated by nextval will hit the disk before we report
- * the transaction committed.
+ * We must flush our XLOG entries to disk if we made any XLOG
+ * entries, whether in or out of transaction control. For
+ * example, if we reported a nextval() result to the client, this
+ * ensures that any XLOG record generated by nextval will hit the
+ * disk before we report the transaction committed.
*/
if (MyXactMadeXLogEntry)
{
/*
* Sleep before flush! So we can flush more than one commit
- * records per single fsync. (The idea is some other backend may
- * do the XLogFlush while we're sleeping. This needs work still,
- * because on most Unixen, the minimum select() delay is 10msec or
- * more, which is way too long.)
+ * records per single fsync. (The idea is some other backend
+ * may do the XLogFlush while we're sleeping. This needs work
+ * still, because on most Unixen, the minimum select() delay
+ * is 10msec or more, which is way too long.)
*
* We do not sleep if enableFsync is not turned on, nor if there
* are fewer than CommitSiblings other backends with active
@@ -593,13 +592,14 @@ RecordTransactionCommit(void)
}
/*
- * We must mark the transaction committed in clog if its XID appears
- * either in permanent rels or in local temporary rels. We test
- * this by seeing if we made transaction-controlled entries *OR*
- * local-rel tuple updates. Note that if we made only the latter,
- * we have not emitted an XLOG record for our commit, and so in the
- * event of a crash the clog update might be lost. This is okay
- * because no one else will ever care whether we committed.
+ * We must mark the transaction committed in clog if its XID
+ * appears either in permanent rels or in local temporary rels.
+ * We test this by seeing if we made transaction-controlled
+ * entries *OR* local-rel tuple updates. Note that if we made
+ * only the latter, we have not emitted an XLOG record for our
+ * commit, and so in the event of a crash the clog update might be
+ * lost. This is okay because no one else will ever care whether
+ * we committed.
*/
if (MyLastRecPtr.xrecoff != 0 || MyXactMadeTempRelUpdate)
TransactionIdCommit(xid);
@@ -628,6 +628,7 @@ AtCommit_Cache(void)
* Clean up the relation cache.
*/
AtEOXact_RelationCache(true);
+
/*
* Make catalog changes visible to all backends.
*/
@@ -698,8 +699,8 @@ RecordTransactionAbort(void)
{
/*
* If we made neither any transaction-controlled XLOG entries nor any
- * temp-rel updates, we can omit recording the transaction abort at all.
- * No one will ever care that it aborted.
+ * temp-rel updates, we can omit recording the transaction abort at
+ * all. No one will ever care that it aborted.
*/
if (MyLastRecPtr.xrecoff != 0 || MyXactMadeTempRelUpdate)
{
@@ -716,11 +717,12 @@ RecordTransactionAbort(void)
START_CRIT_SECTION();
/*
- * We only need to log the abort in XLOG if the transaction made any
- * transaction-controlled XLOG entries. (Otherwise, its XID appears
- * nowhere in permanent storage, so no one else will ever care if it
- * committed.) We do not flush XLOG to disk in any case, since the
- * default assumption after a crash would be that we aborted, anyway.
+ * We only need to log the abort in XLOG if the transaction made
+ * any transaction-controlled XLOG entries. (Otherwise, its XID
+ * appears nowhere in permanent storage, so no one else will ever
+ * care if it committed.) We do not flush XLOG to disk in any
+ * case, since the default assumption after a crash would be that
+ * we aborted, anyway.
*/
if (MyLastRecPtr.xrecoff != 0)
{
@@ -1165,8 +1167,8 @@ StartTransactionCommand(bool preventChain)
TransactionState s = CurrentTransactionState;
/*
- * Remember if caller wants to prevent autocommit-off chaining.
- * This is only allowed if not already in a transaction block.
+ * Remember if caller wants to prevent autocommit-off chaining. This
+ * is only allowed if not already in a transaction block.
*/
suppressChain = preventChain;
if (preventChain && s->blockState != TBLOCK_DEFAULT)
@@ -1260,16 +1262,18 @@ CommitTransactionCommand(bool forceCommit)
{
/*
* If we aren't in a transaction block, and we are doing
- * autocommit, just do our usual transaction commit. But
- * if we aren't doing autocommit, start a transaction block
- * automatically by switching to INPROGRESS state. (We handle
- * this choice here, and not earlier, so that an explicit BEGIN
- * issued in autocommit-off mode won't issue strange warnings.)
+ * autocommit, just do our usual transaction commit. But if
+ * we aren't doing autocommit, start a transaction block
+ * automatically by switching to INPROGRESS state. (We handle
+ * this choice here, and not earlier, so that an explicit
+ * BEGIN issued in autocommit-off mode won't issue strange
+ * warnings.)
*
- * Autocommit mode is forced by either a true forceCommit parameter
- * to me, or a true preventChain parameter to the preceding
- * StartTransactionCommand call. This is needed so that commands
- * like VACUUM can ensure that the right things happen.
+ * Autocommit mode is forced by either a true forceCommit
+ * parameter to me, or a true preventChain parameter to the
+ * preceding StartTransactionCommand call. This is needed so
+ * that commands like VACUUM can ensure that the right things
+ * happen.
*/
case TBLOCK_DEFAULT:
if (autocommit || forceCommit || suppressChain)
@@ -1442,9 +1446,9 @@ BeginTransactionBlock(void)
s->blockState = TBLOCK_BEGIN;
/*
- * do begin processing. NOTE: if you put anything here, check that
- * it behaves properly in both autocommit-on and autocommit-off modes.
- * In the latter case we will already have done some work in the new
+ * do begin processing. NOTE: if you put anything here, check that it
+ * behaves properly in both autocommit-on and autocommit-off modes. In
+ * the latter case we will already have done some work in the new
* transaction.
*/