diff options
| author | Bruce Momjian <bruce@momjian.us> | 1997-09-08 02:41:22 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 1997-09-08 02:41:22 +0000 |
| commit | 319dbfa7364721d3343af03a7ce063c2a2c9d385 (patch) | |
| tree | a2146fe02c49ce1e497b7c287dfcaa367a703ae4 /src/backend/access/transam | |
| parent | a90f12fd9d6886da4f0734288496361a304d3882 (diff) | |
| download | postgresql-319dbfa7364721d3343af03a7ce063c2a2c9d385.tar.gz | |
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
Diffstat (limited to 'src/backend/access/transam')
| -rw-r--r-- | src/backend/access/transam/transam.c | 60 | ||||
| -rw-r--r-- | src/backend/access/transam/transsup.c | 114 | ||||
| -rw-r--r-- | src/backend/access/transam/varsup.c | 46 | ||||
| -rw-r--r-- | src/backend/access/transam/xact.c | 476 | ||||
| -rw-r--r-- | src/backend/access/transam/xid.c | 6 |
5 files changed, 351 insertions, 351 deletions
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 6d721fe96a..03b82872fd 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.10 1997/09/07 04:39:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.11 1997/09/08 02:21:14 momjian Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -26,9 +26,9 @@ #include <storage/spin.h> #include <commands/vacuum.h> -static int RecoveryCheckingEnabled(void); -static void TransRecover(Relation logRelation); -static bool TransactionLogTest(TransactionId transactionId, XidStatus status); +static int RecoveryCheckingEnabled(void); +static void TransRecover(Relation logRelation); +static bool TransactionLogTest(TransactionId transactionId, XidStatus status); static void TransactionLogUpdate(TransactionId transactionId, XidStatus status); @@ -40,18 +40,18 @@ TransactionLogUpdate(TransactionId transactionId, * ---------------- */ -Relation LogRelation = (Relation) NULL; -Relation TimeRelation = (Relation) NULL; -Relation VariableRelation = (Relation) NULL; +Relation LogRelation = (Relation) NULL; +Relation TimeRelation = (Relation) NULL; +Relation VariableRelation = (Relation) NULL; /* ---------------- * global variables holding cached transaction id's and statuses. * ---------------- */ -TransactionId cachedGetCommitTimeXid; -AbsoluteTime cachedGetCommitTime; -TransactionId cachedTestXid; -XidStatus cachedTestXidStatus; +TransactionId cachedGetCommitTimeXid; +AbsoluteTime cachedGetCommitTime; +TransactionId cachedTestXid; +XidStatus cachedTestXidStatus; /* ---------------- * transaction system constants @@ -65,11 +65,11 @@ XidStatus cachedTestXidStatus; * FirstTransactionId. -cim 3/23/90 * ---------------------------------------------------------------- */ -TransactionId NullTransactionId = (TransactionId) 0; +TransactionId NullTransactionId = (TransactionId) 0; -TransactionId AmiTransactionId = (TransactionId) 512; +TransactionId AmiTransactionId = (TransactionId) 512; -TransactionId FirstTransactionId = (TransactionId) 514; +TransactionId FirstTransactionId = (TransactionId) 514; /* ---------------- * transaction recovery state variables @@ -83,19 +83,19 @@ TransactionId FirstTransactionId = (TransactionId) 514; * goes from zero to one. -cim 3/21/90 * ---------------- */ -int RecoveryCheckingEnableState = 0; +int RecoveryCheckingEnableState = 0; /* ------------------ * spinlock for oid generation * ----------------- */ -extern int OidGenLockId; +extern int OidGenLockId; /* ---------------- * globals that must be reset at abort * ---------------- */ -extern bool BuildingBtree; +extern bool BuildingBtree; /* ---------------- @@ -134,14 +134,14 @@ SetRecoveryCheckingEnabled(bool state) * -------------------------------- */ -static bool /* true/false: does transaction id have +static bool /* true/false: does transaction id have * specified status? */ TransactionLogTest(TransactionId transactionId, /* transaction id to test */ XidStatus status) /* transaction status */ { - BlockNumber blockNumber; - XidStatus xidstatus; /* recorded status of xid */ - bool fail = false; /* success/failure */ + BlockNumber blockNumber; + XidStatus xidstatus; /* recorded status of xid */ + bool fail = false; /* success/failure */ /* ---------------- * during initialization consider all transactions @@ -202,9 +202,9 @@ static void TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ XidStatus status) /* new trans status */ { - BlockNumber blockNumber; - bool fail = false; /* success/failure */ - AbsoluteTime currentTime;/* time of this transaction */ + BlockNumber blockNumber; + bool fail = false; /* success/failure */ + AbsoluteTime currentTime; /* time of this transaction */ /* ---------------- * during initialization we don't record any updates. @@ -276,9 +276,9 @@ AbsoluteTime /* commit time of transaction id */ TransactionIdGetCommitTime(TransactionId transactionId) /* transaction id to * test */ { - BlockNumber blockNumber; - AbsoluteTime commitTime; /* commit time */ - bool fail = false; /* success/failure */ + BlockNumber blockNumber; + AbsoluteTime commitTime; /* commit time */ + bool fail = false; /* success/failure */ /* ---------------- * return invalid if we aren't running yet... @@ -471,9 +471,9 @@ TransRecover(Relation logRelation) void InitializeTransactionLog(void) { - Relation logRelation; - Relation timeRelation; - MemoryContext oldContext; + Relation logRelation; + Relation timeRelation; + MemoryContext oldContext; /* ---------------- * don't do anything during bootstrapping diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c index 9809190c94..acdfe93ea9 100644 --- a/src/backend/access/transam/transsup.c +++ b/src/backend/access/transam/transsup.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.10 1997/09/07 04:39:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.11 1997/09/08 02:21:18 momjian Exp $ * * NOTES * This file contains support functions for the high @@ -63,7 +63,7 @@ TransComputeBlockNumber(Relation relation, /* relation to test */ * test */ BlockNumber * blockNumberOutP) { - long itemsPerBlock = 0; + long itemsPerBlock = 0; /* ---------------- * we calculate the block number of our transaction @@ -108,17 +108,17 @@ TransComputeBlockNumber(Relation relation, /* relation to test */ */ #ifdef NOT_USED -static XidStatus +static XidStatus TransBlockGetLastTransactionIdStatus(Block tblock, TransactionId baseXid, TransactionId * returnXidP) { - Index index; - Index maxIndex; - bits8 bit1; - bits8 bit2; - BitIndex offset; - XidStatus xstatus; + Index index; + Index maxIndex; + bits8 bit1; + bits8 bit2; + BitIndex offset; + XidStatus xstatus; /* ---------------- * sanity check @@ -188,14 +188,14 @@ TransBlockGetLastTransactionIdStatus(Block tblock, * -------------------------------- */ -static XidStatus +static XidStatus TransBlockGetXidStatus(Block tblock, TransactionId transactionId) { - Index index; - bits8 bit1; - bits8 bit2; - BitIndex offset; + Index index; + bits8 bit1; + bits8 bit2; + BitIndex offset; /* ---------------- * sanity check @@ -245,8 +245,8 @@ TransBlockSetXidStatus(Block tblock, TransactionId transactionId, XidStatus xstatus) { - Index index; - BitIndex offset; + Index index; + BitIndex offset; /* ---------------- * sanity check @@ -275,23 +275,23 @@ TransBlockSetXidStatus(Block tblock, */ switch (xstatus) { - case XID_COMMIT: /* set 10 */ - BitArraySetBit((BitArray) tblock, offset); - BitArrayClearBit((BitArray) tblock, offset + 1); - break; - case XID_ABORT: /* set 01 */ - BitArrayClearBit((BitArray) tblock, offset); - BitArraySetBit((BitArray) tblock, offset + 1); - break; - case XID_INPROGRESS: /* set 00 */ - BitArrayClearBit((BitArray) tblock, offset); - BitArrayClearBit((BitArray) tblock, offset + 1); - break; - default: - elog(NOTICE, - "TransBlockSetXidStatus: invalid status: %d (ignored)", - xstatus); - break; + case XID_COMMIT: /* set 10 */ + BitArraySetBit((BitArray) tblock, offset); + BitArrayClearBit((BitArray) tblock, offset + 1); + break; + case XID_ABORT: /* set 01 */ + BitArrayClearBit((BitArray) tblock, offset); + BitArraySetBit((BitArray) tblock, offset + 1); + break; + case XID_INPROGRESS: /* set 00 */ + BitArrayClearBit((BitArray) tblock, offset); + BitArrayClearBit((BitArray) tblock, offset + 1); + break; + default: + elog(NOTICE, + "TransBlockSetXidStatus: invalid status: %d (ignored)", + xstatus); + break; } } @@ -302,12 +302,12 @@ TransBlockSetXidStatus(Block tblock, * specified transaction id in the trans block. * -------------------------------- */ -static AbsoluteTime +static AbsoluteTime TransBlockGetCommitTime(Block tblock, TransactionId transactionId) { - Index index; - AbsoluteTime *timeArray; + Index index; + AbsoluteTime *timeArray; /* ---------------- * sanity check @@ -348,8 +348,8 @@ TransBlockSetCommitTime(Block tblock, TransactionId transactionId, AbsoluteTime commitTime) { - Index index; - AbsoluteTime *timeArray; + Index index; + AbsoluteTime *timeArray; /* ---------------- * sanity check @@ -394,10 +394,10 @@ TransBlockNumberGetXidStatus(Relation relation, TransactionId xid, bool * failP) { - Buffer buffer; /* buffer associated with block */ - Block block; /* block containing xstatus */ - XidStatus xstatus; /* recorded status of xid */ - bool localfail; /* bool used if failP = NULL */ + Buffer buffer; /* buffer associated with block */ + Block block; /* block containing xstatus */ + XidStatus xstatus; /* recorded status of xid */ + bool localfail; /* bool used if failP = NULL */ /* ---------------- * SOMEDAY place a read lock on the log relation @@ -451,9 +451,9 @@ TransBlockNumberSetXidStatus(Relation relation, XidStatus xstatus, bool * failP) { - Buffer buffer; /* buffer associated with block */ - Block block; /* block containing xstatus */ - bool localfail; /* bool used if failP = NULL */ + Buffer buffer; /* buffer associated with block */ + Block block; /* block containing xstatus */ + bool localfail; /* bool used if failP = NULL */ /* ---------------- * SOMEDAY gain exclusive access to the log relation @@ -504,10 +504,10 @@ TransBlockNumberGetCommitTime(Relation relation, TransactionId xid, bool * failP) { - Buffer buffer; /* buffer associated with block */ - Block block; /* block containing commit time */ - bool localfail; /* bool used if failP = NULL */ - AbsoluteTime xtime; /* commit time */ + Buffer buffer; /* buffer associated with block */ + Block block; /* block containing commit time */ + bool localfail; /* bool used if failP = NULL */ + AbsoluteTime xtime; /* commit time */ /* ---------------- * SOMEDAY place a read lock on the time relation @@ -565,9 +565,9 @@ TransBlockNumberSetCommitTime(Relation relation, AbsoluteTime xtime, bool * failP) { - Buffer buffer; /* buffer associated with block */ - Block block; /* block containing commit time */ - bool localfail; /* bool used if failP = NULL */ + Buffer buffer; /* buffer associated with block */ + Block block; /* block containing commit time */ + bool localfail; /* bool used if failP = NULL */ /* ---------------- * SOMEDAY gain exclusive access to the time relation @@ -620,11 +620,11 @@ TransGetLastRecordedTransaction(Relation relation, * id */ bool * failP) { - BlockNumber blockNumber;/* block number */ - Buffer buffer; /* buffer associated with block */ - Block block; /* block containing xid status */ - BlockNumber n; /* number of blocks in the relation */ - TransactionId baseXid; + BlockNumber blockNumber; /* block number */ + Buffer buffer; /* buffer associated with block */ + Block block; /* block containing xid status */ + BlockNumber n; /* number of blocks in the relation */ + TransactionId baseXid; (*failP) = false; diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 8b4b8557eb..fb44b210be 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.10 1997/09/07 04:39:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.11 1997/09/08 02:21:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,18 +20,18 @@ #include <access/heapam.h> #include <catalog/catname.h> -static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size); -static void VariableRelationGetNextOid(Oid * oid_return); -static void VariableRelationGetNextXid(TransactionId * xidP); -static void VariableRelationPutLastXid(TransactionId xid); -static void VariableRelationPutNextOid(Oid * oidP); -static void VariableRelationGetLastXid(TransactionId * xidP); +static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size); +static void VariableRelationGetNextOid(Oid * oid_return); +static void VariableRelationGetNextXid(TransactionId * xidP); +static void VariableRelationPutLastXid(TransactionId xid); +static void VariableRelationPutNextOid(Oid * oidP); +static void VariableRelationGetLastXid(TransactionId * xidP); /* --------------------- * spin lock for oid generation * --------------------- */ -int OidGenLockId; +int OidGenLockId; /* ---------------------------------------------------------------- * variable relation query/update routines @@ -45,7 +45,7 @@ int OidGenLockId; static void VariableRelationGetNextXid(TransactionId * xidP) { - Buffer buf; + Buffer buf; VariableRelationContents var; /* ---------------- @@ -87,7 +87,7 @@ VariableRelationGetNextXid(TransactionId * xidP) static void VariableRelationGetLastXid(TransactionId * xidP) { - Buffer buf; + Buffer buf; VariableRelationContents var; /* ---------------- @@ -130,9 +130,9 @@ VariableRelationGetLastXid(TransactionId * xidP) void VariableRelationPutNextXid(TransactionId xid) { - Buffer buf; + Buffer buf; VariableRelationContents var; - int flushmode; + int flushmode; /* ---------------- * We assume that a spinlock has been acquire to guarantee @@ -176,7 +176,7 @@ VariableRelationPutNextXid(TransactionId xid) static void VariableRelationPutLastXid(TransactionId xid) { - Buffer buf; + Buffer buf; VariableRelationContents var; /* ---------------- @@ -219,7 +219,7 @@ VariableRelationPutLastXid(TransactionId xid) static void VariableRelationGetNextOid(Oid * oid_return) { - Buffer buf; + Buffer buf; VariableRelationContents var; /* ---------------- @@ -289,7 +289,7 @@ VariableRelationGetNextOid(Oid * oid_return) static void VariableRelationPutNextOid(Oid * oidP) { - Buffer buf; + Buffer buf; VariableRelationContents var; /* ---------------- @@ -383,13 +383,13 @@ VariableRelationPutNextOid(Oid * oidP) #define VAR_XID_PREFETCH 32 -static int prefetched_xid_count = 0; +static int prefetched_xid_count = 0; static TransactionId next_prefetched_xid; void GetNewTransactionId(TransactionId * xid) { - TransactionId nextid; + TransactionId nextid; /* ---------------- * during bootstrap initialization, we return the special @@ -457,7 +457,7 @@ GetNewTransactionId(TransactionId * xid) void UpdateLastCommittedXid(TransactionId xid) { - TransactionId lastid; + TransactionId lastid; /* @@ -501,7 +501,7 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object * id */ int oid_block_size) /* number of oids desired */ { - Oid nextoid; + Oid nextoid; /* ---------------- * SOMEDAY obtain exclusive access to the variable relation page @@ -554,8 +554,8 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object #define VAR_OID_PREFETCH 32 -static int prefetched_oid_count = 0; -static Oid next_prefetched_oid; +static int prefetched_oid_count = 0; +static Oid next_prefetched_oid; void GetNewObjectId(Oid * oid_return)/* place to return the new object id */ @@ -568,7 +568,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */ if (prefetched_oid_count == 0) { - int oid_block_size = VAR_OID_PREFETCH; + int oid_block_size = VAR_OID_PREFETCH; /* ---------------- * during bootstrap time, we want to allocate oids @@ -609,7 +609,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */ void CheckMaxObjectId(Oid assigned_oid) { - Oid pass_oid; + Oid pass_oid; if (prefetched_oid_count == 0) /* make sure next/max is set, or diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index da32570d87..b6ff2dd296 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.14 1997/09/07 04:39:38 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.15 1997/09/08 02:21:22 momjian Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -151,20 +151,20 @@ #include <commands/async.h> #include <commands/sequence.h> -static void AbortTransaction(void); -static void AtAbort_Cache(void); -static void AtAbort_Locks(void); -static void AtAbort_Memory(void); -static void AtCommit_Cache(void); -static void AtCommit_Locks(void); -static void AtCommit_Memory(void); -static void AtStart_Cache(void); -static void AtStart_Locks(void); -static void AtStart_Memory(void); -static void CommitTransaction(void); -static void RecordTransactionAbort(void); -static void RecordTransactionCommit(void); -static void StartTransaction(void); +static void AbortTransaction(void); +static void AtAbort_Cache(void); +static void AtAbort_Locks(void); +static void AtAbort_Memory(void); +static void AtCommit_Cache(void); +static void AtCommit_Locks(void); +static void AtCommit_Memory(void); +static void AtStart_Cache(void); +static void AtStart_Locks(void); +static void AtStart_Memory(void); +static void CommitTransaction(void); +static void RecordTransactionAbort(void); +static void RecordTransactionCommit(void); +static void StartTransaction(void); /* ---------------- * global variables holding the current transaction state. @@ -202,17 +202,17 @@ TransactionState CurrentTransactionState = * V1 transaction system. -cim 3/18/90 * ---------------- */ -TransactionId DisabledTransactionId = (TransactionId) - 1; +TransactionId DisabledTransactionId = (TransactionId) - 1; -CommandId DisabledCommandId = (CommandId) - 1; +CommandId DisabledCommandId = (CommandId) - 1; -AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */ +AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */ /* ---------------- * overflow flag * ---------------- */ -bool CommandIdCounterOverflowFlag; +bool CommandIdCounterOverflowFlag; /* ---------------- * catalog creation transaction bootstrapping flag. @@ -220,7 +220,7 @@ bool CommandIdCounterOverflowFlag; * state stuff. -cim 3/19/90 * ---------------- */ -bool AMI_OVERRIDE = false; +bool AMI_OVERRIDE = false; /* ---------------------------------------------------------------- * transaction state accessors @@ -239,7 +239,7 @@ bool AMI_OVERRIDE = false; * only do writes as necessary. * -------------------------------- */ -static int TransactionFlushState = 1; +static int TransactionFlushState = 1; int TransactionFlushEnabled(void) @@ -270,18 +270,18 @@ IsTransactionState(void) switch (s->state) { - case TRANS_DEFAULT: - return false; - case TRANS_START: - return true; - case TRANS_INPROGRESS: - return true; - case TRANS_COMMIT: - return true; - case TRANS_ABORT: - return true; - case TRANS_DISABLED: - return false; + case TRANS_DEFAULT: + return false; + case TRANS_START: + return true; + case TRANS_INPROGRESS: + return true; + case TRANS_COMMIT: + return true; + case TRANS_ABORT: + return true; + case TRANS_DISABLED: + return false; } /* @@ -317,7 +317,7 @@ IsAbortedTransactionBlockState() * themselves. * -------------------------------- */ -int SavedTransactionState; +int SavedTransactionState; void OverrideTransactionSystem(bool flag) @@ -564,8 +564,8 @@ AtStart_Locks() static void AtStart_Memory() { - Portal portal; - MemoryContext portalContext; + Portal portal; + MemoryContext portalContext; /* ---------------- * get the blank portal and its memory context @@ -601,8 +601,8 @@ AtStart_Memory() static void RecordTransactionCommit() { - TransactionId xid; - int leak; + TransactionId xid; + int leak; /* ---------------- * get the current transaction id @@ -701,7 +701,7 @@ AtCommit_Memory() static void RecordTransactionAbort() { - TransactionId xid; + TransactionId xid; /* ---------------- * get the current transaction id @@ -994,73 +994,73 @@ StartTransactionCommand() switch (s->blockState) { - /* ---------------- - * if we aren't in a transaction block, we - * just do our usual start transaction. - * ---------------- - */ - case TBLOCK_DEFAULT: - StartTransaction(); - break; - - /* ---------------- - * We should never experience this -- if we do it - * means the BEGIN state was not changed in the previous - * CommitTransactionCommand(). If we get it, we print - * a warning and change to the in-progress state. - * ---------------- - */ - case TBLOCK_BEGIN: - elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN"); - s->blockState = TBLOCK_INPROGRESS; - break; - - /* ---------------- - * This is the case when are somewhere in a transaction - * block and about to start a new command. For now we - * do nothing but someday we may do command-local resource - * initialization. - * ---------------- - */ - case TBLOCK_INPROGRESS: - break; - - /* ---------------- - * As with BEGIN, we should never experience this -- - * if we do it means the END state was not changed in the - * previous CommitTransactionCommand(). If we get it, we - * print a warning, commit the transaction, start a new - * transaction and change to the default state. - * ---------------- - */ - case TBLOCK_END: - elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END"); - s->blockState = TBLOCK_DEFAULT; - CommitTransaction(); - StartTransaction(); - break; - - /* ---------------- - * Here we are in the middle of a transaction block but - * one of the commands caused an abort so we do nothing - * but remain in the abort state. Eventually we will get - * to the "END TRANSACTION" which will set things straight. - * ---------------- - */ - case TBLOCK_ABORT: - break; - - /* ---------------- - * This means we somehow aborted and the last call to - * CommitTransactionCommand() didn't clear the state so - * we remain in the ENDABORT state and mabey next time - * we get to CommitTransactionCommand() the state will - * get reset to default. - * ---------------- - */ - case TBLOCK_ENDABORT: - elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT"); - break; + /* ---------------- + * if we aren't in a transaction block, we + * just do our usual start transaction. + * ---------------- + */ + case TBLOCK_DEFAULT: + StartTransaction(); + break; + + /* ---------------- + * We should never experience this -- if we do it + * means the BEGIN state was not changed in the previous + * CommitTransactionCommand(). If we get it, we print + * a warning and change to the in-progress state. + * ---------------- + */ + case TBLOCK_BEGIN: + elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN"); + s->blockState = TBLOCK_INPROGRESS; + break; + + /* ---------------- + * This is the case when are somewhere in a transaction + * block and about to start a new command. For now we + * do nothing but someday we may do command-local resource + * initialization. + * ---------------- + */ + case TBLOCK_INPROGRESS: + break; + + /* ---------------- + * As with BEGIN, we should never experience this -- + * if we do it means the END state was not changed in the + * previous CommitTransactionCommand(). If we get it, we + * print a warning, commit the transaction, start a new + * transaction and change to the default state. + * ---------------- + */ + case TBLOCK_END: + elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END"); + s->blockState = TBLOCK_DEFAULT; + CommitTransaction(); + StartTransaction(); + break; + + /* ---------------- + * Here we are in the middle of a transaction block but + * one of the commands caused an abort so we do nothing + * but remain in the abort state. Eventually we will get + * to the "END TRANSACTION" which will set things straight. + * ---------------- + */ + case TBLOCK_ABORT: + break; + + /* ---------------- + * This means we somehow aborted and the last call to + * CommitTransactionCommand() didn't clear the state so + * we remain in the ENDABORT state and mabey next time + * we get to CommitTransactionCommand() the state will + * get reset to default. + * ---------------- + */ + case TBLOCK_ENDABORT: + elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT"); + break; } } @@ -1075,75 +1075,75 @@ CommitTransactionCommand() switch (s->blockState) { - /* ---------------- - * if we aren't in a transaction block, we - * just do our usual transaction commit - * ---------------- - */ - case TBLOCK_DEFAULT: - CommitTransaction(); - break; - - /* ---------------- - * This is the case right after we get a "BEGIN TRANSACTION" - * command, but the user hasn't done anything else yet, so - * we change to the "transaction block in progress" state - * and return. - * ---------------- - */ - case TBLOCK_BEGIN: - s->blockState = TBLOCK_INPROGRESS; - break; - - /* ---------------- - * This is the case when we have finished executing a command - * someplace within a transaction block. We increment the - * command counter and return. Someday we may free resources - * local to the command. - * - * That someday is today, at least for memory allocated by - * command in the BlankPortal' HeapMemory context. - * - vadim 03/25/97 - * ---------------- - */ - case TBLOCK_INPROGRESS: - CommandCounterIncrement(); + /* ---------------- + * if we aren't in a transaction block, we + * just do our usual transaction commit + * ---------------- + */ + case TBLOCK_DEFAULT: + CommitTransaction(); + break; + + /* ---------------- + * This is the case right after we get a "BEGIN TRANSACTION" + * command, but the user hasn't done anything else yet, so + * we change to the "transaction block in progress" state + * and return. + * ---------------- + */ + case TBLOCK_BEGIN: + s->blockState = TBLOCK_INPROGRESS; + break; + + /* ---------------- + * This is the case when we have finished executing a command + * someplace within a transaction block. We increment the + * command counter and return. Someday we may free resources + * local to the command. + * + * That someday is today, at least for memory allocated by + * command in the BlankPortal' HeapMemory context. + * - vadim 03/25/97 + * ---------------- + */ + case TBLOCK_INPROGRESS: + CommandCounterIncrement(); #ifdef TBL_FREE_CMD_MEMORY - EndPortalAllocMode(); - StartPortalAllocMode(DefaultAllocMode, 0); + EndPortalAllocMode(); + StartPortalAllocMode(DefaultAllocMode, 0); #endif - break; - - /* ---------------- - * This is the case when we just got the "END TRANSACTION" - * statement, so we go back to the default state and - * commit the transaction. - * ---------------- - */ - case TBLOCK_END: - s->blockState = TBLOCK_DEFAULT; - CommitTransaction(); - break; - - /* ---------------- - * Here we are in the middle of a transaction block but - * one of the commands caused an abort so we do nothing - * but remain in the abort state. Eventually we will get - * to the "END TRANSACTION" which will set things straight. - * ---------------- - */ - case TBLOCK_ABORT: - break; - - /* ---------------- - * Here we were in an aborted transaction block which - * just processed the "END TRANSACTION" command from the - * user, so now we return the to default state. - * ---------------- - */ - case TBLOCK_ENDABORT: - s->blockState = TBLOCK_DEFAULT; - break; + break; + + /* ---------------- + * This is the case when we just got the "END TRANSACTION" + * statement, so we go back to the default state and + * commit the transaction. + * ---------------- + */ + case TBLOCK_END: + s->blockState = TBLOCK_DEFAULT; + CommitTransaction(); + break; + + /* ---------------- + * Here we are in the middle of a transaction block but + * one of the commands caused an abort so we do nothing + * but remain in the abort state. Eventually we will get + * to the "END TRANSACTION" which will set things straight. + * ---------------- + */ + case TBLOCK_ABORT: + break; + + /* ---------------- + * Here we were in an aborted transaction block which + * just processed the "END TRANSACTION" command from the + * user, so now we return the to default state. + * ---------------- + */ + case TBLOCK_ENDABORT: + s->blockState = TBLOCK_DEFAULT; + break; } } @@ -1158,71 +1158,71 @@ AbortCurrentTransaction() switch (s->blockState) { - /* ---------------- - * if we aren't in a transaction block, we - * just do our usual abort transaction. - * ---------------- - */ - case TBLOCK_DEFAULT: - AbortTransaction(); - break; - - /* ---------------- - * If we are in the TBLOCK_BEGIN it means something - * screwed up right after reading "BEGIN TRANSACTION" - * so we enter the abort state. Eventually an "END - * TRANSACTION" will fix things. - * ---------------- - */ - case TBLOCK_BEGIN: - s->blockState = TBLOCK_ABORT; - AbortTransaction(); - break; - - /* ---------------- - * This is the case when are somewhere in a transaction - * block which aborted so we abort the transaction and - * set the ABORT state. Eventually an "END TRANSACTION" - * will fix things and restore us to a normal state. - * ---------------- - */ - case TBLOCK_INPROGRESS: - s->blockState = TBLOCK_ABORT; - AbortTransaction(); - break; - - /* ---------------- - * Here, the system was fouled up just after the - * user wanted to end the transaction block so we - * abort the transaction and put us back into the - * default state. - * ---------------- - */ - case TBLOCK_END: - s->blockState = TBLOCK_DEFAULT; - AbortTransaction(); - break; - - /* ---------------- - * Here, we are already in an aborted transaction - * state and are waiting for an "END TRANSACTION" to - * come along and lo and behold, we abort again! - * So we just remain in the abort state. - * ---------------- - */ - case TBLOCK_ABORT: - break; - - /* ---------------- - * Here we were in an aborted transaction block which - * just processed the "END TRANSACTION" command but somehow - * aborted again.. since we must have done the abort - * processing, we return to the default state. - * ---------------- - */ - case TBLOCK_ENDABORT: - s->blockState = TBLOCK_DEFAULT; - break; + /* ---------------- + * if we aren't in a transaction block, we + * just do our usual abort transaction. + * ---------------- + */ + case TBLOCK_DEFAULT: + AbortTransaction(); + break; + + /* ---------------- + * If we are in the TBLOCK_BEGIN it means something + * screwed up right after reading "BEGIN TRANSACTION" + * so we enter the abort state. Eventually an "END + * TRANSACTION" will fix things. + * ---------------- + */ + case TBLOCK_BEGIN: + s->blockState = TBLOCK_ABORT; + AbortTransaction(); + break; + + /* ---------------- + * This is the case when are somewhere in a transaction + * block which aborted so we abort the transaction and + * set the ABORT state. Eventually an "END TRANSACTION" + * will fix things and restore us to a normal state. + * ---------------- + */ + case TBLOCK_INPROGRESS: + s->blockState = TBLOCK_ABORT; + AbortTransaction(); + break; + + /* ---------------- + * Here, the system was fouled up just after the + * user wanted to end the transaction block so we + * abort the transaction and put us back into the + * default state. + * ---------------- + */ + case TBLOCK_END: + s->blockState = TBLOCK_DEFAULT; + AbortTransaction(); + break; + + /* ---------------- + * Here, we are already in an aborted transaction + * state and are waiting for an "END TRANSACTION" to + * come along and lo and behold, we abort again! + * So we just remain in the abort state. + * ---------------- + */ + case TBLOCK_ABORT: + break; + + /* ---------------- + * Here we were in an aborted transaction block which + * just processed the "END TRANSACTION" command but somehow + * aborted again.. since we must have done the abort + * processing, we return to the default state. + * ---------------- + */ + case TBLOCK_ENDABORT: + s->blockState = TBLOCK_DEFAULT; + break; } } diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c index 910d6ac732..9cfc8235d4 100644 --- a/src/backend/access/transam/xid.c +++ b/src/backend/access/transam/xid.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.8 1997/09/07 04:39:40 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.9 1997/09/08 02:21:24 momjian Exp $ * * OLD COMMENTS * XXX WARNING @@ -50,11 +50,11 @@ xidin(char *representation) } /* XXX char16 name for catalogs */ -char * +char * xidout(TransactionId transactionId) { /* return(TransactionIdFormString(transactionId)); */ - char *representation; + char *representation; /* maximum 32 bit unsigned integer representation takes 10 chars */ representation = palloc(11); |
