Skip to content

Commit 9847ca2

Browse files
committed
Standardize type of extend_by counter
The counter of extend_by loops is mixed int and uint32. Fix by standardizing from int to uint32, to match the extend_by variable. Fixup for 31966b1. Author: Ranier Vilela <ranier.vf@gmail.com> Reviewed-by: Gurjeet Singh <gurjeet@singh.im> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAEudQAqHG-JP-YnG54ftL_b7v6-57rMKwET_MSvEoen0UHuPig@mail.gmail.com
1 parent 78a33bb commit 9847ca2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/backend/storage/buffer/bufmgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
955955
current_size = first_block + extended_by;
956956
Assert(num_pages != 0 || current_size >= extend_to);
957957

958-
for (int i = 0; i < extended_by; i++)
958+
for (uint32 i = 0; i < extended_by; i++)
959959
{
960960
if (first_block + i != extend_to - 1)
961961
ReleaseBuffer(buffers[i]);
@@ -1938,7 +1938,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
19381938
* This needs to happen before we extend the relation, because as soon as
19391939
* we do, other backends can start to read in those pages.
19401940
*/
1941-
for (int i = 0; i < extend_by; i++)
1941+
for (uint32 i = 0; i < extend_by; i++)
19421942
{
19431943
Buffer victim_buf = buffers[i];
19441944
BufferDesc *victim_buf_hdr = GetBufferDescriptor(victim_buf - 1);
@@ -2070,7 +2070,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
20702070
io_start, extend_by);
20712071

20722072
/* Set BM_VALID, terminate IO, and wake up any waiters */
2073-
for (int i = 0; i < extend_by; i++)
2073+
for (uint32 i = 0; i < extend_by; i++)
20742074
{
20752075
Buffer buf = buffers[i];
20762076
BufferDesc *buf_hdr = GetBufferDescriptor(buf - 1);

src/backend/storage/buffer/localbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
360360
relpath(bmr.smgr->smgr_rlocator, fork),
361361
MaxBlockNumber)));
362362

363-
for (int i = 0; i < extend_by; i++)
363+
for (uint32 i = 0; i < extend_by; i++)
364364
{
365365
int victim_buf_id;
366366
BufferDesc *victim_buf_hdr;
@@ -416,7 +416,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
416416
pgstat_count_io_op_time(IOOBJECT_TEMP_RELATION, IOCONTEXT_NORMAL, IOOP_EXTEND,
417417
io_start, extend_by);
418418

419-
for (int i = 0; i < extend_by; i++)
419+
for (uint32 i = 0; i < extend_by; i++)
420420
{
421421
Buffer buf = buffers[i];
422422
BufferDesc *buf_hdr;

0 commit comments

Comments
 (0)