1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Rename block incremental manifest keys.

Since the keys need to be read/written in order, these keys make the logic a bit simpler.
This commit is contained in:
David Steele 2023-02-26 16:13:44 +07:00
parent a9867cb0b8
commit 16ac5ee8d3
6 changed files with 36 additions and 33 deletions

View File

@ -24,6 +24,7 @@
<commit subject="Consistently declare block incremental size as size_t."/>
<commit subject="Rename DeltaMap to BlockHash."/>
<commit subject="Add repo-block-age-map and repo-block-size-map options."/>
<commit subject="Rename block incremental manifest keys."/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>

View File

@ -1799,8 +1799,8 @@ manifestBuildComplete(
#define MANIFEST_KEY_BACKUP_TIMESTAMP_START "backup-timestamp-start"
#define MANIFEST_KEY_BACKUP_TIMESTAMP_STOP "backup-timestamp-stop"
#define MANIFEST_KEY_BACKUP_TYPE "backup-type"
#define MANIFEST_KEY_BLOCK_INCR_SIZE STRID5("bis", 0x4d220)
#define MANIFEST_KEY_BLOCK_INCR_MAP_SIZE STRID5("bims", 0x9b5220)
#define MANIFEST_KEY_BLOCK_INCR STRID5("bi", 0x1220)
#define MANIFEST_KEY_BLOCK_INCR_MAP STRID5("bim", 0x35220)
#define MANIFEST_KEY_BUNDLE_ID STRID5("bni", 0x25c20)
#define MANIFEST_KEY_BUNDLE_OFFSET STRID5("bno", 0x3dc20)
#define MANIFEST_KEY_CHECKSUM STRID5("checksum", 0x6d66b195030)
@ -1936,12 +1936,14 @@ manifestLoadCallback(void *callbackData, const String *const section, const Stri
jsonReadObjectBegin(json);
// Block incremental info
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BLOCK_INCR_MAP_SIZE))
file.blockIncrMapSize = jsonReadUInt64(json);
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BLOCK_INCR_SIZE))
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BLOCK_INCR))
{
file.blockIncrSize = (size_t)jsonReadUInt64(json) * BLOCK_INCR_SIZE_FACTOR;
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BLOCK_INCR_MAP))
file.blockIncrMapSize = jsonReadUInt64(json);
}
// Bundle info
if (jsonReadKeyExpectStrId(json, MANIFEST_KEY_BUNDLE_ID))
{
@ -2660,13 +2662,12 @@ manifestSaveCallback(void *const callbackData, const String *const sectionNext,
JsonWrite *const json = jsonWriteObjectBegin(jsonWriteNewP());
// Block incremental info
if (file.blockIncrMapSize != 0)
jsonWriteUInt64(jsonWriteKeyStrId(json, MANIFEST_KEY_BLOCK_INCR_MAP_SIZE), file.blockIncrMapSize);
if (file.blockIncrSize != 0)
{
jsonWriteUInt64(
jsonWriteKeyStrId(json, MANIFEST_KEY_BLOCK_INCR_SIZE), file.blockIncrSize / BLOCK_INCR_SIZE_FACTOR);
jsonWriteUInt64(jsonWriteKeyStrId(json, MANIFEST_KEY_BLOCK_INCR), file.blockIncrSize / BLOCK_INCR_SIZE_FACTOR);
if (file.blockIncrMapSize != 0)
jsonWriteUInt64(jsonWriteKeyStrId(json, MANIFEST_KEY_BLOCK_INCR_MAP), file.blockIncrMapSize);
}
// Bundle info

View File

@ -2011,17 +2011,17 @@ sub restoreCompare
${$oExpectedManifestRef}{&MANIFEST_SECTION_TARGET_FILE}{$strName}{size});
}
# Remove repo-size, bno, bni, bims, bis from the manifest
# Remove repo-size, bn*, bi* from the manifest
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, MANIFEST_SUBKEY_REPO_SIZE);
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{&MANIFEST_SUBKEY_REPO_SIZE});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bni");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bni"});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bno");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bno"});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bims");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bims"});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bis");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bis"});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bi");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bi"});
$oActualManifest->remove(MANIFEST_SECTION_TARGET_FILE, $strName, "bim");
delete($oExpectedManifestRef->{&MANIFEST_SECTION_TARGET_FILE}{$strName}{"bim"});
if ($oActualManifest->get(MANIFEST_SECTION_TARGET_FILE, $strName, MANIFEST_SUBKEY_SIZE) != 0)
{

View File

@ -3747,9 +3747,9 @@ testRun(void)
",\"timestamp\":1572800000}\n"
"pg_data/backup_label={\"checksum\":\"8e6f41ac87a7514be96260d65bacbffb11be77dc\",\"size\":17"
",\"timestamp\":1572800002}\n"
"pg_data/block-incr-grow={\"bims\":70,\"bis\":16,\"checksum\":\"b0d82b7805e85aa6447b94de7c2aa07077734581\""
"pg_data/block-incr-grow={\"bi\":16,\"bim\":70,\"checksum\":\"b0d82b7805e85aa6447b94de7c2aa07077734581\""
",\"size\":393216,\"timestamp\":1572800000}\n"
"pg_data/block-incr-shrink={\"bims\":53,\"bis\":16,\"checksum\":\"9c32e340aad633663fdc3a5b1151c46abbf927f0\""
"pg_data/block-incr-shrink={\"bi\":16,\"bim\":53,\"checksum\":\"9c32e340aad633663fdc3a5b1151c46abbf927f0\""
",\"size\":131073,\"timestamp\":1572800000}\n"
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1572800000}\n"
"pg_data/grow-to-block-incr={\"checksum\":\"f24ce50110bed53703bac93d9705d1e101c7cfeb\",\"size\":131071"
@ -3857,14 +3857,14 @@ testRun(void)
",\"size\":2,\"timestamp\":1572800000}\n"
"pg_data/backup_label={\"checksum\":\"8e6f41ac87a7514be96260d65bacbffb11be77dc\",\"size\":17"
",\"timestamp\":1573000002}\n"
"pg_data/block-incr-grow={\"bims\":347,\"bis\":16,\"checksum\":\"7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6\""
"pg_data/block-incr-grow={\"bi\":16,\"bim\":347,\"checksum\":\"7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6\""
",\"size\":2097152,\"timestamp\":1573000000}\n"
"pg_data/block-incr-larger={\"bims\":240,\"bis\":24,\"checksum\":\"7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6\""
"pg_data/block-incr-larger={\"bi\":24,\"bim\":240,\"checksum\":\"7d76d48d64d7ac5411d714a4bb83f37e3e5b8df6\""
",\"size\":2097152,\"timestamp\":1573000000}\n"
"pg_data/block-incr-shrink={\"checksum\":\"a8a85be0079c68c5c5a6ee743c44d853d6be12bb\",\"size\":131071"
",\"timestamp\":1573000000}\n"
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1573000000}\n"
"pg_data/grow-to-block-incr={\"bims\":51,\"bis\":16,\"checksum\":\"b616afbe703280742f9c6125b738d85c80fde971\""
"pg_data/grow-to-block-incr={\"bi\":16,\"bim\":51,\"checksum\":\"b616afbe703280742f9c6125b738d85c80fde971\""
",\"size\":131073,\"timestamp\":1573000000}\n"
"pg_data/tablespace_map={\"checksum\":\"87fe624d7976c2144e10afcb7a9a49b071f35e9c\",\"size\":19"
",\"timestamp\":1573000002}\n"
@ -3968,7 +3968,7 @@ testRun(void)
",\"timestamp\":1572800000}\n"
"pg_data/backup_label={\"checksum\":\"8e6f41ac87a7514be96260d65bacbffb11be77dc\",\"size\":17"
",\"timestamp\":1573200002}\n"
"pg_data/block-incr-grow={\"bims\":40,\"bis\":16,\"checksum\":\"67dfd19f3eb3649d6f3f6631e44d0bd36b8d8d19\""
"pg_data/block-incr-grow={\"bi\":16,\"bim\":40,\"checksum\":\"67dfd19f3eb3649d6f3f6631e44d0bd36b8d8d19\""
",\"size\":131072,\"timestamp\":1573200000}\n"
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1573200000}\n"
"pg_data/tablespace_map={\"checksum\":\"87fe624d7976c2144e10afcb7a9a49b071f35e9c\",\"size\":19"
@ -4059,9 +4059,9 @@ testRun(void)
",\"size\":2,\"timestamp\":1572800000}\n"
"pg_data/backup_label={\"checksum\":\"8e6f41ac87a7514be96260d65bacbffb11be77dc\",\"size\":17"
",\"timestamp\":1573400002}\n"
"pg_data/block-age-multiplier={\"bims\":40,\"bis\":32,\"checksum\":\"2e000fa7e85759c7f4c254d4d9c33ef481e459a7\""
"pg_data/block-age-multiplier={\"bi\":32,\"bim\":40,\"checksum\":\"2e000fa7e85759c7f4c254d4d9c33ef481e459a7\""
",\"size\":262144,\"timestamp\":1573313600}\n"
"pg_data/block-incr-grow={\"bims\":72,\"bis\":16,\"checksum\":\"2e000fa7e85759c7f4c254d4d9c33ef481e459a7\""
"pg_data/block-incr-grow={\"bi\":16,\"bim\":72,\"checksum\":\"2e000fa7e85759c7f4c254d4d9c33ef481e459a7\""
",\"size\":262144,\"timestamp\":1573400000}\n"
"pg_data/global/pg_control={\"size\":8192,\"timestamp\":1573400000}\n"
"pg_data/tablespace_map={\"checksum\":\"87fe624d7976c2144e10afcb7a9a49b071f35e9c\",\"size\":19"

View File

@ -410,10 +410,10 @@ testRun(void)
",\"timestamp\":1565282115}\n" \
"pg_data/base/32768/33000={\"checksum\":\"7a16d165e4775f7c92e8cdf60c0af57313f0bf90\",\"checksum-page\":true" \
",\"reference\":\"20190818-084502F\",\"size\":1073741824,\"timestamp\":1565282116}\n" \
"pg_data/base/32768/33000.32767={\"bims\":88,\"bis\":1,\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\"" \
"pg_data/base/32768/33000.32767={\"bi\":1,\"bim\":88,\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\"" \
",\"checksum-page\":true,\"reference\":\"20190818-084502F_20190819-084506I\",\"size\":32768" \
",\"timestamp\":1565282114}\n" \
"pg_data/postgresql.conf={\"bims\":12,\"bis\":1,\"checksum\":\"6721d92c9fcdf4248acff1f9a1377127d9064807\"" \
"pg_data/postgresql.conf={\"bi\":1,\"bim\":12,\"checksum\":\"6721d92c9fcdf4248acff1f9a1377127d9064807\"" \
",\"size\":4457,\"timestamp\":1565282114}\n" \
"pg_data/special={\"mode\":\"0640\",\"size\":0,\"timestamp\":1565282120,\"user\":false}\n" \
"pg_data/dupref={\"mode\":\"0640\",\"reference\":\"20190818-084502F\",\"size\":0" \

View File

@ -799,8 +799,8 @@ testRun(void)
"pg_data/postgresql.conf={\"file\":\"postgresql.conf\",\"path\":\"../config\",\"type\":\"link\"}\n"
"\n"
"[target:file]\n"
"pg_data/128k={\"bis\":16,\"size\":131072,\"timestamp\":1570000000}\n"
"pg_data/128k-1week={\"bis\":32,\"size\":131072,\"timestamp\":1569395200}\n"
"pg_data/128k={\"bi\":16,\"size\":131072,\"timestamp\":1570000000}\n"
"pg_data/128k-1week={\"bi\":32,\"size\":131072,\"timestamp\":1569395200}\n"
"pg_data/128k-4week={\"size\":131072,\"timestamp\":1567580800}\n"
"pg_data/PG_VERSION={\"size\":3,\"timestamp\":1565282100}\n"
"pg_data/base/1/555_init={\"size\":0,\"timestamp\":1565282114}\n"
@ -1376,8 +1376,8 @@ testRun(void)
"pg_data={\"path\":\"/pg\",\"type\":\"path\"}\n"
"\n"
"[target:file]\n"
"pg_data/block-incr-add={\"bis\":1,\"size\":6,\"timestamp\":1482182861}\n"
"pg_data/block-incr-keep-size={\"bims\":31,\"bis\":1,\"checksum\":\"ddddddddddbbbbbbbbbbccccccccccaaaaaaaaaa\""
"pg_data/block-incr-add={\"bi\":1,\"size\":6,\"timestamp\":1482182861}\n"
"pg_data/block-incr-keep-size={\"bi\":1,\"bim\":31,\"checksum\":\"ddddddddddbbbbbbbbbbccccccccccaaaaaaaaaa\""
",\"reference\":\"20190101-010101F\",\"repo-size\":4,\"size\":6,\"timestamp\":1482182861}\n"
"pg_data/block-incr-sub={\"size\":6,\"timestamp\":1482182861}\n"
TEST_MANIFEST_FILE_DEFAULT
@ -1552,13 +1552,14 @@ testRun(void)
"pg_data/PG_VERSION={\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\"" \
",\"rck\":\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"reference\":\"20190818-084502F_20190819-084506D\"" \
",\"size\":4,\"timestamp\":1565282114}\n" \
"pg_data/base/16384/17000={\"bni\":1,\"checksum\":\"e0101dd8ffb910c9c202ca35b5f828bcb9697bed\",\"checksum-page\":false"\
",\"checksum-page-error\":[1],\"repo-size\":4096,\"size\":8192,\"timestamp\":1565282114}\n" \
"pg_data/base/16384/17000={\"bi\":4,\"bni\":1,\"checksum\":\"e0101dd8ffb910c9c202ca35b5f828bcb9697bed\"" \
",\"checksum-page\":false,\"checksum-page-error\":[1],\"repo-size\":4096,\"size\":8192" \
",\"timestamp\":1565282114}\n" \
"pg_data/base/16384/PG_VERSION={\"bni\":1,\"bno\":1,\"checksum\":\"184473f470864e067ee3a22e64b47b0a1c356f29\"" \
",\"group\":\"group2\",\"size\":4,\"timestamp\":1565282115,\"user\":false}\n" \
"pg_data/base/32768/33000={\"checksum\":\"7a16d165e4775f7c92e8cdf60c0af57313f0bf90\",\"checksum-page\":true" \
",\"reference\":\"20190818-084502F\",\"size\":1073741824,\"timestamp\":1565282116}\n" \
"pg_data/base/32768/33000.32767={\"bims\":96,\"bis\":3,\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\"," \
"pg_data/base/32768/33000.32767={\"bi\":3,\"bim\":96,\"checksum\":\"6e99b589e550e68e934fd235ccba59fe5b592a9e\"," \
"\"checksum-page\":true,\"reference\":\"20190818-084502F\",\"size\":32768,\"timestamp\":1565282114}\n" \
"pg_data/postgresql.conf={\"size\":4457,\"timestamp\":1565282114}\n" \
"pg_data/special-@#!$^&*()_+~`{}[]\\:;={\"mode\":\"0640\",\"size\":0,\"timestamp\":1565282120,\"user\":false}\n"