diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-07-15 22:48:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-07-15 22:48:19 +0000 |
commit | c8076f09d2eb82a28f27f97230be470fffe7a1e0 (patch) | |
tree | 1e357e7e28313386f9d2e789d3905b37ce2d58f6 /src/backend/access/gist/gistscan.c | |
parent | 997439f59e1d487cb2bfa1384f6479fda0c4dd4c (diff) | |
download | postgresql-c8076f09d2eb82a28f27f97230be470fffe7a1e0.tar.gz postgresql-c8076f09d2eb82a28f27f97230be470fffe7a1e0.zip |
Restructure index AM interface for index building and index tuple deletion,
per previous discussion on pghackers. Most of the duplicate code in
different AMs' ambuild routines has been moved out to a common routine
in index.c; this means that all index types now do the right things about
inserting recently-dead tuples, etc. (I also removed support for EXTEND
INDEX in the ambuild routines, since that's about to go away anyway, and
it cluttered the code a lot.) The retail indextuple deletion routines have
been replaced by a "bulk delete" routine in which the indexscan is inside
the access method. I haven't pushed this change as far as it should go yet,
but it should allow considerable simplification of the internal bookkeeping
for deletions. Also, add flag columns to pg_am to eliminate various
hardcoded tests on AM OIDs, and remove unused pg_am columns.
Fix rtree and gist index types to not attempt to store NULLs; before this,
gist usually crashed, while rtree managed not to crash but computed wacko
bounding boxes for NULL entries (which might have had something to do with
the performance problems we've heard about occasionally).
Add AtEOXact routines to hash, rtree, and gist, all of which have static
state that needs to be reset after an error. We discovered this need long
ago for btree, but missed the other guys.
Oh, one more thing: concurrent VACUUM is now the default.
Diffstat (limited to 'src/backend/access/gist/gistscan.c')
-rw-r--r-- | src/backend/access/gist/gistscan.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 672b121693a..9358692a53c 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 - * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.37 2001/06/28 16:00:07 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/gist/gistscan.c,v 1.38 2001/07/15 22:48:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -59,13 +59,8 @@ gistbeginscan(PG_FUNCTION_ARGS) ScanKey key = (ScanKey) PG_GETARG_POINTER(3); IndexScanDesc s; - /* - * Let index_beginscan does its work... - * - * RelationSetLockForRead(r); - */ - s = RelationGetIndexScan(r, fromEnd, nkeys, key); + gistregscan(s); PG_RETURN_POINTER(s); @@ -283,6 +278,27 @@ gistdropscan(IndexScanDesc s) pfree(l); } +/* + * AtEOXact_gist() --- clean up gist subsystem at xact abort or commit. + * + * This is here because it needs to touch this module's static var GISTScans. + */ +void +AtEOXact_gist(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. + */ + GISTScans = NULL; +} + void gistadjscans(Relation rel, int op, BlockNumber blkno, OffsetNumber offnum) { |