1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-01 00:25:06 +02:00

Add pgLsnName() and pgXactPath().

This commit is contained in:
David Steele
2019-12-01 15:49:34 -05:00
parent bc83354fb5
commit 56ee321a95
3 changed files with 43 additions and 1 deletions

View File

@ -29,6 +29,14 @@ STRING_EXTERN(PG_PATH_GLOBAL_STR, PG_PATH_GLOB
STRING_EXTERN(PG_NAME_WAL_STR, PG_NAME_WAL);
STRING_EXTERN(PG_NAME_XLOG_STR, PG_NAME_XLOG);
// Transaction commit log path names depending on version
STRING_STATIC(PG_PATH_PGCLOG_STR, "pg_clog");
STRING_STATIC(PG_PATH_PGXACT_STR, "pg_xact");
// Lsn name used in functions depnding on version
STRING_STATIC(PG_NAME_LSN_STR, "lsn");
STRING_STATIC(PG_NAME_LOCATION_STR, "location");
/***********************************************************************************************************************************
Define default wal segment size
@ -562,6 +570,17 @@ pgTablespaceId(unsigned int pgVersion)
FUNCTION_TEST_RETURN(result);
}
/**********************************************************************************************************************************/
const String *
pgLsnName(unsigned int pgVersion)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(UINT, pgVersion);
FUNCTION_TEST_END();
FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_NAME_LSN_STR : PG_NAME_LOCATION_STR);
}
/***********************************************************************************************************************************
Get WAL name (wal/xlog) for a PostgreSQL version
***********************************************************************************************************************************/
@ -575,6 +594,17 @@ pgWalName(unsigned int pgVersion)
FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_NAME_WAL_STR : PG_NAME_XLOG_STR);
}
/**********************************************************************************************************************************/
const String *
pgXactPath(unsigned int pgVersion)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(UINT, pgVersion);
FUNCTION_TEST_END();
FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_PATH_PGXACT_STR : PG_PATH_PGCLOG_STR);
}
/***********************************************************************************************************************************
Create pg_control for testing
***********************************************************************************************************************************/

View File

@ -105,8 +105,14 @@ PgWal pgWalFromBuffer(const Buffer *walBuffer);
// Get the tablespace identifier used to distinguish versions in a tablespace directory, e.g. PG_9.0_201008051
String *pgTablespaceId(unsigned int pgVersion);
// Get name used for lsn in functions (this was changed in PostgreSQL 10 for consistency since lots of names were changing)
const String *pgLsnName(unsigned int pgVersion);
const String *pgWalName(unsigned int pgVersion);
// Get transaction commit log path (this was changed in PostgreSQL 10 to avoid including "log" in the name)
const String *pgXactPath(unsigned int pgVersion);
/***********************************************************************************************************************************
Test Functions
***********************************************************************************************************************************/