Skip to content

Commit 519e4c9

Browse files
author
Amit Kapila
committed
Fix size overflow in calculation introduced by commits d6ad34f and bea449c.
Reported-by: Thomas Munro Author: Takayuki Tsunakawa Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/CA+hUKG+oPoFizjABt=GXZWTEHx3oev5rAe2scjW2r6F1rguo5w@mail.gmail.com
1 parent e2cda3c commit 519e4c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
* being dropped. For the relations with size below this threshold, we find
7777
* the buffers by doing lookups in BufMapping table.
7878
*/
79-
#define BUF_DROP_FULL_SCAN_THRESHOLD (uint32) (NBuffers / 32)
79+
#define BUF_DROP_FULL_SCAN_THRESHOLD (uint64) (NBuffers / 32)
8080

8181
typedef struct PrivateRefCountEntry
8282
{
@@ -2987,7 +2987,7 @@ DropRelFileNodeBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
29872987
int j;
29882988
RelFileNodeBackend rnode;
29892989
BlockNumber nForkBlock[MAX_FORKNUM];
2990-
BlockNumber nBlocksToInvalidate = 0;
2990+
uint64 nBlocksToInvalidate = 0;
29912991

29922992
rnode = smgr_reln->smgr_rnode;
29932993

@@ -3111,7 +3111,7 @@ DropRelFileNodesAllBuffers(SMgrRelation *smgr_reln, int nnodes)
31113111
int n = 0;
31123112
SMgrRelation *rels;
31133113
BlockNumber (*block)[MAX_FORKNUM + 1];
3114-
BlockNumber nBlocksToInvalidate = 0;
3114+
uint64 nBlocksToInvalidate = 0;
31153115
RelFileNode *nodes;
31163116
bool cached = true;
31173117
bool use_bsearch;

0 commit comments

Comments
 (0)