REINDEX CONCURRENTLY reports lockers_done > lockers_total
Hi,
While REINDEX CONCURRENTLY is "waiting for readers before marking
dead", pg_stat_progress_create_index can show lockers_done greater
than lockers_total (2 and 1 with the attached script), though the
docs say these columns contain the progress information for the
current phase.
WaitForOlderSnapshots() leaves lockers_total, lockers_done and
current_locker_pid set when it returns, while WaitForLockersMultiple()
resets all three. Both only set lockers_total when they start, so the
wait that comes next inherits the other two.
The attached patch resets them in WaitForOlderSnapshots() the same
way. The same code is in 14 to 19.
Found with the progress trace from [1]/messages/by-id/179381939119.1041924.8156751512243472203@gmail.com.
[1]: /messages/by-id/179381939119.1041924.8156751512243472203@gmail.com
--
Manu
On Tue, Nov 17, 2026 at 02:24:48AM -0300, Manu wrote:
While REINDEX CONCURRENTLY is "waiting for readers before marking
dead", pg_stat_progress_create_index can show lockers_done greater
than lockers_total (2 and 1 with the attached script), though the
docs say these columns contain the progress information for the
current phase.WaitForOlderSnapshots() leaves lockers_total, lockers_done and
current_locker_pid set when it returns, while WaitForLockersMultiple()
resets all three. Both only set lockers_total when they start, so the
wait that comes next inherits the other two.
Hmm, yes. That leads to a temporary glitch in the progress view.
I've applied that on HEAD. Thanks.
--
Michael