Remove useless mark/restore support in hash index AM, per discussion.
(I'm leaving GiST/GIN cleanup to Teodor.)
This commit is contained in:
parent
3e00496d88
commit
af59a0650b
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.105 2008/09/15 18:43:41 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.106 2008/10/17 23:50:57 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* This file contains only the public interface routines.
|
* This file contains only the public interface routines.
|
||||||
@ -345,10 +345,9 @@ hashbeginscan(PG_FUNCTION_ARGS)
|
|||||||
so = (HashScanOpaque) palloc(sizeof(HashScanOpaqueData));
|
so = (HashScanOpaque) palloc(sizeof(HashScanOpaqueData));
|
||||||
so->hashso_bucket_valid = false;
|
so->hashso_bucket_valid = false;
|
||||||
so->hashso_bucket_blkno = 0;
|
so->hashso_bucket_blkno = 0;
|
||||||
so->hashso_curbuf = so->hashso_mrkbuf = InvalidBuffer;
|
so->hashso_curbuf = InvalidBuffer;
|
||||||
/* set positions invalid (this will cause _hash_first call) */
|
/* set position invalid (this will cause _hash_first call) */
|
||||||
ItemPointerSetInvalid(&(so->hashso_curpos));
|
ItemPointerSetInvalid(&(so->hashso_curpos));
|
||||||
ItemPointerSetInvalid(&(so->hashso_mrkpos));
|
|
||||||
|
|
||||||
scan->opaque = so;
|
scan->opaque = so;
|
||||||
|
|
||||||
@ -372,23 +371,18 @@ hashrescan(PG_FUNCTION_ARGS)
|
|||||||
/* if we are called from beginscan, so is still NULL */
|
/* if we are called from beginscan, so is still NULL */
|
||||||
if (so)
|
if (so)
|
||||||
{
|
{
|
||||||
/* release any pins we still hold */
|
/* release any pin we still hold */
|
||||||
if (BufferIsValid(so->hashso_curbuf))
|
if (BufferIsValid(so->hashso_curbuf))
|
||||||
_hash_dropbuf(rel, so->hashso_curbuf);
|
_hash_dropbuf(rel, so->hashso_curbuf);
|
||||||
so->hashso_curbuf = InvalidBuffer;
|
so->hashso_curbuf = InvalidBuffer;
|
||||||
|
|
||||||
if (BufferIsValid(so->hashso_mrkbuf))
|
|
||||||
_hash_dropbuf(rel, so->hashso_mrkbuf);
|
|
||||||
so->hashso_mrkbuf = InvalidBuffer;
|
|
||||||
|
|
||||||
/* release lock on bucket, too */
|
/* release lock on bucket, too */
|
||||||
if (so->hashso_bucket_blkno)
|
if (so->hashso_bucket_blkno)
|
||||||
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
|
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
|
||||||
so->hashso_bucket_blkno = 0;
|
so->hashso_bucket_blkno = 0;
|
||||||
|
|
||||||
/* set positions invalid (this will cause _hash_first call) */
|
/* set position invalid (this will cause _hash_first call) */
|
||||||
ItemPointerSetInvalid(&(so->hashso_curpos));
|
ItemPointerSetInvalid(&(so->hashso_curpos));
|
||||||
ItemPointerSetInvalid(&(so->hashso_mrkpos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update scan key, if a new one is given */
|
/* Update scan key, if a new one is given */
|
||||||
@ -417,15 +411,11 @@ hashendscan(PG_FUNCTION_ARGS)
|
|||||||
/* don't need scan registered anymore */
|
/* don't need scan registered anymore */
|
||||||
_hash_dropscan(scan);
|
_hash_dropscan(scan);
|
||||||
|
|
||||||
/* release any pins we still hold */
|
/* release any pin we still hold */
|
||||||
if (BufferIsValid(so->hashso_curbuf))
|
if (BufferIsValid(so->hashso_curbuf))
|
||||||
_hash_dropbuf(rel, so->hashso_curbuf);
|
_hash_dropbuf(rel, so->hashso_curbuf);
|
||||||
so->hashso_curbuf = InvalidBuffer;
|
so->hashso_curbuf = InvalidBuffer;
|
||||||
|
|
||||||
if (BufferIsValid(so->hashso_mrkbuf))
|
|
||||||
_hash_dropbuf(rel, so->hashso_mrkbuf);
|
|
||||||
so->hashso_mrkbuf = InvalidBuffer;
|
|
||||||
|
|
||||||
/* release lock on bucket, too */
|
/* release lock on bucket, too */
|
||||||
if (so->hashso_bucket_blkno)
|
if (so->hashso_bucket_blkno)
|
||||||
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
|
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
|
||||||
@ -443,24 +433,7 @@ hashendscan(PG_FUNCTION_ARGS)
|
|||||||
Datum
|
Datum
|
||||||
hashmarkpos(PG_FUNCTION_ARGS)
|
hashmarkpos(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
|
elog(ERROR, "hash does not support mark/restore");
|
||||||
HashScanOpaque so = (HashScanOpaque) scan->opaque;
|
|
||||||
Relation rel = scan->indexRelation;
|
|
||||||
|
|
||||||
/* release pin on old marked data, if any */
|
|
||||||
if (BufferIsValid(so->hashso_mrkbuf))
|
|
||||||
_hash_dropbuf(rel, so->hashso_mrkbuf);
|
|
||||||
so->hashso_mrkbuf = InvalidBuffer;
|
|
||||||
ItemPointerSetInvalid(&(so->hashso_mrkpos));
|
|
||||||
|
|
||||||
/* bump pin count on current buffer and copy to marked buffer */
|
|
||||||
if (ItemPointerIsValid(&(so->hashso_curpos)))
|
|
||||||
{
|
|
||||||
IncrBufferRefCount(so->hashso_curbuf);
|
|
||||||
so->hashso_mrkbuf = so->hashso_curbuf;
|
|
||||||
so->hashso_mrkpos = so->hashso_curpos;
|
|
||||||
}
|
|
||||||
|
|
||||||
PG_RETURN_VOID();
|
PG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,24 +443,7 @@ hashmarkpos(PG_FUNCTION_ARGS)
|
|||||||
Datum
|
Datum
|
||||||
hashrestrpos(PG_FUNCTION_ARGS)
|
hashrestrpos(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
|
elog(ERROR, "hash does not support mark/restore");
|
||||||
HashScanOpaque so = (HashScanOpaque) scan->opaque;
|
|
||||||
Relation rel = scan->indexRelation;
|
|
||||||
|
|
||||||
/* release pin on current data, if any */
|
|
||||||
if (BufferIsValid(so->hashso_curbuf))
|
|
||||||
_hash_dropbuf(rel, so->hashso_curbuf);
|
|
||||||
so->hashso_curbuf = InvalidBuffer;
|
|
||||||
ItemPointerSetInvalid(&(so->hashso_curpos));
|
|
||||||
|
|
||||||
/* bump pin count on marked buffer and copy to current buffer */
|
|
||||||
if (ItemPointerIsValid(&(so->hashso_mrkpos)))
|
|
||||||
{
|
|
||||||
IncrBufferRefCount(so->hashso_mrkbuf);
|
|
||||||
so->hashso_curbuf = so->hashso_mrkbuf;
|
|
||||||
so->hashso_curpos = so->hashso_mrkpos;
|
|
||||||
}
|
|
||||||
|
|
||||||
PG_RETURN_VOID();
|
PG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.90 2008/09/15 18:43:41 tgl Exp $
|
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.91 2008/10/17 23:50:57 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* modeled after Margo Seltzer's hash implementation for unix.
|
* modeled after Margo Seltzer's hash implementation for unix.
|
||||||
@ -92,17 +92,15 @@ typedef struct HashScanOpaqueData
|
|||||||
BlockNumber hashso_bucket_blkno;
|
BlockNumber hashso_bucket_blkno;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We also want to remember which buffers we're currently examining in the
|
* We also want to remember which buffer we're currently examining in the
|
||||||
* scan. We keep these buffers pinned (but not locked) across hashgettuple
|
* scan. We keep the buffer pinned (but not locked) across hashgettuple
|
||||||
* calls, in order to avoid doing a ReadBuffer() for every tuple in the
|
* calls, in order to avoid doing a ReadBuffer() for every tuple in the
|
||||||
* index.
|
* index.
|
||||||
*/
|
*/
|
||||||
Buffer hashso_curbuf;
|
Buffer hashso_curbuf;
|
||||||
Buffer hashso_mrkbuf;
|
|
||||||
|
|
||||||
/* Current and marked position of the scan */
|
/* Current position of the scan */
|
||||||
ItemPointerData hashso_curpos;
|
ItemPointerData hashso_curpos;
|
||||||
ItemPointerData hashso_mrkpos;
|
|
||||||
} HashScanOpaqueData;
|
} HashScanOpaqueData;
|
||||||
|
|
||||||
typedef HashScanOpaqueData *HashScanOpaque;
|
typedef HashScanOpaqueData *HashScanOpaque;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user