Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf59a06

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

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-
/* setpositions invalid (this will cause _hash_first call) */
348+
so->hashso_curbuf=InvalidBuffer;
349+
/* setposition 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 anypins we still hold */
374+
/* release anypin 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-
/* setpositions invalid (this will cause _hash_first call) */
384+
/* setposition 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 anypins we still hold */
414+
/* release anypin 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-
IndexScanDescscan= (IndexScanDesc)PG_GETARG_POINTER(0);
447-
HashScanOpaqueso= (HashScanOpaque)scan->opaque;
448-
Relationrel=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-
IndexScanDescscan= (IndexScanDesc)PG_GETARG_POINTER(0);
474-
HashScanOpaqueso= (HashScanOpaque)scan->opaque;
475-
Relationrel=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
BlockNumberhashso_bucket_blkno;
9393

9494
/*
95-
* We also want to remember whichbuffers we're currently examining in the
96-
* scan. We keepthese buffers pinned (but not locked) across hashgettuple
95+
* We also want to remember whichbuffer we're currently examining in the
96+
* scan. We keepthe 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
Bufferhashso_curbuf;
101-
Bufferhashso_mrkbuf;
102101

103-
/* Currentand markedposition of the scan */
102+
/* Current position of the scan */
104103
ItemPointerDatahashso_curpos;
105-
ItemPointerDatahashso_mrkpos;
106104
}HashScanOpaqueData;
107105

108106
typedefHashScanOpaqueData*HashScanOpaque;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp