[patch] CLUSTER blocks scanned progress reporting
Matthias van de Meent <boekewurm+postgres@gmail.com>
From: Matthias van de Meent <boekewurm+postgres@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-11-20T17:32:44Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-CLUSTER-progress-reporting-of-number-of-block.patch (text/x-patch) patch v1-0001
Hi, The pg_stat_progress_cluster view can report incorrect heap_blks_scanned values when synchronize_seqscans is enabled, because it allows the sequential heap scan to not start at block 0. This can result in wraparounds in the heap_blks_scanned column when the table scan wraps around, and starting the next phase with heap_blks_scanned != heap_blks_total. This issue was introduced with the pg_stat_progress_cluster view. The attached patch fixes the issue by accounting for a non-0 heapScan->rs_startblock and calculating the correct number with a non-0 heapScan->rs_startblock in mind. The issue is reproducible starting from PG12 by stopping a CLUSTER-command while it is sequential-scanning the table (seqscan enforceable through enable_indexscan = off), and then re-starting the seqscanning CLUSTER command (without other load/seq-scans on the table). Any thoughts? Matthias van de Meent
Commits
-
Fix CLUSTER progress reporting of number of blocks scanned.
- fce17e486f35 12.6 landed
- dcc20946a8fc 13.2 landed
- 3df51ca8b39f 14.0 landed