Commit 4488b69b authored by Tom Lane's avatar Tom Lane

Fix nbtree's failure to clear BTScans list during xact abort.

Also, move responsibility for calling vc_abort into main xact.c list of
things-to-call-at-abort.  What in the world was it doing down inside of
TransactionIdAbort()?
parent fb491a58
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.30 1999/07/17 20:16:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.31 1999/08/08 20:12:50 tgl Exp $
* *
* NOTES * NOTES
* Postgres btree pages look like ordinary relation pages. The opaque * Postgres btree pages look like ordinary relation pages. The opaque
...@@ -42,7 +42,6 @@ typedef struct BTMetaPageData ...@@ -42,7 +42,6 @@ typedef struct BTMetaPageData
#define BTPageGetMeta(p) \ #define BTPageGetMeta(p) \
((BTMetaPageData *) &((PageHeader) p)->pd_linp[0]) ((BTMetaPageData *) &((PageHeader) p)->pd_linp[0])
extern bool BuildingBtree;
/* /*
* We use high-concurrency locking on btrees. There are two cases in * We use high-concurrency locking on btrees. There are two cases in
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.27 1999/07/15 23:03:00 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.28 1999/08/08 20:12:51 tgl Exp $
* *
* *
* NOTES * NOTES
...@@ -43,6 +43,28 @@ static BTScanList BTScans = (BTScanList) NULL; ...@@ -43,6 +43,28 @@ static BTScanList BTScans = (BTScanList) NULL;
static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno); static void _bt_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
/*
* AtEOXact_nbtree() --- clean up nbtree subsystem at xact abort or commit.
*
* This is here because it needs to touch this module's static var BTScans.
*/
void
AtEOXact_nbtree(void)
{
/* Note: these actions should only be necessary during xact abort;
* but they can't hurt during a commit.
*/
/* Reset the active-scans list to empty.
* We do not need to free the list elements, because they're all
* palloc()'d, so they'll go away at end of transaction anyway.
*/
BTScans = NULL;
/* If we were building a btree, we ain't anymore. */
BuildingBtree = false;
}
/* /*
* _bt_regscan() -- register a new scan. * _bt_regscan() -- register a new scan.
*/ */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.30 1999/07/15 23:03:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.31 1999/08/08 20:12:52 tgl Exp $
* *
* NOTES * NOTES
* This file contains the high level access-method interface to the * This file contains the high level access-method interface to the
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "access/heapam.h" #include "access/heapam.h"
#include "catalog/catname.h" #include "catalog/catname.h"
#include "commands/vacuum.h"
static int RecoveryCheckingEnabled(void); static int RecoveryCheckingEnabled(void);
static void TransRecover(Relation logRelation); static void TransRecover(Relation logRelation);
...@@ -83,12 +82,6 @@ int RecoveryCheckingEnableState = 0; ...@@ -83,12 +82,6 @@ int RecoveryCheckingEnableState = 0;
*/ */
extern int OidGenLockId; extern int OidGenLockId;
/* ----------------
* globals that must be reset at abort
* ----------------
*/
extern bool BuildingBtree;
/* ---------------- /* ----------------
* recovery checking accessors * recovery checking accessors
...@@ -568,11 +561,6 @@ TransactionIdCommit(TransactionId transactionId) ...@@ -568,11 +561,6 @@ TransactionIdCommit(TransactionId transactionId)
void void
TransactionIdAbort(TransactionId transactionId) TransactionIdAbort(TransactionId transactionId)
{ {
BuildingBtree = false;
if (VacuumRunning)
vc_abort();
if (AMI_OVERRIDE) if (AMI_OVERRIDE)
return; return;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.46 1999/07/16 04:58:33 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.47 1999/08/08 20:12:52 tgl Exp $
* *
* NOTES * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
...@@ -144,9 +144,11 @@ ...@@ -144,9 +144,11 @@
*/ */
#include "postgres.h" #include "postgres.h"
#include "access/nbtree.h"
#include "catalog/heap.h" #include "catalog/heap.h"
#include "commands/async.h" #include "commands/async.h"
#include "commands/sequence.h" #include "commands/sequence.h"
#include "commands/vacuum.h"
#include "libpq/be-fsstubs.h" #include "libpq/be-fsstubs.h"
#include "storage/proc.h" #include "storage/proc.h"
#include "utils/inval.h" #include "utils/inval.h"
...@@ -952,6 +954,7 @@ CommitTransaction() ...@@ -952,6 +954,7 @@ CommitTransaction()
} }
RelationPurgeLocalRelation(true); RelationPurgeLocalRelation(true);
AtEOXact_nbtree();
AtCommit_Cache(); AtCommit_Cache();
AtCommit_Locks(); AtCommit_Locks();
AtCommit_Memory(); AtCommit_Memory();
...@@ -1013,9 +1016,12 @@ AbortTransaction() ...@@ -1013,9 +1016,12 @@ AbortTransaction()
AtAbort_Notify(); AtAbort_Notify();
CloseSequences(); CloseSequences();
AtEOXact_portals(); AtEOXact_portals();
if (VacuumRunning)
vc_abort();
RecordTransactionAbort(); RecordTransactionAbort();
RelationPurgeLocalRelation(false); RelationPurgeLocalRelation(false);
DestroyNoNameRels(); DestroyNoNameRels();
AtEOXact_nbtree();
AtAbort_Cache(); AtAbort_Cache();
AtAbort_Locks(); AtAbort_Locks();
AtAbort_Memory(); AtAbort_Memory();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: nbtree.h,v 1.30 1999/07/16 17:07:27 momjian Exp $ * $Id: nbtree.h,v 1.31 1999/08/08 20:12:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -250,6 +250,7 @@ extern void btdelete(Relation rel, ItemPointer tid); ...@@ -250,6 +250,7 @@ extern void btdelete(Relation rel, ItemPointer tid);
extern void _bt_regscan(IndexScanDesc scan); extern void _bt_regscan(IndexScanDesc scan);
extern void _bt_dropscan(IndexScanDesc scan); extern void _bt_dropscan(IndexScanDesc scan);
extern void _bt_adjscans(Relation rel, ItemPointer tid); extern void _bt_adjscans(Relation rel, ItemPointer tid);
extern void AtEOXact_nbtree(void);
/* /*
* prototypes for functions in nbtsearch.c * prototypes for functions in nbtsearch.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment