3737static bool _hash_alloc_buckets (Relation rel ,BlockNumber firstblock ,
3838uint32 nblocks );
3939static void _hash_splitbucket (Relation rel ,Buffer metabuf ,
40- Buffer nbuf ,
4140Bucket obucket ,Bucket nbucket ,
4241BlockNumber start_oblkno ,
43- BlockNumber start_nblkno ,
42+ Buffer nbuf ,
4443uint32 maxbucket ,
4544uint32 highmask ,uint32 lowmask );
4645
@@ -664,9 +663,9 @@ _hash_expandtable(Relation rel, Buffer metabuf)
664663_hash_chgbufaccess (rel ,metabuf ,HASH_WRITE ,HASH_NOLOCK );
665664
666665/* Relocate records to the new bucket */
667- _hash_splitbucket (rel ,metabuf ,buf_nblkno ,
666+ _hash_splitbucket (rel ,metabuf ,
668667old_bucket ,new_bucket ,
669- start_oblkno ,start_nblkno ,
668+ start_oblkno ,buf_nblkno ,
670669maxbucket ,highmask ,lowmask );
671670
672671/* Release bucket locks, allowing others to access them */
@@ -747,24 +746,22 @@ _hash_alloc_buckets(Relation rel, BlockNumber firstblock, uint32 nblocks)
747746 * touched if it becomes necessary to add or remove overflow pages.)
748747 *
749748 * In addition, the caller must have created the new bucket's base page,
750- * which is passed in buffer nbuf, pinned and write-locked. The lock
751- * and pin are released here. (The API is set up this way because we must
752- * do _hash_getnewbuf() before releasing the metapage write lock.)
749+ * which is passed in buffer nbuf, pinned and write-locked. That lock and
750+ * pin are released here. (The API is set up this way because we must do
751+ * _hash_getnewbuf() before releasing the metapage write lock. So instead of
752+ * passing the new bucket's start block number, we pass an actual buffer.)
753753 */
754754static void
755755_hash_splitbucket (Relation rel ,
756756Buffer metabuf ,
757- Buffer nbuf ,
758757Bucket obucket ,
759758Bucket nbucket ,
760759BlockNumber start_oblkno ,
761- BlockNumber start_nblkno ,
760+ Buffer nbuf ,
762761uint32 maxbucket ,
763762uint32 highmask ,
764763uint32 lowmask )
765764{
766- BlockNumber oblkno ;
767- BlockNumber nblkno ;
768765Buffer obuf ;
769766Page opage ;
770767Page npage ;
@@ -776,13 +773,10 @@ _hash_splitbucket(Relation rel,
776773 * since no one else can be trying to acquire buffer lock on pages of
777774 * either bucket.
778775 */
779- oblkno = start_oblkno ;
780- obuf = _hash_getbuf (rel ,oblkno ,HASH_WRITE ,LH_BUCKET_PAGE );
776+ obuf = _hash_getbuf (rel ,start_oblkno ,HASH_WRITE ,LH_BUCKET_PAGE );
781777opage = BufferGetPage (obuf );
782778oopaque = (HashPageOpaque )PageGetSpecialPointer (opage );
783779
784- nblkno = start_nblkno ;
785- Assert (nblkno == BufferGetBlockNumber (nbuf ));
786780npage = BufferGetPage (nbuf );
787781
788782/* initialize the new bucket's primary page */
@@ -801,6 +795,7 @@ _hash_splitbucket(Relation rel,
801795 */
802796for (;;)
803797{
798+ BlockNumber oblkno ;
804799OffsetNumber ooffnum ;
805800OffsetNumber omaxoffnum ;
806801OffsetNumber deletable [MaxOffsetNumber ];
@@ -847,7 +842,7 @@ _hash_splitbucket(Relation rel,
847842/* chain to a new overflow page */
848843nbuf = _hash_addovflpage (rel ,metabuf ,nbuf );
849844npage = BufferGetPage (nbuf );
850- /* we don't neednblkno or nopaque within the loop */
845+ /* we don't need nopaque within the loop */
851846}
852847
853848/*