summaryrefslogtreecommitdiff
path: root/src/backend/access/gin
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2008-10-20 13:39:44 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2008-10-20 13:39:44 +0000
commit77db9d9ff21c539499b74216099678dad91ab334 (patch)
tree9d6ef9735895ed83d16c1ed719b9968c0906984a /src/backend/access/gin
parent7f6bc33fe3490bd1a2b9b584abbabe3e17b1715a (diff)
Remove mark/restore support in GIN and GiST indexes.
Per Tom's comment. Also revome useless GISTScanOpaque->flags field.
Diffstat (limited to 'src/backend/access/gin')
-rw-r--r--src/backend/access/gin/ginget.c50
-rw-r--r--src/backend/access/gin/ginscan.c67
2 files changed, 11 insertions, 106 deletions
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index c4619a61460..746de42af59 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.19 2008/09/04 11:47:05 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.20 2008/10/20 13:39:44 teodor Exp $
*-------------------------------------------------------------------------
*/
@@ -583,54 +583,6 @@ entryGetItem(Relation index, GinScanEntry entry)
}
/*
- * restart from saved position. Actually it's needed only for
- * partial match. function is called only by ginrestpos()
- */
-void
-ginrestartentry(GinScanEntry entry)
-{
- ItemPointerData stopItem = entry->curItem;
- bool savedReduceResult;
-
- if ( entry->master || entry->partialMatch == NULL )
- return; /* entry is slave or not a partial match type*/
-
- if ( entry->isFinished )
- return; /* entry was finished before ginmarkpos() call */
-
- if ( ItemPointerGetBlockNumber(&stopItem) == InvalidBlockNumber )
- return; /* entry wasn't began before ginmarkpos() call */
-
- /*
- * Reset iterator
- */
- tbm_begin_iterate( entry->partialMatch );
- entry->partialMatchResult = NULL;
- entry->offset = 0;
-
- /*
- * Temporary reset reduceResult flag to guarantee refinding
- * of curItem
- */
- savedReduceResult = entry->reduceResult;
- entry->reduceResult = FALSE;
-
- do
- {
- /*
- * We can use null instead of index because
- * partial match doesn't use it
- */
- if ( entryGetItem( NULL, entry ) == false )
- elog(ERROR, "cannot refind scan position"); /* must not be here! */
- } while( compareItemPointers( &stopItem, &entry->curItem ) != 0 );
-
- Assert( entry->isFinished == FALSE );
-
- entry->reduceResult = savedReduceResult;
-}
-
-/*
* Sets key->curItem to new found heap item pointer for one scan key
* Returns isFinished, ie TRUE means we did NOT get a new item pointer!
* Also, *keyrecheck is set true if recheck is needed for this scan key.
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index 7a1cac08cdb..675e8192684 100644
--- a/src/backend/access/gin/ginscan.c
+++ b/src/backend/access/gin/ginscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.18 2008/09/04 11:47:05 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.19 2008/10/20 13:39:44 teodor Exp $
*-------------------------------------------------------------------------
*/
@@ -114,7 +114,7 @@ resetScanKeys(GinScanKey keys, uint32 nkeys)
#endif
static void
-freeScanKeys(GinScanKey keys, uint32 nkeys, bool removeRes)
+freeScanKeys(GinScanKey keys, uint32 nkeys)
{
uint32 i,
j;
@@ -130,14 +130,13 @@ freeScanKeys(GinScanKey keys, uint32 nkeys, bool removeRes)
{
if (key->scanEntry[j].buffer != InvalidBuffer)
ReleaseBuffer(key->scanEntry[j].buffer);
- if (removeRes && key->scanEntry[j].list)
+ if (key->scanEntry[j].list)
pfree(key->scanEntry[j].list);
- if (removeRes && key->scanEntry[j].partialMatch)
+ if (key->scanEntry[j].partialMatch)
tbm_free(key->scanEntry[j].partialMatch);
}
- if (removeRes)
- pfree(key->entryRes);
+ pfree(key->entryRes);
pfree(key->scanEntry);
}
@@ -233,11 +232,10 @@ ginrescan(PG_FUNCTION_ARGS)
}
else
{
- freeScanKeys(so->keys, so->nkeys, TRUE);
- freeScanKeys(so->markPos, so->nkeys, FALSE);
+ freeScanKeys(so->keys, so->nkeys);
}
- so->markPos = so->keys = NULL;
+ so->keys = NULL;
if (scankey && scan->numberOfKeys > 0)
{
@@ -257,8 +255,7 @@ ginendscan(PG_FUNCTION_ARGS)
if (so != NULL)
{
- freeScanKeys(so->keys, so->nkeys, TRUE);
- freeScanKeys(so->markPos, so->nkeys, FALSE);
+ freeScanKeys(so->keys, so->nkeys);
MemoryContextDelete(so->tempCtx);
@@ -268,60 +265,16 @@ ginendscan(PG_FUNCTION_ARGS)
PG_RETURN_VOID();
}
-static GinScanKey
-copyScanKeys(GinScanKey keys, uint32 nkeys, bool restart)
-{
- GinScanKey newkeys;
- uint32 i,
- j;
-
- newkeys = (GinScanKey) palloc(sizeof(GinScanKeyData) * nkeys);
- memcpy(newkeys, keys, sizeof(GinScanKeyData) * nkeys);
-
- for (i = 0; i < nkeys; i++)
- {
- newkeys[i].scanEntry = (GinScanEntry) palloc(sizeof(GinScanEntryData) * keys[i].nentries);
- memcpy(newkeys[i].scanEntry, keys[i].scanEntry, sizeof(GinScanEntryData) * keys[i].nentries);
-
- for (j = 0; j < keys[i].nentries; j++)
- {
- if (keys[i].scanEntry[j].buffer != InvalidBuffer)
- IncrBufferRefCount(keys[i].scanEntry[j].buffer);
- if (keys[i].scanEntry[j].master)
- {
- int masterN = keys[i].scanEntry[j].master - keys[i].scanEntry;
-
- newkeys[i].scanEntry[j].master = newkeys[i].scanEntry + masterN;
- }
-
- if ( restart )
- ginrestartentry( &keys[i].scanEntry[j] );
- }
- }
-
- return newkeys;
-}
-
Datum
ginmarkpos(PG_FUNCTION_ARGS)
{
- IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- GinScanOpaque so = (GinScanOpaque) scan->opaque;
-
- freeScanKeys(so->markPos, so->nkeys, FALSE);
- so->markPos = copyScanKeys(so->keys, so->nkeys, FALSE);
-
+ elog(ERROR, "GIN does not support mark/restore");
PG_RETURN_VOID();
}
Datum
ginrestrpos(PG_FUNCTION_ARGS)
{
- IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- GinScanOpaque so = (GinScanOpaque) scan->opaque;
-
- freeScanKeys(so->keys, so->nkeys, FALSE);
- so->keys = copyScanKeys(so->markPos, so->nkeys, TRUE);
-
+ elog(ERROR, "GIN does not support mark/restore");
PG_RETURN_VOID();
}