MCPcopy Create free account
hub / github.com/apache/cloudberry / update_basebackup_progress

Function update_basebackup_progress

src/backend/replication/basebackup.c:2168–2194  ·  view source on GitHub ↗

* Increment the counter for the amount of data already streamed * by the given number of bytes, and update the progress report for * pg_stat_progress_basebackup. */

Source from the content-addressed store, hash-verified

2166 * pg_stat_progress_basebackup.
2167 */
2168static void
2169update_basebackup_progress(int64 delta)
2170{
2171 const int index[] = {
2172 PROGRESS_BASEBACKUP_BACKUP_STREAMED,
2173 PROGRESS_BASEBACKUP_BACKUP_TOTAL
2174 };
2175 int64 val[2];
2176 int nparam = 0;
2177
2178 backup_streamed += delta;
2179 val[nparam++] = backup_streamed;
2180
2181 /*
2182 * Avoid overflowing past 100% or the full size. This may make the total
2183 * size number change as we approach the end of the backup (the estimate
2184 * will always be wrong if WAL is included), but that's better than having
2185 * the done column be bigger than the total.
2186 */
2187 if (backup_total > -1 && backup_streamed > backup_total)
2188 {
2189 backup_total = backup_streamed;
2190 val[nparam++] = backup_total;
2191 }
2192
2193 pgstat_progress_update_multi_param(nparam, index, val);
2194}
2195
2196/*
2197 * Read some data from a file, setting a wait event and reporting any error

Callers 4

perform_base_backupFunction · 0.85
sendFileWithContentFunction · 0.85
sendFileFunction · 0.85
_tarWriteHeaderFunction · 0.85

Calls 1

Tested by

no test coverage detected