1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-23 03:21:12 +03:00

Fix size overflow in calculation introduced by commits d6ad34f3 and bea449c6.

Reported-by: Thomas Munro
Author: Takayuki Tsunakawa
Reviewed-by: Kyotaro Horiguchi
Discussion: https://postgr.es/m/CA+hUKG+oPoFizjABt=GXZWTEHx3oev5rAe2scjW2r6F1rguo5w@mail.gmail.com
This commit is contained in:
Amit Kapila
2021-03-12 15:42:08 +05:30
parent e2cda3c20a
commit 519e4c9ee2

@ -76,7 +76,7 @@
* being dropped. For the relations with size below this threshold, we find * being dropped. For the relations with size below this threshold, we find
* the buffers by doing lookups in BufMapping table. * the buffers by doing lookups in BufMapping table.
*/ */
#define BUF_DROP_FULL_SCAN_THRESHOLD (uint32) (NBuffers / 32) #define BUF_DROP_FULL_SCAN_THRESHOLD (uint64) (NBuffers / 32)
typedef struct PrivateRefCountEntry typedef struct PrivateRefCountEntry
{ {
@ -2987,7 +2987,7 @@ DropRelFileNodeBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
int j; int j;
RelFileNodeBackend rnode; RelFileNodeBackend rnode;
BlockNumber nForkBlock[MAX_FORKNUM]; BlockNumber nForkBlock[MAX_FORKNUM];
BlockNumber nBlocksToInvalidate = 0; uint64 nBlocksToInvalidate = 0;
rnode = smgr_reln->smgr_rnode; rnode = smgr_reln->smgr_rnode;
@ -3111,7 +3111,7 @@ DropRelFileNodesAllBuffers(SMgrRelation *smgr_reln, int nnodes)
int n = 0; int n = 0;
SMgrRelation *rels; SMgrRelation *rels;
BlockNumber (*block)[MAX_FORKNUM + 1]; BlockNumber (*block)[MAX_FORKNUM + 1];
BlockNumber nBlocksToInvalidate = 0; uint64 nBlocksToInvalidate = 0;
RelFileNode *nodes; RelFileNode *nodes;
bool cached = true; bool cached = true;
bool use_bsearch; bool use_bsearch;