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

Add storage parameter to pgWalFromFile().

This commit is contained in:
Cynthia Shang 2020-07-21 16:28:05 -04:00 committed by GitHub
parent ed88293861
commit 78ef442a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ archivePushFile(
// If this is a segment compare archive version and systemId to the WAL header // If this is a segment compare archive version and systemId to the WAL header
if (isSegment) if (isSegment)
{ {
PgWal walInfo = pgWalFromFile(walSource); PgWal walInfo = pgWalFromFile(walSource, storageLocal());
if (walInfo.version != pgVersion || walInfo.systemId != pgSystemId) if (walInfo.version != pgVersion || walInfo.systemId != pgSystemId)
{ {

View File

@ -549,7 +549,7 @@ pgWalFromBuffer(const Buffer *walBuffer)
} }
PgWal PgWal
pgWalFromFile(const String *walFile) pgWalFromFile(const String *walFile, const Storage *storage)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug); FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STRING, walFile); FUNCTION_LOG_PARAM(STRING, walFile);
@ -562,7 +562,7 @@ pgWalFromFile(const String *walFile)
MEM_CONTEXT_TEMP_BEGIN() MEM_CONTEXT_TEMP_BEGIN()
{ {
// Read WAL segment header // Read WAL segment header
Buffer *walBuffer = storageGetP(storageNewReadP(storageLocal(), walFile), .exactSize = PG_WAL_HEADER_SIZE); Buffer *walBuffer = storageGetP(storageNewReadP(storage, walFile), .exactSize = PG_WAL_HEADER_SIZE);
result = pgWalFromBuffer(walBuffer); result = pgWalFromBuffer(walBuffer);
} }

View File

@ -128,7 +128,7 @@ unsigned int pgVersionFromStr(const String *version);
String *pgVersionToStr(unsigned int version); String *pgVersionToStr(unsigned int version);
// Get info from WAL header // Get info from WAL header
PgWal pgWalFromFile(const String *walFile); PgWal pgWalFromFile(const String *walFile, const Storage *storage);
PgWal pgWalFromBuffer(const Buffer *walBuffer); PgWal pgWalFromBuffer(const Buffer *walBuffer);
// Get the tablespace identifier used to distinguish versions in a tablespace directory, e.g. PG_9.0_201008051 // Get the tablespace identifier used to distinguish versions in a tablespace directory, e.g. PG_9.0_201008051

View File

@ -229,7 +229,7 @@ testRun(void)
storagePutP(storageNewWriteP(storageTest, walFile), result); storagePutP(storageNewWriteP(storageTest, walFile), result);
PgWal info = {0}; PgWal info = {0};
TEST_ASSIGN(info, pgWalFromFile(walFile), "get wal info v11"); TEST_ASSIGN(info, pgWalFromFile(walFile, storageLocal()), "get wal info v11");
TEST_RESULT_UINT(info.systemId, 0xECAFECAF, " check system id"); TEST_RESULT_UINT(info.systemId, 0xECAFECAF, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_11, " check version"); TEST_RESULT_UINT(info.version, PG_VERSION_11, " check version");
TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT * 2, " check size"); TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT * 2, " check size");
@ -246,7 +246,7 @@ testRun(void)
pgWalTestToBuffer((PgWal){.version = PG_VERSION_83, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT}, result); pgWalTestToBuffer((PgWal){.version = PG_VERSION_83, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT}, result);
storagePutP(storageNewWriteP(storageTest, walFile), result); storagePutP(storageNewWriteP(storageTest, walFile), result);
TEST_ASSIGN(info, pgWalFromFile(walFile), "get wal info v8.3"); TEST_ASSIGN(info, pgWalFromFile(walFile, storageLocal()), "get wal info v8.3");
TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id"); TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_83, " check version"); TEST_RESULT_UINT(info.version, PG_VERSION_83, " check version");
TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT, " check size"); TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");