Skip to content

Commit a577599

Browse files
committed
Remove no-longer-needed compatibility code for hash indexes.
Because commit ea69a0d bumped the HASH_VERSION, we don't need to worry about PostgreSQL 10 seeing bucket pages from earlier versions. Amit Kapila Discussion: http://postgr.es/m/CAA4eK1LAo4DGwh+mi-G3U8Pj1WkBBeFL38xdCnUHJv1z4bZFkQ@mail.gmail.com
1 parent df1a4eb commit a577599

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/backend/access/hash/hash.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,9 @@ hashbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
624624
* now that the primary page of the target bucket has been locked
625625
* (and thus can't be further split), check whether we need to
626626
* update our cached metapage data.
627-
*
628-
* NB: The check for InvalidBlockNumber is only needed for
629-
* on-disk compatibility with indexes created before we started
630-
* storing hashm_maxbucket in the primary page's hasho_prevblkno.
631627
*/
632-
if (bucket_opaque->hasho_prevblkno != InvalidBlockNumber &&
633-
bucket_opaque->hasho_prevblkno > cachedmetap->hashm_maxbucket)
628+
Assert(bucket_opaque->hasho_prevblkno != InvalidBlockNumber);
629+
if (bucket_opaque->hasho_prevblkno > cachedmetap->hashm_maxbucket)
634630
{
635631
cachedmetap = _hash_getcachedmetap(rel, &metabuf, true);
636632
Assert(cachedmetap != NULL);

src/backend/access/hash/hashpage.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,16 +1564,12 @@ _hash_getbucketbuf_from_hashkey(Relation rel, uint32 hashkey, int access,
15641564
page = BufferGetPage(buf);
15651565
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
15661566
Assert(opaque->hasho_bucket == bucket);
1567+
Assert(opaque->hasho_prevblkno != InvalidBlockNumber);
15671568

15681569
/*
15691570
* If this bucket hasn't been split, we're done.
1570-
*
1571-
* NB: The check for InvalidBlockNumber is only needed for on-disk
1572-
* compatibility with indexes created before we started storing
1573-
* hashm_maxbucket in the primary page's hasho_prevblkno.
15741571
*/
1575-
if (opaque->hasho_prevblkno == InvalidBlockNumber ||
1576-
opaque->hasho_prevblkno <= metap->hashm_maxbucket)
1572+
if (opaque->hasho_prevblkno <= metap->hashm_maxbucket)
15771573
break;
15781574

15791575
/* Drop lock on this buffer, update cached metapage, and retry. */

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