</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>
</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>
static DataChecksumsWorkerResult ProcessDatabase(DataChecksumsWorkerDatabase *db);
static bool ProcessAllDatabases(void);
static bool ProcessSingleRelationFork(Relation reln, ForkNumber forkNum, BufferAccessStrategy strategy);
+static void ResetDataChecksumsProgressCounters(void);
static void launcher_cancel_handler(SIGNAL_ARGS);
static void WaitForAllTransactionsToFinish(void);
snprintf(activity, sizeof(activity) - 1, "processing: %s.%s (%s, %u blocks)",
(relns ? relns : ""), RelationGetRelationName(reln), forkNames[forkNum], numblocks);
pgstat_report_activity(STATE_RUNNING, activity);
- pgstat_progress_update_param(PROGRESS_DATACHECKSUMS_BLOCKS_TOTAL, numblocks);
+ {
+ const int index[] = {
+ PROGRESS_DATACHECKSUMS_BLOCKS_TOTAL,
+ PROGRESS_DATACHECKSUMS_BLOCKS_DONE
+ };
+
+ int64 vals[2];
+
+ vals[0] = numblocks;
+ vals[1] = 0;
+
+ pgstat_progress_update_multi_param(2, index, vals);
+ }
if (relns)
pfree(relns);
return true;
}
+/*
+ * Initialize all data checksum progress counters to be displayed as NULL.
+ */
+static void
+ResetDataChecksumsProgressCounters(void)
+{
+ const int index[] = {
+ PROGRESS_DATACHECKSUMS_DBS_TOTAL,
+ PROGRESS_DATACHECKSUMS_DBS_DONE,
+ PROGRESS_DATACHECKSUMS_RELS_TOTAL,
+ PROGRESS_DATACHECKSUMS_RELS_DONE,
+ PROGRESS_DATACHECKSUMS_BLOCKS_TOTAL,
+ PROGRESS_DATACHECKSUMS_BLOCKS_DONE,
+ };
+
+ int64 vals[lengthof(index)];
+
+ for (int i = 0; i < lengthof(index); i++)
+ vals[i] = -1;
+
+ pgstat_progress_update_multi_param(lengthof(index), index, vals);
+}
+
/*
* ProcessSingleRelationByOid
* Process a single relation based on oid.
pgstat_progress_start_command(PROGRESS_COMMAND_DATACHECKSUMS,
InvalidOid);
+ ResetDataChecksumsProgressCounters();
if (operation == ENABLE_DATACHECKSUMS)
{
const int index[] = {
PROGRESS_DATACHECKSUMS_DBS_TOTAL,
PROGRESS_DATACHECKSUMS_DBS_DONE,
- PROGRESS_DATACHECKSUMS_RELS_TOTAL,
- PROGRESS_DATACHECKSUMS_RELS_DONE,
- PROGRESS_DATACHECKSUMS_BLOCKS_TOTAL,
- PROGRESS_DATACHECKSUMS_BLOCKS_DONE,
};
- int64 vals[6];
+ int64 vals[2];
vals[0] = list_length(DatabaseList);
vals[1] = 0;
- /* translated to NULL */
- vals[2] = -1;
- vals[3] = -1;
- vals[4] = -1;
- vals[5] = -1;
- pgstat_progress_update_multi_param(6, index, vals);
+ pgstat_progress_update_multi_param(2, index, vals);
}
foreach_ptr(DataChecksumsWorkerDatabase, db, DatabaseList)
/* worker will have a separate entry in pg_stat_progress_data_checksums */
pgstat_progress_start_command(PROGRESS_COMMAND_DATACHECKSUMS,
InvalidOid);
+ ResetDataChecksumsProgressCounters();
/*
* Get a list of all temp tables present as we start in this database. We