postgres.git / summary / log / commit / refs
commit 9847ca2c79bef27b9bab44b2243fe951b7c62b36
Author: Peter Eisentraut <peter@eisentraut.org>
Date: Tue Sep 19 07:46:01 2023 +0000
First released in: 17.0
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 31966b151e.
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
src/backend/storage/buffer/bufmgr.c | 6 +++---
src/backend/storage/buffer/localbuf.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 8116f95595a..8b96759b84f 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -955,7 +955,7 @@ ExtendBufferedRelTo(BufferManagerRelation bmr,
current_size = first_block + extended_by;
Assert(num_pages != 0 || current_size >= extend_to);
- for (int i = 0; i < extended_by; i++)
+ for (uint32 i = 0; i < extended_by; i++)
{
if (first_block + i != extend_to - 1)
ReleaseBuffer(buffers[i]);
@@ -1938,7 +1938,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
* This needs to happen before we extend the relation, because as soon as
* we do, other backends can start to read in those pages.
*/
- for (int i = 0; i < extend_by; i++)
+ for (uint32 i = 0; i < extend_by; i++)
{
Buffer victim_buf = buffers[i];
BufferDesc *victim_buf_hdr = GetBufferDescriptor(victim_buf - 1);
@@ -2070,7 +2070,7 @@ ExtendBufferedRelShared(BufferManagerRelation bmr,
io_start, extend_by);
/* Set BM_VALID, terminate IO, and wake up any waiters */
- for (int i = 0; i < extend_by; i++)
+ for (uint32 i = 0; i < extend_by; i++)
{
Buffer buf = buffers[i];
BufferDesc *buf_hdr = GetBufferDescriptor(buf - 1);
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 567b8d15ef0..9f20dca1212 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -360,7 +360,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
relpath(bmr.smgr->smgr_rlocator, fork),
MaxBlockNumber)));
- for (int i = 0; i < extend_by; i++)
+ for (uint32 i = 0; i < extend_by; i++)
{
int victim_buf_id;
BufferDesc *victim_buf_hdr;
@@ -416,7 +416,7 @@ ExtendBufferedRelLocal(BufferManagerRelation bmr,
pgstat_count_io_op_time(IOOBJECT_TEMP_RELATION, IOCONTEXT_NORMAL, IOOP_EXTEND,
io_start, extend_by);
- for (int i = 0; i < extend_by; i++)
+ for (uint32 i = 0; i < extend_by; i++)
{
Buffer buf = buffers[i];
BufferDesc *buf_hdr;
[parent: 78a33bba4c63]