1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-07 00:35:37 +02:00

Show backup percent complete in info output.

In the JSON output the percent complete is storage as an integer of the percent complete * 100. So, before display it should be converted to double and divided by 100, or split using integer mod and div.

Note that percent complete will only be displayed on the host where the backup was executed. Remote hosts will show a backup/expire running with no percent complete.
This commit is contained in:
Reid Thompson
2022-05-04 12:52:05 -04:00
committed by GitHub
parent 20782c88bc
commit d9088b2e2b
13 changed files with 347 additions and 139 deletions

View File

@ -358,7 +358,7 @@ testRun(void)
"text - multi-repo, single stanza, one wal segment");
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("coverage for stanzaStatus branches");
TEST_TITLE("coverage for stanzaStatus branches && percent complete null");
// Db1 and Db3 (from above) have same system-id and db-version so consider them the same for WAL reporting
HRN_STORAGE_PUT_EMPTY(
@ -424,6 +424,7 @@ testRun(void)
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza1"), STRDEF("777-afafafaf"), lockTypeBackup, 0, true),
-1, "create backup/expire lock");
TEST_RESULT_VOID(lockWriteDataP(lockTypeBackup), "write lock data");
// Notify parent that lock has been acquired
HRN_FORK_CHILD_NOTIFY_PUT();
@ -617,7 +618,7 @@ testRun(void)
// backup.info/archive.info files exist, backups exist, archives exist, multi-repo (mixed) with one stanza existing on both
// repos and the db history is different between the repos
//--------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("mixed multi-repo");
TEST_TITLE("mixed multi-repo, percent complete non-null");
HRN_INFO_PUT(
storageTest, TEST_PATH "/repo/" STORAGE_PATH_ARCHIVE "/stanza1/" INFO_ARCHIVE_FILE,
@ -1015,6 +1016,7 @@ testRun(void)
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
-1, "create backup/expire lock");
TEST_RESULT_VOID(lockWriteDataP(lockTypeBackup, .percentComplete = VARUINT(4545)), "write lock data");
// Notify parent that lock has been acquired
HRN_FORK_CHILD_NOTIFY_PUT();
@ -1447,6 +1449,7 @@ testRun(void)
TEST_RESULT_INT_NE(
lockAcquire(cfgOptionStr(cfgOptLockPath), STRDEF("stanza2"), STRDEF("999-ffffffff"), lockTypeBackup, 0, true),
-1, "create backup/expire lock");
TEST_RESULT_VOID(lockWriteDataP(lockTypeBackup, .percentComplete = VARUINT(5555)), "write lock data");
// Notify parent that lock has been acquired
HRN_FORK_CHILD_NOTIFY_PUT();
@ -1519,7 +1522,7 @@ testRun(void)
" backup reference list: 20201116-155000F\n"
"\n"
"stanza: stanza2\n"
" status: mixed (backup/expire running)\n"
" status: mixed (backup/expire running - 55.55% complete)\n"
" repo1: error (no valid backups)\n"
" repo2: error (missing stanza path)\n"
" cipher: mixed\n"