handle-same-bucket-key-update-1.patch
text/x-diff
Filename: handle-same-bucket-key-update-1.patch
Type: text/x-diff
Part: 0
Message:
Re: Curious buildfarm failures
Patch
Format: context
| File | + | − |
|---|---|---|
| src/backend/utils/hash/dynahash.c | 12 | 0 |
*** a/src/backend/utils/hash/dynahash.c
--- b/src/backend/utils/hash/dynahash.c
***************
*** 1022,1027 **** hash_update_hash_key(HTAB *hashp,
--- 1022,1028 ----
uint32 newhashvalue;
Size keysize;
uint32 bucket;
+ uint32 newbucket;
long segment_num;
long segment_ndx;
HASHSEGMENT segp;
***************
*** 1078,1087 **** hash_update_hash_key(HTAB *hashp,
*/
newhashvalue = hashp->hash(newKeyPtr, hashp->keysize);
! bucket = calc_bucket(hctl, newhashvalue);
!
! segment_num = bucket >> hashp->sshift;
! segment_ndx = MOD(bucket, hashp->ssize);
segp = hashp->dir[segment_num];
--- 1079,1087 ----
*/
newhashvalue = hashp->hash(newKeyPtr, hashp->keysize);
! newbucket = calc_bucket(hctl, newhashvalue);
! segment_num = newbucket >> hashp->sshift;
! segment_ndx = MOD(newbucket, hashp->ssize);
segp = hashp->dir[segment_num];
***************
*** 1115,1126 **** hash_update_hash_key(HTAB *hashp,
currBucket = existingElement;
! /* OK to remove record from old hash bucket's chain. */
! *oldPrevPtr = currBucket->link;
! /* link into new hashbucket chain */
! *prevBucketPtr = currBucket;
! currBucket->link = NULL;
/* copy new key into record */
currBucket->hashvalue = newhashvalue;
--- 1115,1129 ----
currBucket = existingElement;
! if (bucket != newbucket)
! {
! /* OK to remove record from old hash bucket's chain. */
! *oldPrevPtr = currBucket->link;
! /* link into new hashbucket chain */
! *prevBucketPtr = currBucket;
! currBucket->link = NULL;
! }
/* copy new key into record */
currBucket->hashvalue = newhashvalue;