1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Fix data checksum progress counter initialization

pg_stat_progress_data_checksums uses -1 as a sentinel value that is
displayed as NULL for progress counters. However, after
pgstat_progress_start_command() initialized all progress counters to
zero, data checksum progress did not reset those counters to -1.
As a result, some counters could incorrectly appear as zero instead
of NULL. For example, workers could report zero database counters,
and the disabling launcher could report zero relation and block counters.

Also, blocks_done was not reset when a worker started processing
a new relation fork. As a result, it could temporarily exceed blocks_total
or report a stale value for an empty relation fork.

Fix this by initializing the data checksum progress counters to -1
when progress reporting starts for both launcher and worker processes.
Also reset blocks_done together with blocks_total when starting each
relation fork.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAHGQGwEOQyEzW2cqrHEzvwbcsAsuH8MEe7MMidFOFxECy0E1_Q@mail.gmail.com
Backpatch-through: 19
This commit is contained in:
Fujii Masao
2026-07-10 22:32:53 +09:00
parent 2bbec7c49a
commit 9d1d91a143
4 changed files with 50 additions and 18 deletions

View File

@@ -7945,8 +7945,8 @@ FROM pg_stat_get_backend_idset() AS backendid;
</para>
<para>
The total number of databases which will be processed. Only the
launcher process has this value set, the worker processes have this
set to <literal>NULL</literal>.
launcher process has this value set when enabling data checksums;
otherwise this is set to <literal>NULL</literal>.
</para>
</entry>
</row>
@@ -7958,8 +7958,8 @@ FROM pg_stat_get_backend_idset() AS backendid;
</para>
<para>
The number of databases which have been processed. Only the launcher
process has this value set, the worker processes have this set to
<literal>NULL</literal>.
process has this value set when enabling data checksums; otherwise
this is set to <literal>NULL</literal>.
</para>
</entry>
</row>