1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Skip zero-length files for block incremental delta restore.

a42614e introduced the capability to preserve smaller than expected files for block incremental restore delta, but failed to take into account that zero-length files are both useless and cause the block checksum filter to error.

Fix this by skipping zero-length files during block incremental restore delta.
This commit is contained in:
David Steele
2024-03-02 12:29:10 +13:00
committed by GitHub
parent 6c45b57fa8
commit f7a7ab16c9
4 changed files with 42 additions and 2 deletions
+12
View File
@@ -3165,6 +3165,13 @@ testRun(void)
HRN_STORAGE_PUT(storagePgWrite(), PG_PATH_BASE "/1/2", relation, .timeModified = timeBase - 2);
// Zeroed file large enough to use block incr (that will be truncated to zero before restore)
relation = bufNew(16 * 1024);
memset(bufPtr(relation), 0, bufSize(relation));
bufUsedSet(relation, bufSize(relation));
HRN_STORAGE_PUT(storagePgWrite(), PG_PATH_BASE "/1/44", relation, .timeModified = timeBase - 2);
// Add postgresql.auto.conf to contain recovery settings
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_FILE_POSTGRESQLAUTOCONF, .timeModified = timeBase - 1);
@@ -3234,6 +3241,7 @@ testRun(void)
"base/1/\n"
"base/1/2\n"
"base/1/3\n"
"base/1/44\n"
"global/\n"
"global/pg_control\n"
"postgresql.auto.conf\n",
@@ -3245,6 +3253,9 @@ testRun(void)
// Use detail log level to catch block incremental restore message
harnessLogLevelSet(logLevelDetail);
// Truncate file to ensure delta is skipped
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_PATH_BASE "/1/44");
// Shrink file to make sure block incremental delta will reuse it
relation = bufNew(128 * 1024);
memset(bufPtr(relation), 0, bufSize(relation));
@@ -3271,6 +3282,7 @@ testRun(void)
"base/1/\n"
"base/1/2\n"
"base/1/3\n"
"base/1/44\n"
"global/\n"
"global/pg_control\n"
"postgresql.auto.conf\n",