1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-06-27 00:21:08 +02:00

Require storage when calling pgControlFromFile().

Previously storageLocal() was being used internally but loading pg_control from remote storage is often required.

Also, storagePg() is more appropriate than storageLocal() for all current usage.

Contributed by Cynthia Shang.
This commit is contained in:
Cynthia Shang
2019-08-21 11:29:30 -04:00
committed by David Steele
parent 286a106ae4
commit 6a09d9294d
8 changed files with 31 additions and 27 deletions

View File

@ -60,7 +60,7 @@ testRun(void)
pgControlTestToBuffer((PgControl){.version = PG_VERSION_11, .systemId = 0xFACEFACE, .walSegmentSize = 1024 * 1024}));
PgControl info = {0};
TEST_ASSIGN(info, pgControlFromFile(strNew(testPath())), "get control info v11");
TEST_ASSIGN(info, pgControlFromFile(storageTest, strNew(testPath())), "get control info v11");
TEST_RESULT_INT(info.systemId, 0xFACEFACE, " check system id");
TEST_RESULT_INT(info.controlVersion, 1100, " check control version");
TEST_RESULT_INT(info.catalogVersion, 201809051, " check catalog version");
@ -72,7 +72,7 @@ testRun(void)
pgControlTestToBuffer((PgControl){.version = PG_VERSION_93, .walSegmentSize = 1024 * 1024}));
TEST_ERROR(
pgControlFromFile(strNew(testPath())), FormatError,
pgControlFromFile(storageTest, strNew(testPath())), FormatError,
"wal segment size is 1048576 but must be 16777216 for PostgreSQL <= 10");
//--------------------------------------------------------------------------------------------------------------------------
@ -80,14 +80,14 @@ testRun(void)
storageNewWriteNP(storageTest, controlFile),
pgControlTestToBuffer((PgControl){.version = PG_VERSION_95, .pageSize = 32 * 1024}));
TEST_ERROR(pgControlFromFile(strNew(testPath())), FormatError, "page size is 32768 but must be 8192");
TEST_ERROR(pgControlFromFile(storageTest, strNew(testPath())), FormatError, "page size is 32768 but must be 8192");
//--------------------------------------------------------------------------------------------------------------------------
storagePutNP(
storageNewWriteNP(storageTest, controlFile),
pgControlTestToBuffer((PgControl){.version = PG_VERSION_83, .systemId = 0xEFEFEFEFEF}));
TEST_ASSIGN(info, pgControlFromFile(strNew(testPath())), "get control info v83");
TEST_ASSIGN(info, pgControlFromFile(storageTest, strNew(testPath())), "get control info v83");
TEST_RESULT_INT(info.systemId, 0xEFEFEFEFEF, " check system id");
TEST_RESULT_INT(info.controlVersion, 833, " check control version");
TEST_RESULT_INT(info.catalogVersion, 200711281, " check catalog version");