Fix key size of PrivateRefCountHash. master github/master
authorNathan Bossart <nathan@postgresql.org>
Thu, 4 Dec 2025 21:42:18 +0000 (15:42 -0600)
committerNathan Bossart <nathan@postgresql.org>
Thu, 4 Dec 2025 21:42:18 +0000 (15:42 -0600)
The key is the first member of PrivateRefCountEntry, which has type
Buffer.  This commit changes the key size from sizeof(int32) to
sizeof(Buffer).  This appears to be an oversight in commit
4b4b680c3d, but it's of no consequence because Buffer has been a
signed 32-bit integer for a long time.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aS77DTpl0fOkIKSZ%40ip-10-97-1-34.eu-west-3.compute.internal

src/backend/storage/buffer/bufmgr.c

index 62f420dd34463db4d316ffa6d0048540f9e35c18..ce52d6ca81f1784791b2f7e9e962125619fae18c 100644 (file)
@@ -4019,7 +4019,7 @@ InitBufferManagerAccess(void)
 
    memset(&PrivateRefCountArray, 0, sizeof(PrivateRefCountArray));
 
-   hash_ctl.keysize = sizeof(int32);
+   hash_ctl.keysize = sizeof(Buffer);
    hash_ctl.entrysize = sizeof(PrivateRefCountEntry);
 
    PrivateRefCountHash = hash_create("PrivateRefCount", 100, &hash_ctl,