postgres.git / summary / log / commit / refs

commit    99ea4a55270d5ce48bc33b9daf5d641818e03b89
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Tue Oct 27 03:12:47 2026 +0000

    Count the last block of the validation scan in a concurrent index build
    
    heapam_index_validate_scan() reports PROGRESS_SCAN_BLOCKS_DONE as the
    number of the block that the scan starts on, forgetting to count the
    last block scanned.
    
    Due to the last block not being counted, the number of blocks_done never
    matched blocks_total.  This information could remain on the view for a
    long time, depending on the waits done between the phases of CREATE
    INDEX CONCURRENTLY or REINDEX CONCURRENTLY.
    
    This is incorrect still purely cosmetic, so no backpatch is done.
    
    Author: Manu <manuelreyesbravo@gmail.com>
    Discussion: https://postgr.es/m/179303526069.2212386.7608335332316408826@gmail.com


src/backend/access/heap/heapam_handler.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 7d2065dec37..05a81e4557a 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -1931,6 +1931,10 @@ heapam_index_validate_scan(Relation heapRelation, } } + /* Report scan progress, one last time. */ + pgstat_progress_update_param(PROGRESS_SCAN_BLOCKS_DONE, + hscan->rs_nblocks); + table_endscan(scan); ExecDropSingleTupleTableSlot(slot); [parent: 8474bae2ba4c]