Skip to content

Commit af59a06

Browse files
committed
Remove useless mark/restore support in hash index AM, per discussion.
(I'm leaving GiST/GIN cleanup to Teodor.)
1 parent 3e00496 commit af59a06

File tree

2 files changed

+12
-58
lines changed

2 files changed

+12
-58
lines changed

src/backend/access/hash/hash.c

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.105 2008/09/15 18:43:41 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.106 2008/10/17 23:50:57 tgl Exp $
1212
*
1313
* NOTES
1414
* This file contains only the public interface routines.
@@ -345,10 +345,9 @@ hashbeginscan(PG_FUNCTION_ARGS)
345345
so = (HashScanOpaque) palloc(sizeof(HashScanOpaqueData));
346346
so->hashso_bucket_valid = false;
347347
so->hashso_bucket_blkno = 0;
348-
so->hashso_curbuf = so->hashso_mrkbuf = InvalidBuffer;
349-
/* set positions invalid (this will cause _hash_first call) */
348+
so->hashso_curbuf = InvalidBuffer;
349+
/* set position invalid (this will cause _hash_first call) */
350350
ItemPointerSetInvalid(&(so->hashso_curpos));
351-
ItemPointerSetInvalid(&(so->hashso_mrkpos));
352351

353352
scan->opaque = so;
354353

@@ -372,23 +371,18 @@ hashrescan(PG_FUNCTION_ARGS)
372371
/* if we are called from beginscan, so is still NULL */
373372
if (so)
374373
{
375-
/* release any pins we still hold */
374+
/* release any pin we still hold */
376375
if (BufferIsValid(so->hashso_curbuf))
377376
_hash_dropbuf(rel, so->hashso_curbuf);
378377
so->hashso_curbuf = InvalidBuffer;
379378

380-
if (BufferIsValid(so->hashso_mrkbuf))
381-
_hash_dropbuf(rel, so->hashso_mrkbuf);
382-
so->hashso_mrkbuf = InvalidBuffer;
383-
384379
/* release lock on bucket, too */
385380
if (so->hashso_bucket_blkno)
386381
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
387382
so->hashso_bucket_blkno = 0;
388383

389-
/* set positions invalid (this will cause _hash_first call) */
384+
/* set position invalid (this will cause _hash_first call) */
390385
ItemPointerSetInvalid(&(so->hashso_curpos));
391-
ItemPointerSetInvalid(&(so->hashso_mrkpos));
392386
}
393387

394388
/* Update scan key, if a new one is given */
@@ -417,15 +411,11 @@ hashendscan(PG_FUNCTION_ARGS)
417411
/* don't need scan registered anymore */
418412
_hash_dropscan(scan);
419413

420-
/* release any pins we still hold */
414+
/* release any pin we still hold */
421415
if (BufferIsValid(so->hashso_curbuf))
422416
_hash_dropbuf(rel, so->hashso_curbuf);
423417
so->hashso_curbuf = InvalidBuffer;
424418

425-
if (BufferIsValid(so->hashso_mrkbuf))
426-
_hash_dropbuf(rel, so->hashso_mrkbuf);
427-
so->hashso_mrkbuf = InvalidBuffer;
428-
429419
/* release lock on bucket, too */
430420
if (so->hashso_bucket_blkno)
431421
_hash_droplock(rel, so->hashso_bucket_blkno, HASH_SHARE);
@@ -443,24 +433,7 @@ hashendscan(PG_FUNCTION_ARGS)
443433
Datum
444434
hashmarkpos(PG_FUNCTION_ARGS)
445435
{
446-
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
447-
HashScanOpaque so = (HashScanOpaque) scan->opaque;
448-
Relation rel = scan->indexRelation;
449-
450-
/* release pin on old marked data, if any */
451-
if (BufferIsValid(so->hashso_mrkbuf))
452-
_hash_dropbuf(rel, so->hashso_mrkbuf);
453-
so->hashso_mrkbuf = InvalidBuffer;
454-
ItemPointerSetInvalid(&(so->hashso_mrkpos));
455-
456-
/* bump pin count on current buffer and copy to marked buffer */
457-
if (ItemPointerIsValid(&(so->hashso_curpos)))
458-
{
459-
IncrBufferRefCount(so->hashso_curbuf);
460-
so->hashso_mrkbuf = so->hashso_curbuf;
461-
so->hashso_mrkpos = so->hashso_curpos;
462-
}
463-
436+
elog(ERROR, "hash does not support mark/restore");
464437
PG_RETURN_VOID();
465438
}
466439

@@ -470,24 +443,7 @@ hashmarkpos(PG_FUNCTION_ARGS)
470443
Datum
471444
hashrestrpos(PG_FUNCTION_ARGS)
472445
{
473-
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
474-
HashScanOpaque so = (HashScanOpaque) scan->opaque;
475-
Relation rel = scan->indexRelation;
476-
477-
/* release pin on current data, if any */
478-
if (BufferIsValid(so->hashso_curbuf))
479-
_hash_dropbuf(rel, so->hashso_curbuf);
480-
so->hashso_curbuf = InvalidBuffer;
481-
ItemPointerSetInvalid(&(so->hashso_curpos));
482-
483-
/* bump pin count on marked buffer and copy to current buffer */
484-
if (ItemPointerIsValid(&(so->hashso_mrkpos)))
485-
{
486-
IncrBufferRefCount(so->hashso_mrkbuf);
487-
so->hashso_curbuf = so->hashso_mrkbuf;
488-
so->hashso_curpos = so->hashso_mrkpos;
489-
}
490-
446+
elog(ERROR, "hash does not support mark/restore");
491447
PG_RETURN_VOID();
492448
}
493449

src/include/access/hash.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.90 2008/09/15 18:43:41 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/access/hash.h,v 1.91 2008/10/17 23:50:57 tgl Exp $
1111
*
1212
* NOTES
1313
* modeled after Margo Seltzer's hash implementation for unix.
@@ -92,17 +92,15 @@ typedef struct HashScanOpaqueData
9292
BlockNumber hashso_bucket_blkno;
9393

9494
/*
95-
* We also want to remember which buffers we're currently examining in the
96-
* scan. We keep these buffers pinned (but not locked) across hashgettuple
95+
* We also want to remember which buffer we're currently examining in the
96+
* scan. We keep the buffer pinned (but not locked) across hashgettuple
9797
* calls, in order to avoid doing a ReadBuffer() for every tuple in the
9898
* index.
9999
*/
100100
Buffer hashso_curbuf;
101-
Buffer hashso_mrkbuf;
102101

103-
/* Current and marked position of the scan */
102+
/* Current position of the scan */
104103
ItemPointerData hashso_curpos;
105-
ItemPointerData hashso_mrkpos;
106104
} HashScanOpaqueData;
107105

108106
typedef HashScanOpaqueData *HashScanOpaque;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy