1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Fix assorted core dumps and Assert failures that could occur during

AbortTransaction or AbortSubTransaction, when trying to clean up after an
error that prevented (sub)transaction start from completing:
* access to TopTransactionResourceOwner that might not exist
* assert failure in AtEOXact_GUC, if AtStart_GUC not called yet
* assert failure or core dump in AfterTriggerEndSubXact, if
  AfterTriggerBeginSubXact not called yet

Per testing by injecting elog(ERROR) at successive steps in StartTransaction
and StartSubTransaction.  It's not clear whether all of these cases could
really occur in the field, but at least one of them is easily exposed by
simple stress testing, as per my accidental discovery yesterday.
This commit is contained in:
Tom Lane
2010-01-24 21:49:58 +00:00
parent 8ecbda7707
commit d5d0a67b22
3 changed files with 50 additions and 33 deletions

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.299.2.6 2009/12/09 21:58:43 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.299.2.7 2010/01/24 21:49:58 tgl Exp $
*
*--------------------------------------------------------------------
*/
@ -3109,7 +3109,14 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
{
int i;
Assert(nestLevel > 0 && nestLevel <= GUCNestLevel);
/*
* Note: it's possible to get here with GUCNestLevel == nestLevel-1 during
* abort, if there is a failure during transaction start before
* AtStart_GUC is called.
*/
Assert(nestLevel > 0 &&
(nestLevel <= GUCNestLevel ||
(nestLevel == GUCNestLevel + 1 && !isCommit)));
/* Quick exit if nothing's changed in this transaction */
if (!guc_dirty)