You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-01 00:25:06 +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:
committed by
David Steele
parent
286a106ae4
commit
6a09d9294d
@ -311,12 +311,14 @@ pgControlFromBuffer(const Buffer *controlFile)
|
||||
Get info from pg_control
|
||||
***********************************************************************************************************************************/
|
||||
PgControl
|
||||
pgControlFromFile(const String *pgPath)
|
||||
pgControlFromFile(const Storage *storage, const String *pgPath)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STORAGE, storage);
|
||||
FUNCTION_LOG_PARAM(STRING, pgPath);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(storage != NULL);
|
||||
ASSERT(pgPath != NULL);
|
||||
|
||||
PgControl result = {0};
|
||||
@ -325,7 +327,7 @@ pgControlFromFile(const String *pgPath)
|
||||
{
|
||||
// Read control file
|
||||
Buffer *controlFile = storageGetP(
|
||||
storageNewReadNP(storageLocal(), strNewFmt("%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, strPtr(pgPath))),
|
||||
storageNewReadNP(storage, strNewFmt("%s/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, strPtr(pgPath))),
|
||||
.exactSize = PG_CONTROL_DATA_SIZE);
|
||||
|
||||
result = pgControlFromBuffer(controlFile);
|
||||
|
@ -8,6 +8,7 @@ PostgreSQL Interface
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "common/type/string.h"
|
||||
#include "storage/storage.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Defines for various Postgres paths and files
|
||||
@ -72,7 +73,7 @@ typedef struct PgWal
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
PgControl pgControlFromFile(const String *pgPath);
|
||||
PgControl pgControlFromFile(const Storage *storage, const String *pgPath);
|
||||
PgControl pgControlFromBuffer(const Buffer *controlFile);
|
||||
unsigned int pgVersionFromStr(const String *version);
|
||||
String *pgVersionToStr(unsigned int version);
|
||||
|
Reference in New Issue
Block a user