Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Standardize type of extend_by counter
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Sep 2023 07:46:01 +0000 (09:46 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Sep 2023 07:46:01 +0000 (09:46 +0200)
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
src/backend/storage/buffer/localbuf.c

index 8116f95595abf8c69b8cdb8fdd849c23a721c214..8b96759b84f46cc0eaf939e935fb1af8a57e68dc 100644 (file)
@@ -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);
index 567b8d15ef0aa6d4b0e223595b320e60011d4fa2..9f20dca121247c2f4731bd6f7d46dee80f6829d7 100644 (file)
@@ -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;