aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2021-03-12 15:42:08 +0530
committerAmit Kapila <akapila@postgresql.org>2021-03-12 15:42:08 +0530
commit519e4c9ee21a656879123f4843f1d8d60cb71536 (patch)
treeb8ccf9c91e4d78e15c51c1c565ce62b46571eb4d /src
parente2cda3c20a61c76e497fb2ebb6d2b2ae8c43c014 (diff)
downloadpostgresql-519e4c9ee21a656879123f4843f1d8d60cb71536.tar.gz
postgresql-519e4c9ee21a656879123f4843f1d8d60cb71536.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/buffer/bufmgr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 4c1d5eceb4d..e4d257e1c52 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -76,7 +76,7 @@
* being dropped. For the relations with size below this threshold, we find
* 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
{
@@ -2987,7 +2987,7 @@ DropRelFileNodeBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum,
int j;
RelFileNodeBackend rnode;
BlockNumber nForkBlock[MAX_FORKNUM];
- BlockNumber nBlocksToInvalidate = 0;
+ uint64 nBlocksToInvalidate = 0;
rnode = smgr_reln->smgr_rnode;
@@ -3111,7 +3111,7 @@ DropRelFileNodesAllBuffers(SMgrRelation *smgr_reln, int nnodes)
int n = 0;
SMgrRelation *rels;
BlockNumber (*block)[MAX_FORKNUM + 1];
- BlockNumber nBlocksToInvalidate = 0;
+ uint64 nBlocksToInvalidate = 0;
RelFileNode *nodes;
bool cached = true;
bool use_bsearch;