aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-07-01 00:52:04 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-07-01 00:52:04 +0000
commit573a71a5da70d6e2503c8f53e3b4f26b3b6d738d (patch)
tree070f677b0043631518f83ce84ff201bf8fda700f /src/backend/access/gist
parent4c9aa572fa2ee60e8ac557b866eccc7310df0a09 (diff)
downloadpostgresql-573a71a5da70d6e2503c8f53e3b4f26b3b6d738d.tar.gz
postgresql-573a71a5da70d6e2503c8f53e3b4f26b3b6d738d.zip
Nested transactions. There is still much left to do, especially on the
performance front, but with feature freeze upon us I think it's time to drive a stake in the ground and say that this will be in 7.5. Alvaro Herrera, with some help from Tom Lane.
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r--src/backend/access/gist/gistscan.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index 30bb9b810af..dc424a6773d 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.51 2004/01/07 18:56:23 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.52 2004/07/01 00:49:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,6 +41,7 @@ static void adjustiptr(IndexScanDesc s, ItemPointer iptr,
typedef struct GISTScanListData
{
IndexScanDesc gsl_scan;
+ TransactionId gsl_creatingXid;
struct GISTScanListData *gsl_next;
} GISTScanListData;
@@ -223,6 +224,7 @@ gistregscan(IndexScanDesc s)
l = (GISTScanList) palloc(sizeof(GISTScanListData));
l->gsl_scan = s;
+ l->gsl_creatingXid = GetCurrentTransactionId();
l->gsl_next = GISTScans;
GISTScans = l;
}
@@ -271,6 +273,46 @@ AtEOXact_gist(void)
GISTScans = NULL;
}
+/*
+ * AtEOSubXact_gist() --- clean up gist subsystem at subxact abort or commit.
+ *
+ * This is here because it needs to touch this module's static var GISTScans.
+ */
+void
+AtEOSubXact_gist(TransactionId childXid)
+{
+ GISTScanList l;
+ GISTScanList prev;
+ GISTScanList next;
+
+ /*
+ * Note: these actions should only be necessary during xact abort; but
+ * they can't hurt during a commit.
+ */
+
+ /*
+ * Forget active scans that were started in this subtransaction.
+ */
+ prev = NULL;
+
+ for (l = GISTScans; l != NULL; l = next)
+ {
+ next = l->gsl_next;
+ if (l->gsl_creatingXid == childXid)
+ {
+ if (prev == NULL)
+ GISTScans = next;
+ else
+ prev->gsl_next = next;
+
+ pfree(l);
+ /* prev does not change */
+ }
+ else
+ prev = l;
+ }
+}
+
void
gistadjscans(Relation rel, int op, BlockNumber blkno, OffsetNumber offnum)
{