1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-07 00:35:37 +02:00

Add WAL info to PostgreSQL interface.

This allows the WAL header to be read for any supported version on PostgreSQL.
This commit is contained in:
David Steele
2019-03-19 19:44:06 +04:00
parent 1c9645d416
commit e938a89250
38 changed files with 1243 additions and 1 deletions

View File

@ -51,6 +51,37 @@ pgInterfaceControl095(const Buffer *controlFile)
FUNCTION_LOG_RETURN(PG_CONTROL, result);
}
/**********************************************************************************************************************************/
bool
pgInterfaceWalIs095(const Buffer *walFile)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(BUFFER, controlFile);
FUNCTION_TEST_END();
ASSERT(walFile != NULL);
FUNCTION_TEST_RETURN(((XLogPageHeaderData *)bufPtr(walFile))->xlp_magic == XLOG_PAGE_MAGIC);
}
/**********************************************************************************************************************************/
PgWal
pgInterfaceWal095(const Buffer *walFile)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(BUFFER, walFile);
FUNCTION_LOG_END();
ASSERT(walFile != NULL);
ASSERT(pgInterfaceWalIs095(walFile));
PgWal result = {0};
result.systemId = ((XLogLongPageHeaderData *)bufPtr(walFile))->xlp_sysid;
FUNCTION_LOG_RETURN(PG_WAL, result);
}
#ifdef DEBUG
/**********************************************************************************************************************************/
@ -75,4 +106,20 @@ pgInterfaceControlTest095(PgControl pgControl, Buffer *buffer)
FUNCTION_TEST_RETURN_VOID();
}
/**********************************************************************************************************************************/
void
pgInterfaceWalTest095(PgWal pgWal, Buffer *buffer)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(PG_WAL, pgWal);
FUNCTION_TEST_END();
XLogLongPageHeaderData *walData = (XLogLongPageHeaderData *)bufPtr(buffer);
walData->std.xlp_magic = XLOG_PAGE_MAGIC;
walData->xlp_sysid = pgWal.systemId;
FUNCTION_TEST_RETURN_VOID();
}
#endif