diff --git a/src/info/manifest.c b/src/info/manifest.c index 726faf55b..a230ce61c 100644 --- a/src/info/manifest.c +++ b/src/info/manifest.c @@ -879,7 +879,7 @@ manifestNewBuild( .checksumPage = checksumPage, .tablespaceList = tablespaceList, .manifestParentName = MANIFEST_TARGET_PGDATA_STR, - .manifestWalName = strNewFmt(MANIFEST_TARGET_PGDATA "/pg_%s", strPtr(pgWalName(pgVersion))), + .manifestWalName = strNewFmt(MANIFEST_TARGET_PGDATA "/%s", strPtr(pgWalPath(pgVersion))), .pgPath = storagePathP(storagePg, NULL), }; diff --git a/src/postgres/interface.c b/src/postgres/interface.c index 6e2be24c9..4b33252e4 100644 --- a/src/postgres/interface.c +++ b/src/postgres/interface.c @@ -30,6 +30,10 @@ 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); +// Wal path names depending on version +STRING_STATIC(PG_PATH_PGWAL_STR, "pg_wal"); +STRING_STATIC(PG_PATH_PGXLOG_STR, "pg_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"); @@ -642,6 +646,17 @@ pgWalName(unsigned int pgVersion) FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_NAME_WAL_STR : PG_NAME_XLOG_STR); } +/**********************************************************************************************************************************/ +const String * +pgWalPath(unsigned int pgVersion) +{ + FUNCTION_TEST_BEGIN(); + FUNCTION_TEST_PARAM(UINT, pgVersion); + FUNCTION_TEST_END(); + + FUNCTION_TEST_RETURN(pgVersion >= PG_VERSION_WAL_RENAME ? PG_PATH_PGWAL_STR : PG_PATH_PGXLOG_STR); +} + /**********************************************************************************************************************************/ const String * pgXactPath(unsigned int pgVersion) diff --git a/src/postgres/interface.h b/src/postgres/interface.h index 1c0c488b8..9f3f1f09a 100644 --- a/src/postgres/interface.h +++ b/src/postgres/interface.h @@ -137,6 +137,9 @@ const String *pgLsnName(unsigned int pgVersion); const String *pgWalName(unsigned int pgVersion); +// Get wal path (this was changed in PostgreSQL 10 to avoid including "log" in the name) +const String *pgWalPath(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); diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index f4fe464a3..a421491a3 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -117,7 +117,7 @@ testRun(void) } // ***************************************************************************************************************************** - if (testBegin("pgLsnName(), pgTablespaceId(), pgWalName(), and pgXactPath()")) + if (testBegin("pgLsnName(), pgTablespaceId(), pgWalName(), pgWalPath(), and pgXactPath()")) { TEST_RESULT_STR(strPtr(pgLsnName(PG_VERSION_96)), "location", "check location name"); TEST_RESULT_STR(strPtr(pgLsnName(PG_VERSION_10)), "lsn", "check lsn name"); @@ -130,6 +130,9 @@ testRun(void) TEST_RESULT_STR(strPtr(pgWalName(PG_VERSION_96)), "xlog", "check xlog name"); TEST_RESULT_STR(strPtr(pgWalName(PG_VERSION_10)), "wal", "check wal name"); + TEST_RESULT_STR_Z(pgWalPath(PG_VERSION_96), "pg_xlog", "check xlog path"); + TEST_RESULT_STR_Z(pgWalPath(PG_VERSION_10), "pg_wal", "check wal path"); + TEST_RESULT_STR(strPtr(pgXactPath(PG_VERSION_96)), "pg_clog", "check pg_clog name"); TEST_RESULT_STR(strPtr(pgXactPath(PG_VERSION_10)), "pg_xact", "check pg_xact name"); }