You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-06 08:49:29 +02:00
Add block incremental test where timestamp changes but file is the same.
If delta is not enabled, then the timestamp is used to determine if a file has changed. If the timestamp changes but the file is the same then the prior map will be stored unchanged in the new backup. This is not quite as bad as storing the entire file but it is obviously not ideal. This will be fixed in a future commit, but add the test now to show the current behavior.
This commit is contained in:
@@ -3450,6 +3450,13 @@ testRun(void)
|
||||
|
||||
HRN_STORAGE_PUT(storagePgWrite(), "block-incr-shrink", file, .timeModified = backupTimeStart);
|
||||
|
||||
// File that remains the same between backups
|
||||
file = bufNew(BLOCK_MIN_FILE_SIZE);
|
||||
memset(bufPtr(file), 33, bufSize(file));
|
||||
bufUsedSet(file, bufSize(file));
|
||||
|
||||
HRN_STORAGE_PUT(storagePgWrite(), "block-incr-same", file, .timeModified = backupTimeStart);
|
||||
|
||||
// File that grows above the limit
|
||||
file = bufNew(BLOCK_MIN_FILE_SIZE - 1);
|
||||
memset(bufPtr(file), 77, bufSize(file));
|
||||
@@ -3490,20 +3497,22 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/grow-to-block-incr (bundle 1/0, 16.0KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/16383, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-shrink (bundle 1/24575, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/40989, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-same (bundle 1/40989, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/57395, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DBF06000000001, lsn = 5dbf060/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 DETAIL: wrote 'tablespace_map' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DBF06000000000:0000000105DBF06000000001\n"
|
||||
"P00 INFO: new backup label = 20191103-165320F\n"
|
||||
"P00 INFO: full backup size = [SIZE], file total = 7");
|
||||
"P00 INFO: full backup size = [SIZE], file total = 8");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
testBackupValidateP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")),
|
||||
". {link, d=20191103-165320F}\n"
|
||||
"bundle {path}\n"
|
||||
"bundle/1/pg_data/PG_VERSION {file, s=2}\n"
|
||||
"bundle/1/pg_data/block-incr-same {file, m=0:{0,1}, s=16384}\n"
|
||||
"bundle/1/pg_data/block-incr-shrink {file, m=0:{0,1,2}, s=16385}\n"
|
||||
"bundle/1/pg_data/global/pg_control {file, s=8192}\n"
|
||||
"bundle/1/pg_data/grow-to-block-incr {file, s=16383}\n"
|
||||
@@ -3522,6 +3531,8 @@ testRun(void)
|
||||
",\"timestamp\":1572800002}\n"
|
||||
"pg_data/block-incr-grow={\"bi\":1,\"bim\":24,\"checksum\":\"ebdd38b69cd5b9f2d00d273c981e16960fbbb4f7\""
|
||||
",\"size\":24576,\"timestamp\":1572800000}\n"
|
||||
"pg_data/block-incr-same={\"bi\":1,\"bim\":22,\"checksum\":\"5d389611c12c8b8d2c28d4e590799c016b9375be\""
|
||||
",\"size\":16384,\"timestamp\":1572800000}\n"
|
||||
"pg_data/block-incr-shrink={\"bi\":1,\"bim\":29,\"checksum\":\"ce5f8864058b1bb274244b512cb9641355987134\""
|
||||
",\"size\":16385,\"timestamp\":1572800000}\n"
|
||||
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1572800000}\n"
|
||||
@@ -3582,6 +3593,9 @@ testRun(void)
|
||||
|
||||
HRN_STORAGE_PUT(storagePgWrite(), "block-incr-shrink", file, .timeModified = backupTimeStart);
|
||||
|
||||
// Update timestamp without changing contents of the file
|
||||
HRN_STORAGE_TIME(storagePgWrite(), "block-incr-same", backupTimeStart);
|
||||
|
||||
// Grow file above the limit
|
||||
file = bufNew(BLOCK_MIN_FILE_SIZE + 1);
|
||||
memset(bufPtr(file), 77, bufSize(file));
|
||||
@@ -3612,6 +3626,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/grow-to-block-incr (bundle 1/0, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/16411, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-shrink (bundle 1/24603, 16.0KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-same (bundle 1/40986, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191103-165320F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC213000000001, lsn = 5dc2130/300000\n"
|
||||
@@ -3619,12 +3634,13 @@ testRun(void)
|
||||
"P00 DETAIL: wrote 'tablespace_map' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC213000000000:0000000105DC213000000001\n"
|
||||
"P00 INFO: new backup label = 20191103-165320F_20191106-002640D\n"
|
||||
"P00 INFO: diff backup size = [SIZE], file total = 9");
|
||||
"P00 INFO: diff backup size = [SIZE], file total = 10");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
testBackupValidateP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")),
|
||||
". {link, d=20191103-165320F_20191106-002640D}\n"
|
||||
"bundle {path}\n"
|
||||
"bundle/1/pg_data/block-incr-same {file, m=0:{0,1}, s=16384}\n"
|
||||
"bundle/1/pg_data/block-incr-shrink {file, s=16383}\n"
|
||||
"bundle/1/pg_data/global/pg_control {file, s=8192}\n"
|
||||
"bundle/1/pg_data/grow-to-block-incr {file, m=1:{0,1,2}, s=16385}\n"
|
||||
@@ -3647,6 +3663,8 @@ testRun(void)
|
||||
",\"size\":131072,\"timestamp\":1573000000}\n"
|
||||
"pg_data/block-incr-larger={\"bi\":8,\"bic\":7,\"bim\":173"
|
||||
",\"checksum\":\"eec53a6da79c00b3c658a7e09f44b3e9efefd960\",\"size\":1507328,\"timestamp\":1573000000}\n"
|
||||
"pg_data/block-incr-same={\"bi\":1,\"bim\":22,\"checksum\":\"5d389611c12c8b8d2c28d4e590799c016b9375be\""
|
||||
",\"size\":16384,\"timestamp\":1573000000}\n"
|
||||
"pg_data/block-incr-shrink={\"checksum\":\"1c6a17f67562d8b3f64f1b5f2ee592a4c2809b3b\",\"size\":16383"
|
||||
",\"timestamp\":1573000000}\n"
|
||||
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1573000000}\n"
|
||||
@@ -3663,6 +3681,7 @@ testRun(void)
|
||||
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "block-incr-grow");
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "block-incr-larger");
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "block-incr-same");
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "block-incr-shrink");
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "grow-to-block-incr");
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "truncate-to-zero");
|
||||
|
||||
Reference in New Issue
Block a user