Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57eeb0d

Browse files
committed
New memmgr logic in xact.c failed if AbortTransaction() is called when
there is no open transaction.
1 parente225260 commit57eeb0d

File tree

1 file changed

+21
-10
lines changed
  • src/backend/access/transam

1 file changed

+21
-10
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.68 2000/06/28 03:31:05 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.69 2000/07/02 02:28:38 tgl Exp $
1212
*
1313
* NOTES
1414
*Transaction aborts can now occur two ways:
@@ -749,6 +749,7 @@ AtCommit_Memory()
749749
*Release all transaction-local memory.
750750
* ----------------
751751
*/
752+
Assert(TopTransactionContext!=NULL);
752753
MemoryContextDelete(TopTransactionContext);
753754
TopTransactionContext=NULL;
754755
TransactionCommandContext=NULL;
@@ -825,17 +826,26 @@ AtAbort_Memory()
825826
{
826827
/* ----------------
827828
*Make sure we are in a valid context (not a child of
828-
*TransactionCommandContext...)
829+
*TransactionCommandContext...). Note that it is possible
830+
*for this code to be called when we aren't in a transaction
831+
*at all; go directly to TopMemoryContext in that case.
829832
* ----------------
830833
*/
831-
MemoryContextSwitchTo(TransactionCommandContext);
834+
if (TransactionCommandContext!=NULL)
835+
{
836+
MemoryContextSwitchTo(TransactionCommandContext);
832837

833-
/* ----------------
834-
*We do not want to destroy transaction contexts yet,
835-
*but it should be OK to delete any command-local memory.
836-
* ----------------
837-
*/
838-
MemoryContextResetAndDeleteChildren(TransactionCommandContext);
838+
/* ----------------
839+
*We do not want to destroy transaction contexts yet,
840+
*but it should be OK to delete any command-local memory.
841+
* ----------------
842+
*/
843+
MemoryContextResetAndDeleteChildren(TransactionCommandContext);
844+
}
845+
else
846+
{
847+
MemoryContextSwitchTo(TopMemoryContext);
848+
}
839849
}
840850

841851

@@ -863,7 +873,8 @@ AtCleanup_Memory()
863873
*Release all transaction-local memory.
864874
* ----------------
865875
*/
866-
MemoryContextDelete(TopTransactionContext);
876+
if (TopTransactionContext!=NULL)
877+
MemoryContextDelete(TopTransactionContext);
867878
TopTransactionContext=NULL;
868879
TransactionCommandContext=NULL;
869880
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp