You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-18 23:57:33 +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:
@ -49,6 +49,37 @@ pgInterfaceControl083(const Buffer *controlFile)
|
||||
FUNCTION_LOG_RETURN(PG_CONTROL, result);
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
bool
|
||||
pgInterfaceWalIs083(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
|
||||
pgInterfaceWal083(const Buffer *walFile)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelTrace);
|
||||
FUNCTION_LOG_PARAM(BUFFER, walFile);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(walFile != NULL);
|
||||
ASSERT(pgInterfaceWalIs083(walFile));
|
||||
|
||||
PgWal result = {0};
|
||||
|
||||
result.systemId = ((XLogLongPageHeaderData *)bufPtr(walFile))->xlp_sysid;
|
||||
|
||||
FUNCTION_LOG_RETURN(PG_WAL, result);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
@ -71,4 +102,20 @@ pgInterfaceControlTest083(PgControl pgControl, Buffer *buffer)
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
void
|
||||
pgInterfaceWalTest083(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
|
||||
|
Reference in New Issue
Block a user