1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-04 09:43:08 +02:00

Remove support for PostgreSQL 9.4.

Per our policy to support five EOL versions of PostgreSQL, 9.4 is no longer supported by pgBackRest. Remove all logic associated with 9.4 and update the tests.

This includes a small fix in infoPg.c to allow backup.info files with old versions to be saved. This allows expire to function when old versions are present. Even though those older versions cannot be used, they can be expired.

Tests for 9.4 are left in the expire/info tests to demonstrate that these commands work with old versions present.
This commit is contained in:
David Steele 2024-10-21 13:56:04 +03:00 committed by GitHub
parent 89c9baba72
commit 48f511dad3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 345 additions and 527 deletions

View File

@ -497,7 +497,7 @@ HRN_FORK_BEGIN()
" cipher: none\n"
"\n"
" db (current)\n"
" wal archive min/max (9.4): none present\n",
" wal archive min/max (9.6): none present\n",
"text - single stanza, no valid backups, backup/expire lock detected");
// Notify child to release lock

View File

@ -551,7 +551,7 @@ HRN_FORK_BEGIN()
" cipher: none\n"
"\n"
" db (current)\n"
" wal archive min/max (9.4): none present\n",
" wal archive min/max (9.6): none present\n",
"text - single stanza, no valid backups, backup/expire lock detected");
// Notify child to release lock

View File

@ -1,6 +1,17 @@
<release date="XXXX-XX-XX" version="2.55dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-improvement-list>
<release-item>
<github-pull-request id="2472"/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Remove support for <proper>PostgreSQL</proper> <id>9.4</id>.</p>
</release-item>
<release-item>
<github-pull-request id="2470"/>

View File

@ -2455,7 +2455,7 @@
<list>
<list-item><id>default</id> - recover to the end of the archive stream.</list-item>
<list-item><id>immediate</id> - recover only until the database becomes consistent. This option is only supported on <postgres/> &gt;= 9.4.</list-item>
<list-item><id>immediate</id> - recover only until the database becomes consistent.</list-item>
<list-item><id>lsn</id> - recover to the LSN (Log Sequence Number) specified in <br-option>--target</br-option>. This option is only supported on <postgres/> &gt;= 10.</list-item>
<list-item><id>name</id> - recover the restore point specified in <br-option>--target</br-option>.</list-item>
<list-item><id>xid</id> - recover to the transaction id specified in <br-option>--target</br-option>.</list-item>

View File

@ -5,7 +5,6 @@
# - 'version' contains a list of all supported versions
# - For a specific version, 'release' marks it as not released (i.e. this should always be false when used)
version:
- 9.4
- 9.5
- 9.6
- 10

View File

@ -82,7 +82,7 @@ FN_EXTERN void archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const Strin
// Execute the async process. This function will only return in the calling process and the implementation is platform dependent.
FN_EXTERN void archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec);
// Comparator function for sorting archive ids by the database history id (the number after the dash) e.g. 9.4-1, 10-2
// Comparator function for sorting archive ids by the database history id (the number after the dash) e.g. 9.6-1, 10-2
FN_EXTERN int archiveIdComparator(const void *item1, const void *item2);
// Is the segment partial?

View File

@ -448,7 +448,7 @@ removeExpiredArchive(const InfoBackup *const infoBackup, const bool timeBasedFul
cfgOptionIdxStrNull(cfgOptRepoCipherPass, repoIdx));
const InfoPg *const infoArchivePgData = infoArchivePg(infoArchive);
// Get a list of archive directories (e.g. 9.4-1, 10-2, etc) sorted by the db-id (number after the dash).
// Get a list of archive directories (e.g. 9.6-1, 10-2, etc) sorted by the db-id (number after the dash).
const StringList *const listArchiveDisk = strLstSort(
strLstComparatorSet(
storageListP(
@ -506,7 +506,7 @@ removeExpiredArchive(const InfoBackup *const infoBackup, const bool timeBasedFul
const unsigned int archivePgId = cvtZToUInt(strrchr(strZ(archiveId), '-') + 1);
// From the global list of backups to retain, create a list of backups, oldest to newest, associated with
// this archiveId (e.g. 9.4-1), e.g. If globalBackupRetention has 4F, 3F, 2F, 1F then
// this archiveId (e.g. 9.6-1), e.g. If globalBackupRetention has 4F, 3F, 2F, 1F then
// localBackupRetentionList will have 1F, 2F, 3F, 4F (assuming they all have same history id)
for (unsigned int retentionIdx = strLstSize(globalBackupRetentionList) - 1;
(int)retentionIdx >= 0; retentionIdx--)

View File

@ -46,7 +46,6 @@ STRING_STATIC(RESTORE_COMMAND_STR, RESTORE_COMM
#define RECOVERY_TARGET_TIMELINE "recovery_target_timeline"
#define RECOVERY_TARGET_TIMELINE_CURRENT "current"
#define PAUSE_AT_RECOVERY_TARGET "pause_at_recovery_target"
#define STANDBY_MODE "standby_mode"
STRING_STATIC(STANDBY_MODE_STR, STANDBY_MODE);
@ -1101,8 +1100,7 @@ restoreCleanBuild(const Manifest *const manifest, const String *const rootReplac
// Skip the tablespace_map file when present so PostgreSQL does not rewrite links in pg_tblspc. The tablespace links will be
// created after paths are cleaned.
if (manifestFileExists(manifest, STRDEF(MANIFEST_TARGET_PGDATA "/" PG_FILE_TABLESPACEMAP)) &&
manifestData(manifest)->pgVersion >= PG_VERSION_TABLESPACE_MAP)
if (manifestFileExists(manifest, STRDEF(MANIFEST_TARGET_PGDATA "/" PG_FILE_TABLESPACEMAP)))
{
LOG_DETAIL_FMT("skip '" PG_FILE_TABLESPACEMAP "' -- tablespace links will be created based on mappings");
manifestFileRemove(manifest, STRDEF(MANIFEST_TARGET_PGDATA "/" PG_FILE_TABLESPACEMAP));
@ -1561,32 +1559,14 @@ restoreRecoveryOption(const unsigned int pgVersion)
kvPut(result, VARSTRZ(RECOVERY_TARGET_INCLUSIVE), VARSTR(FALSE_STR));
}
// Write pause_at_recovery_target/recovery_target_action
// Write recovery_target_action
if (cfgOptionTest(cfgOptTargetAction))
{
const StringId targetAction = cfgOptionStrId(cfgOptTargetAction);
if (targetAction != CFGOPTVAL_TARGET_ACTION_PAUSE)
{
// Write recovery_target on supported PostgreSQL versions
if (pgVersion >= PG_VERSION_RECOVERY_TARGET_ACTION)
{
kvPut(result, VARSTRZ(RECOVERY_TARGET_ACTION), VARSTR(strIdToStr(targetAction)));
}
// Else write pause_at_recovery_target on supported PostgreSQL versions
else
{
// Shutdown action is not supported with pause_at_recovery_target setting
if (targetAction == CFGOPTVAL_TARGET_ACTION_SHUTDOWN)
{
THROW_FMT(
OptionInvalidError,
CFGOPT_TARGET_ACTION "=" CFGOPTVAL_TARGET_ACTION_SHUTDOWN_Z " is only available in PostgreSQL >= %s",
strZ(pgVersionToStr(PG_VERSION_RECOVERY_TARGET_ACTION)));
}
kvPut(result, VARSTRZ(PAUSE_AT_RECOVERY_TARGET), VARSTR(FALSE_STR));
}
kvPut(result, VARSTRZ(RECOVERY_TARGET_ACTION), VARSTR(strIdToStr(targetAction)));
}
}

View File

@ -1541,7 +1541,7 @@ verifyProcess(const bool verboseText)
.expression = backupRegExpP(.full = true, .differential = true, .incremental = true)),
sortOrderAsc);
// Get a list of archive Ids in the repo (e.g. 9.4-1, 10-2, etc) sorted ascending by the db-id (number after the dash)
// Get a list of archive Ids in the repo (e.g. 9.6-1, 10-2, etc) sorted ascending by the db-id (number after the dash)
jobData.archiveIdList = strLstSort(
strLstComparatorSet(
storageListP(storage, STORAGE_REPO_ARCHIVE_STR, .expression = STRDEF(REGEX_ARCHIVE_DIR_DB_VERSION)),

View File

@ -308,8 +308,7 @@ infoPgSaveCallback(void *const data, const String *const sectionNext, InfoSave *
if (saveData->infoPg->type == infoPgBackup)
{
infoSaveValue(infoSaveData, INFO_SECTION_DB, INFO_KEY_DB_CATALOG_VERSION, jsonFromVar(VARUINT(pgData.catalogVersion)));
infoSaveValue(
infoSaveData, INFO_SECTION_DB, INFO_KEY_DB_CONTROL_VERSION, jsonFromVar(VARUINT(pgControlVersion(pgData.version))));
infoSaveValue(infoSaveData, INFO_SECTION_DB, INFO_KEY_DB_CONTROL_VERSION, jsonFromVar(VARUINT(pgData.controlVersion)));
}
infoSaveValue(infoSaveData, INFO_SECTION_DB, INFO_KEY_DB_ID, jsonFromVar(VARUINT(pgData.id)));

View File

@ -207,9 +207,7 @@ pgControlCrcValidate(const Buffer *const controlFile, const PgInterface *const i
do
{
// Calculate CRC and retrieve expected CRC
const uint32_t crcCalculated =
interface->version > PG_VERSION_94 ?
crc32cOne(bufPtrConst(controlFile), result) : crc32One(bufPtrConst(controlFile), result);
const uint32_t crcCalculated = crc32cOne(bufPtrConst(controlFile), result);
const uint32_t crcExpected = *((uint32_t *)(bufPtrConst(controlFile) + result));
// If CRC does not match
@ -261,9 +259,7 @@ pgControlCrcUpdate(Buffer *const controlFile, const unsigned int pgVersion, cons
ASSERT(pgVersion != 0);
ASSERT(crcOffset != 0);
*((uint32_t *)(bufPtr(controlFile) + crcOffset)) =
pgVersion > PG_VERSION_94 ?
crc32cOne(bufPtrConst(controlFile), crcOffset) : crc32One(bufPtrConst(controlFile), crcOffset);
*((uint32_t *)(bufPtr(controlFile) + crcOffset)) = crc32cOne(bufPtrConst(controlFile), crcOffset);
FUNCTION_LOG_RETURN_VOID();
}
@ -743,7 +739,7 @@ pgVersionFromStr(const String *const version)
ASSERT(version != NULL);
// If format not number.number (9.4) or number only (10) then error. No check for valid/supported PG version is on purpose.
// If format not number.number (9.6) or number only (10) then error. No check for valid/supported PG version is on purpose.
if (!regExpMatchOne(STRDEF("^[0-9]+[.]*[0-9]+$"), version))
THROW_FMT(AssertError, "version %s format is invalid", strZ(version));

View File

@ -5,54 +5,6 @@ CRC-32 Calculation
#include "postgres/interface/crc32.h"
/**********************************************************************************************************************************/
static const uint32_t crc32_lookup[256] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D,
};
FN_EXTERN uint32_t
crc32One(const unsigned char *data, size_t size)
{
uint32_t result = 0xffffffff;
while (size--)
result = crc32_lookup[((result >> 24) ^ *data++) & 0xFF] ^ (result << 8);
return result ^ 0xffffffff;
}
/**********************************************************************************************************************************/
static const uint32_t crc32c_lookup[256] =
{

View File

@ -12,10 +12,7 @@ CRC-32 and CRC-32C calculations required to validate the integrity of pg_control
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
// Generate CRC-32 checksum (required by <= 9.4)
FN_EXTERN uint32_t crc32One(const unsigned char *data, size_t size);
// Generate CRC-32C checksum (required by >= 9.5)
// Generate CRC-32C checksum
FN_EXTERN uint32_t crc32cOne(const unsigned char *data, size_t size);
#endif

View File

@ -16,7 +16,7 @@ alpha/beta/rc period without needing to be updated, unless of course the actual
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#ifdef CATALOG_VERSION_NO_MAX
@ -54,7 +54,7 @@ Read the version specific pg_control into a general data structure
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define PG_INTERFACE_CONTROL(version) \
static PgControl \
@ -81,7 +81,7 @@ Get control crc offset
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define PG_INTERFACE_CONTROL_CRC_OFFSET(version) \
static size_t \
@ -113,7 +113,7 @@ Get the control version
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define PG_INTERFACE_CONTROL_VERSION(version) \
static uint32_t \
@ -129,7 +129,7 @@ Determine if the supplied WAL is for this version of PostgreSQL
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define PG_INTERFACE_WAL_IS(version) \
static bool \
@ -147,7 +147,7 @@ Read the version specific WAL header into a general data structure
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define PG_INTERFACE_WAL(version) \
static PgWal \

View File

@ -32,7 +32,7 @@ Types from src/include/c.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
typedef int64_t int64;
@ -42,7 +42,7 @@ typedef int64_t int64;
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */
typedef TransactionId MultiXactId;
@ -53,7 +53,7 @@ typedef TransactionId MultiXactId;
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
typedef uint32 MultiXactOffset;
@ -67,7 +67,7 @@ Types from src/include/pgtime.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* The API of this library is generally similar to the corresponding
@ -86,7 +86,7 @@ Types from src/include/postgres_ext.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* Object ID is a fundamental type in Postgres.
@ -107,10 +107,6 @@ Types from src/include/port/pg_crc32.h
typedef uint32 pg_crc32c;
#elif PG_VERSION >= PG_VERSION_94
typedef uint32 pg_crc32;
#endif
/***********************************************************************************************************************************
@ -121,7 +117,7 @@ Types from src/include/access/xlogdefs.h
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* Pointer to a location in the XLOG. These pointers are 64 bits wide,
@ -135,7 +131,7 @@ typedef uint64 XLogRecPtr;
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* TimeLineID (TLI) - identifies different database histories to prevent
@ -288,19 +284,6 @@ Types from src/include/catalog/catversion.h
/* yyyymmddN */
#define CATALOG_VERSION_NO 201510051
#elif PG_VERSION >= PG_VERSION_94
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201409291
#endif
/***********************************************************************************************************************************
@ -363,7 +346,7 @@ Types from src/include/catalog/pg_control.h
/* Version identifier for this pg_control format */
#define PG_CONTROL_VERSION 960
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/* Version identifier for this pg_control format */
#define PG_CONTROL_VERSION 942
@ -578,48 +561,13 @@ typedef struct CheckPoint
TransactionId oldestActiveXid;
} CheckPoint;
#elif PG_VERSION >= PG_VERSION_94
/*
* Body of CheckPoint XLOG records. This is declared here because we keep
* a copy of the latest one in pg_control for possible disaster recovery.
* Changing this struct requires a PG_CONTROL_VERSION bump.
*/
typedef struct CheckPoint
{
XLogRecPtr redo; /* next RecPtr available when we began to
* create CheckPoint (i.e. REDO start point) */
TimeLineID ThisTimeLineID; /* current TLI */
TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new
* timeline (equals ThisTimeLineID otherwise) */
bool fullPageWrites; /* current full_page_writes */
uint32 nextXidEpoch; /* higher-order bits of nextXid */
TransactionId nextXid; /* next free XID */
Oid nextOid; /* next free OID */
MultiXactId nextMulti; /* next free MultiXactId */
MultiXactOffset nextMultiOffset; /* next free MultiXact offset */
TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */
Oid oldestXidDB; /* database with minimum datfrozenxid */
MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */
Oid oldestMultiDB; /* database with minimum datminmxid */
pg_time_t time; /* time stamp of checkpoint */
/*
* Oldest XID still running. This is only needed to initialize hot standby
* mode from an online checkpoint, so we only bother calculating this for
* online checkpoints and only when wal_level is hot_standby. Otherwise
* it's set to InvalidTransactionId.
*/
TransactionId oldestActiveXid;
} CheckPoint;
#endif
// DBState enum
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* System status indicator. Note this is stored in pg_control; if you change
@ -1475,7 +1423,7 @@ typedef struct ControlFileData
pg_crc32c crc;
} ControlFileData;
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* Contents of pg_control.
@ -1664,10 +1612,6 @@ Types from src/include/access/xlog_internal.h
#define XLOG_PAGE_MAGIC 0xD087 /* can be used as WAL version indicator */
#elif PG_VERSION >= PG_VERSION_94
#define XLOG_PAGE_MAGIC 0xD07E /* can be used as WAL version indicator */
#endif
// XLogPageHeaderData type
@ -1695,7 +1639,7 @@ typedef struct XLogPageHeaderData
uint32 xlp_rem_len; /* total len of remaining data for record */
} XLogPageHeaderData;
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* Each page of XLOG file has a header like this:
@ -1725,7 +1669,7 @@ typedef struct XLogPageHeaderData
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/*
* When the XLP_LONG_HEADER flag is set, we store additional fields in the
@ -1746,7 +1690,7 @@ typedef struct XLogLongPageHeaderData
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
/* This flag indicates a "long" page header */
#define XLP_LONG_HEADER 0x0002

View File

@ -9,7 +9,6 @@ Automatically generated by 'build-code postgres-version' -- do not modify direct
/***********************************************************************************************************************************
PostgreSQL version constants
***********************************************************************************************************************************/
#define PG_VERSION_94 90400
#define PG_VERSION_95 90500
#define PG_VERSION_96 90600
#define PG_VERSION_10 100000
@ -26,7 +25,6 @@ PostgreSQL version constants
/***********************************************************************************************************************************
PostgreSQL version string constants for use in error messages
***********************************************************************************************************************************/
#define PG_VERSION_94_Z "9.4"
#define PG_VERSION_95_Z "9.5"
#define PG_VERSION_96_Z "9.6"
#define PG_VERSION_10_Z "10"

View File

@ -14,12 +14,6 @@ PostgreSQL name
/***********************************************************************************************************************************
Version where various PostgreSQL capabilities were introduced
***********************************************************************************************************************************/
// tablespace_map is created during backup
#define PG_VERSION_TABLESPACE_MAP PG_VERSION_95
// recovery target action supported
#define PG_VERSION_RECOVERY_TARGET_ACTION PG_VERSION_95
// parallel query supported
#define PG_VERSION_PARALLEL_QUERY PG_VERSION_96

View File

@ -2723,10 +2723,6 @@ test/src/common/harnessPostgres.h:
class: test/harness
type: c/h
test/src/common/harnessPostgres/harness094.c:
class: test/harness
type: c
test/src/common/harnessPostgres/harness095.c:
class: test/harness
type: c

View File

@ -15,8 +15,6 @@ use pgBackRestDoc::Common::Log;
####################################################################################################################################
# PostgreSQL version numbers
####################################################################################################################################
use constant PG_VERSION_94 => '9.4';
push @EXPORT, qw(PG_VERSION_94);
use constant PG_VERSION_95 => '9.5';
push @EXPORT, qw(PG_VERSION_95);
use constant PG_VERSION_96 => '9.6';
@ -48,8 +46,8 @@ sub versionSupport
# Assign function parameters, defaults, and log debug info
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
my @strySupportVersion = (PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12,
PG_VERSION_13, PG_VERSION_14, PG_VERSION_15, PG_VERSION_16, PG_VERSION_17);
my @strySupportVersion = (PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12, PG_VERSION_13,
PG_VERSION_14, PG_VERSION_15, PG_VERSION_16, PG_VERSION_17);
# Return from function and log return values if any
return logDebugReturn

View File

@ -164,7 +164,7 @@ sub run
($self->{iTry} > 1 ? ' (retry ' . ($self->{iTry} - 1) . ')' : '');
my $strImage = 'test-' . $self->{iVmIdx};
my $strDbVersion = (defined($self->{oTest}->{&TEST_DB}) ? $self->{oTest}->{&TEST_DB} : PG_VERSION_94);
my $strDbVersion = (defined($self->{oTest}->{&TEST_DB}) ? $self->{oTest}->{&TEST_DB} : PG_VERSION_95);
$strDbVersion =~ s/\.//;
&log($self->{bDryRun} && !$self->{bVmOut} || $self->{bShowOutputAsync} ? INFO : DETAIL, "${strTest}" .

View File

@ -203,7 +203,6 @@ my $oyVm =
&VM_DB =>
[
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
PG_VERSION_10,
@ -218,7 +217,6 @@ my $oyVm =
&VM_DB_TEST =>
[
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
],
@ -237,7 +235,6 @@ my $oyVm =
&VM_DB =>
[
PG_VERSION_94,
PG_VERSION_95,
PG_VERSION_96,
PG_VERSION_10,

View File

@ -142,13 +142,6 @@ static const HrnPgInterface hrnPgInterface[] =
.control = hrnPgInterfaceControl095,
.wal = hrnPgInterfaceWal095,
},
{
.version = PG_VERSION_94,
.catalogVersion = hrnPgInterfaceCatalogVersion094,
.control = hrnPgInterfaceControl094,
.wal = hrnPgInterfaceWal094,
},
};
/***********************************************************************************************************************************

View File

@ -22,8 +22,6 @@ Default wal segment size
/***********************************************************************************************************************************
System id constants by version
***********************************************************************************************************************************/
#define HRN_PG_SYSTEMID_94 (10000000000000000000ULL + (uint64_t)PG_VERSION_94)
#define HRN_PG_SYSTEMID_94_Z "10000000000000090400"
#define HRN_PG_SYSTEMID_95 (10000000000000000000ULL + (uint64_t)PG_VERSION_95)
#define HRN_PG_SYSTEMID_95_Z "10000000000000090500"
#define HRN_PG_SYSTEMID_96 (10000000000000000000ULL + (uint64_t)PG_VERSION_96)

View File

@ -1,10 +0,0 @@
/***********************************************************************************************************************************
Harness for PostgreSQL Interface (see PG_VERSION for version)
***********************************************************************************************************************************/
#include "build.auto.h"
#define PG_VERSION PG_VERSION_94
#include "common/harnessPostgres/harnessVersion.intern.h"
HRN_PG_INTERFACE(094);

View File

@ -16,7 +16,7 @@ Get the catalog version
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define HRN_PG_INTERFACE_CATALOG_VERSION(version) \
uint32_t \
@ -32,7 +32,7 @@ Create a pg_control file
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define HRN_PG_INTERFACE_CONTROL_TEST(version) \
void \
@ -56,11 +56,7 @@ Create a pg_control file
.data_checksum_version = pgControl.pageChecksumVersion, \
}; \
\
((ControlFileData *)buffer)->crc = \
crc == 0 ? \
(PG_VERSION > PG_VERSION_94 ? \
crc32cOne(buffer, offsetof(ControlFileData, crc)) : crc32One(buffer, offsetof(ControlFileData, crc))) : \
crc; \
((ControlFileData *)buffer)->crc = crc == 0 ? crc32cOne(buffer, offsetof(ControlFileData, crc)) : crc; \
}
#endif
@ -70,7 +66,7 @@ Create a WAL file
***********************************************************************************************************************************/
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_94
#elif PG_VERSION >= PG_VERSION_95
#define HRN_PG_INTERFACE_WAL_TEST(version) \
void \

View File

@ -386,15 +386,15 @@ testRun(void)
walSegmentNext(STRDEF("000000010000000100000001"), 16 * 1024 * 1024, PG_VERSION_10), "000000010000000100000002",
"get next");
TEST_RESULT_STR_Z(
walSegmentNext(STRDEF("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_94), "0000000100000001000000FF",
walSegmentNext(STRDEF("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_95), "0000000100000001000000FF",
"get next");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check overflow by version");
TEST_RESULT_STR_Z(
walSegmentNext(STRDEF("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_94), "000000990000000200000000",
"get next overflow >= 9.4");
walSegmentNext(STRDEF("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_95), "000000990000000200000000",
"get next overflow >= 9.5");
TEST_RESULT_STR_Z(
walSegmentNext(STRDEF("000000010000000100000003"), 1024 * 1024 * 1024, PG_VERSION_11), "000000010000000200000000",
"get next overflow >= 11/1GB");
@ -410,16 +410,16 @@ testRun(void)
TEST_TITLE("single segment");
TEST_RESULT_STRLST_Z(
walSegmentRange(STRDEF("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_94, 1), "000000010000000100000000\n",
walSegmentRange(STRDEF("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_95, 1), "000000010000000100000000\n",
"get single");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check range by version");
TEST_RESULT_STRLST_Z(
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_94, 4),
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_95, 4),
"0000000100000001000000FD\n0000000100000001000000FE\n0000000100000001000000FF\n000000010000000200000000\n",
"get range >= 9.4");
"get range >= 9.5");
TEST_RESULT_STRLST_Z(
walSegmentRange(STRDEF("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8),
"000000080000000A00000000\n000000080000000A00000001\n000000080000000A00000002\n000000080000000A00000003\n"
@ -445,8 +445,8 @@ testRun(void)
TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderAsc), "9.6-1\n10-4\n11-10\n", "sort ascending");
strLstAddZ(list, "9.4-2");
TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderDesc), "11-10\n10-4\n9.4-2\n9.6-1\n", "sort descending");
strLstAddZ(list, "17-1");
TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderDesc), "11-10\n10-4\n9.6-1\n17-1\n", "sort descending");
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@ -116,13 +116,13 @@ testRun(void)
"db-id=1\n"
"\n"
"[db:history]\n"
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.4\"}\n");
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.5\"}\n");
TEST_ERROR(
archivePushCheck(true), RepoInvalidError,
"unable to find a valid repository:\n"
"repo1: [ArchiveMismatchError] PostgreSQL version 9.6, system-id " HRN_PG_SYSTEMID_96_Z " do not match repo1 stanza"
" version 9.4, system-id 5555555555555555555\n"
" version 9.5, system-id 5555555555555555555\n"
"HINT: are you archiving to the correct stanza?");
// -------------------------------------------------------------------------------------------------------------------------
@ -193,7 +193,7 @@ testRun(void)
"db-id=1\n"
"\n"
"[db:history]\n"
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.4\"}\n");
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.5\"}\n");
TEST_ASSIGN(result, archivePushCheck(false), "get archive check result");
@ -202,7 +202,7 @@ testRun(void)
TEST_RESULT_STRLST_Z(
result.errorList,
"repo4: [ArchiveMismatchError] repo2 stanza version 9.6, system-id " HRN_PG_SYSTEMID_96_Z " do not match repo4 stanza"
" version 9.4, system-id 5555555555555555555\n"
" version 9.5, system-id 5555555555555555555\n"
"HINT: are you archiving to the correct stanza?\n",
"check error list");
@ -222,7 +222,7 @@ testRun(void)
"db-id=2\n"
"\n"
"[db:history]\n"
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.4\"}\n"
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.5\"}\n"
"2={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.6\"}\n");
TEST_ASSIGN(result, archivePushCheck(false), "get archive check result");
@ -711,7 +711,7 @@ testRun(void)
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
hrnCfgArgRawBool(argList, cfgOptLogSubprocess, true);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
HRN_INFO_PUT(
storageTest, "repo/archive/test/archive.info",
@ -719,7 +719,7 @@ testRun(void)
"db-id=1\n"
"\n"
"[db:history]\n"
"1={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.4\"}\n");
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("async, ignore error file on first pass");
@ -795,7 +795,7 @@ testRun(void)
Buffer *walBuffer1 = bufNew((size_t)16 * 1024 * 1024);
bufUsedSet(walBuffer1, bufSize(walBuffer1));
memset(bufPtr(walBuffer1), 0xFF, bufSize(walBuffer1));
HRN_PG_WAL_TO_BUFFER(walBuffer1, PG_VERSION_94);
HRN_PG_WAL_TO_BUFFER(walBuffer1, PG_VERSION_95);
const char *walBuffer1Sha1 = strZ(strNewEncode(encodingHex, cryptoHashOne(hashTypeSha1, walBuffer1)));
HRN_STORAGE_PUT(storagePgWrite(),"pg_xlog/000000010000000100000001", walBuffer1);
@ -804,7 +804,7 @@ testRun(void)
TEST_RESULT_LOG("P00 INFO: pushed WAL file '000000010000000100000001' to the archive asynchronously");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
storageTest, zNewFmt("repo/archive/test/9.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
.comment = "check repo for WAL file");
// -------------------------------------------------------------------------------------------------------------------------
@ -856,13 +856,13 @@ testRun(void)
"db-id=1\n"
"\n"
"[db:history]\n"
"1={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.4\"}\n");
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n");
// Recreate ready file for WAL 1
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), "pg_xlog/archive_status/000000010000000100000001.ready");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
storageTest, zNewFmt("repo/archive/test/9.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
.comment = "check repo1 for WAL 1 file");
// Create a ready file for WAL 2 but don't create the segment yet -- this will test the file error
@ -880,11 +880,11 @@ testRun(void)
TEST_PATH "/pg/pg_xlog/000000010000000100000002");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
storageTest, zNewFmt("repo/archive/test/9.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
.comment = "check repo1 for WAL 1 file");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo3/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
.comment = "check repo3 for WAL 1 file");
TEST_STORAGE_LIST(
@ -900,7 +900,7 @@ testRun(void)
Buffer *walBuffer2 = bufNew((size_t)16 * 1024 * 1024);
bufUsedSet(walBuffer2, bufSize(walBuffer2));
memset(bufPtr(walBuffer2), 0x0C, bufSize(walBuffer2));
HRN_PG_WAL_TO_BUFFER(walBuffer2, PG_VERSION_94);
HRN_PG_WAL_TO_BUFFER(walBuffer2, PG_VERSION_95);
const char *walBuffer2Sha1 = strZ(strNewEncode(encodingHex, cryptoHashOne(hashTypeSha1, walBuffer2)));
HRN_STORAGE_PUT(storagePgWrite(), "pg_xlog/000000010000000100000002", walBuffer2);
@ -915,10 +915,10 @@ testRun(void)
"P01 DETAIL: pushed WAL file '000000010000000100000002' to the archive");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
storageTest, zNewFmt("repo/archive/test/9.5-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
.comment = "check repo1 for WAL 2 file");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo3/archive/test/9.4-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
.comment = "check repo3 for WAL 2 file");
TEST_STORAGE_LIST(
@ -949,7 +949,7 @@ testRun(void)
Buffer *walBuffer3 = bufNew((size_t)16 * 1024 * 1024);
bufUsedSet(walBuffer3, bufSize(walBuffer3));
memset(bufPtr(walBuffer3), 0x44, bufSize(walBuffer3));
HRN_PG_WAL_TO_BUFFER(walBuffer3, PG_VERSION_94);
HRN_PG_WAL_TO_BUFFER(walBuffer3, PG_VERSION_95);
const char *walBuffer3Sha1 = strZ(strNewEncode(encodingHex, cryptoHashOne(hashTypeSha1, walBuffer3)));
HRN_STORAGE_PUT(storagePgWrite(), "pg_xlog/000000010000000100000003", walBuffer3);
@ -963,10 +963,10 @@ testRun(void)
"P01 DETAIL: pushed WAL file '000000010000000100000003' to the archive");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
storageTest, zNewFmt("repo/archive/test/9.5-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
.comment = "check repo1 for WAL 3 file");
TEST_STORAGE_EXISTS(
storageTest, zNewFmt("repo3/archive/test/9.4-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
.comment = "check repo3 for WAL 3 file");
// Remove the ready file to prevent WAL 3 from being considered for the next test

View File

@ -1531,7 +1531,7 @@ testRun(void)
TEST_TITLE("reset checksum-page when the cluster does not have checksums enabled");
// Create pg_control
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
// Create stanza
argList = strLstNew();
@ -1554,11 +1554,11 @@ testRun(void)
HRN_PQ_SCRIPT_SET(
// Connect to primary
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg1", false, NULL, NULL));
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
TEST_RESULT_VOID(
dbFree(
backupInit(infoBackupNew(PG_VERSION_94, HRN_PG_SYSTEMID_94, hrnPgCatalogVersion(PG_VERSION_94), NULL))->dbPrimary),
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
"backup init");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptChecksumPage), false, "check checksum-page");
@ -1569,7 +1569,7 @@ testRun(void)
TEST_TITLE("ok if cluster checksums are enabled and checksum-page is any value");
// Create pg_control with page checksums
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94, .pageChecksumVersion = 1);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95, .pageChecksumVersion = 1);
argList = strLstNew();
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
@ -1581,24 +1581,24 @@ testRun(void)
HRN_PQ_SCRIPT_SET(
// Connect to primary
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg1", false, NULL, NULL));
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
TEST_RESULT_VOID(
dbFree(
backupInit(infoBackupNew(PG_VERSION_94, HRN_PG_SYSTEMID_94, hrnPgCatalogVersion(PG_VERSION_94), NULL))->dbPrimary),
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
"backup init");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptChecksumPage), false, "check checksum-page");
// Create pg_control without page checksums
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
HRN_PQ_SCRIPT_SET(
// Connect to primary
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg1", false, NULL, NULL));
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
TEST_RESULT_VOID(
dbFree(
backupInit(infoBackupNew(PG_VERSION_94, HRN_PG_SYSTEMID_94, hrnPgCatalogVersion(PG_VERSION_94), NULL))->dbPrimary),
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
"backup init");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptChecksumPage), false, "check checksum-page");
}
@ -1610,7 +1610,7 @@ testRun(void)
TEST_TITLE("sleep retries and stall error");
// Create pg_control
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
// Create stanza
StringList *argList = strLstNew();
@ -1632,7 +1632,7 @@ testRun(void)
HRN_PQ_SCRIPT_SET(
// Connect to primary
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg1", false, NULL, NULL),
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
// Advance the time slowly to force retries
HRN_PQ_SCRIPT_TIME_QUERY(1, 1575392588998),
@ -1646,7 +1646,7 @@ testRun(void)
HRN_PQ_SCRIPT_TIME_QUERY(1, 1575392589999));
BackupData *backupData = backupInit(
infoBackupNew(PG_VERSION_94, HRN_PG_SYSTEMID_94, hrnPgCatalogVersion(PG_VERSION_94), NULL));
infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL));
TEST_RESULT_INT(backupTime(backupData, true), 1575392588, "multiple tries for sleep");
TEST_ERROR(backupTime(backupData, true), KernelError, "PostgreSQL clock has not advanced to the next second after 3 tries");
@ -1895,7 +1895,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
// Create pg_control
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
cmdStanzaCreate();
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
@ -1947,7 +1947,7 @@ testRun(void)
"P00 INFO: new backup label = [FULL-1]\n"
"P00 INFO: full backup size = 8KB, file total = 2",
TEST_64BIT() ?
(TEST_BIG_ENDIAN() ? "8e756232fbbf97f0d1026d62ba68b3d6602acbd7" : "20df8640327df5ebc0658817cbc4c93624fd451b") :
(TEST_BIG_ENDIAN() ? "ead3f998dc6dbc4b444f89cd449dcb81801a21ed" : "6f7fb3cd71dbef602850d05332cdd1c8e4a64121") :
"56d0a8a2d6b0b6dd2880c4b0221fec24e958c1a6");
// Make pg no longer appear to be running

View File

@ -267,8 +267,8 @@ testRun(void)
// Two standbys found but no primary
HRN_PQ_SCRIPT_SET(
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, "/pgdata", true, NULL, NULL),
HRN_PQ_SCRIPT_OPEN_GE_93(8, "dbname='postgres' port=5433", PG_VERSION_94, "/pgdata", true, NULL, NULL),
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, "/pgdata", true, NULL, NULL),
HRN_PQ_SCRIPT_OPEN_GE_93(8, "dbname='postgres' port=5433", PG_VERSION_95, "/pgdata", true, NULL, NULL),
HRN_PQ_SCRIPT_CLOSE(8),
HRN_PQ_SCRIPT_CLOSE(1));
@ -598,9 +598,9 @@ testRun(void)
TEST_TITLE("checkDbConfig() version mismatch");
TEST_ERROR(
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
checkDbConfig(PG_VERSION_95, db.primaryIdx, db.primary, false), DbMismatchError,
"version '" PG_VERSION_11_Z "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
PG_VERSION_94_Z "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n"
PG_VERSION_95_Z "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n"
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
// -------------------------------------------------------------------------------------------------------------------------
@ -754,7 +754,7 @@ testRun(void)
// Version mismatch
TEST_ERROR(
checkStanzaInfoPg(
storageRepoIdx(0), PG_VERSION_94, HRN_PG_SYSTEMID_94, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
storageRepoIdx(0), PG_VERSION_95, HRN_PG_SYSTEMID_95, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
FileInvalidError,
"backup and archive info files exist but do not match the database\n"

View File

@ -1,5 +1,7 @@
/***********************************************************************************************************************************
Test Expire Command
NOTE: references to 9.4 are intentionally included in this test to ensure that expire will work with no longer supported versions.
***********************************************************************************************************************************/
#include <unistd.h>

View File

@ -1,5 +1,7 @@
/***********************************************************************************************************************************
Test Info Command
NOTE: references to 9.4 are intentionally included in this test to ensure that info will work with no longer supported versions.
***********************************************************************************************************************************/
#include "common/crypto/cipherBlock.h"
#include "common/io/bufferRead.h"

View File

@ -33,15 +33,15 @@ Test data for backup.info
***********************************************************************************************************************************/
#define TEST_RESTORE_BACKUP_INFO_DB \
"[db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=6569239123849665679\n" \
"db-version=\"9.4\"\n" \
"db-version=\"9.5\"\n" \
"\n" \
"[db:history]\n" \
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679," \
"\"db-version\":\"9.4\"}\n"
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679," \
"\"db-version\":\"9.5\"}\n"
#define TEST_RESTORE_BACKUP_INFO \
"[backup:current]\n" \
@ -436,8 +436,8 @@ testRun(void)
"db-version=\"10\"\n"
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.4\"}\n"
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.5\"}\n"
"2={\"db-catalog-version\":201707211,\"db-control-version\":1002,\"db-system-id\":6626363367545678089"
",\"db-version\":\"10\"}\n");
@ -700,7 +700,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on mismatched label");
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_94, STRDEF("/pg"));
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_95, STRDEF("/pg"));
TEST_ERROR(
restoreManifestValidate(manifest, STRDEF("20161219-212741F_20161219-212918I")), FormatError,
@ -713,7 +713,7 @@ testRun(void)
{
const String *pgPath = STRDEF(TEST_PATH "/pg");
const String *repoPath = STRDEF(TEST_PATH "/repo");
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_94, pgPath);
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_95, pgPath);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("remap data directory");
@ -1360,8 +1360,8 @@ testRun(void)
OBJ_NEW_BASE_BEGIN(Manifest, .childQty = MEM_CONTEXT_QTY_MAX)
{
manifest = manifestNewInternal();
manifest->pub.data.pgVersion = PG_VERSION_94;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_94);
manifest->pub.data.pgVersion = PG_VERSION_95;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
HRN_MANIFEST_TARGET_ADD(manifest, .name = MANIFEST_TARGET_PGDATA, .path = "/pg");
HRN_MANIFEST_FILE_ADD(manifest, .name = MANIFEST_TARGET_PGDATA "/" PG_FILE_PGVERSION);
@ -1507,7 +1507,7 @@ testRun(void)
MEM_CONTEXT_END();
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.4_201409291/32768/)",
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.5_201510051/32768/)",
"check expression");
TEST_RESULT_LOG(
@ -1517,20 +1517,20 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("one database selected with tablespace id");
manifest->pub.data.pgVersion = PG_VERSION_94;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_94);
manifest->pub.data.pgVersion = PG_VERSION_95;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
MEM_CONTEXT_BEGIN(manifest->pub.memContext)
{
HRN_MANIFEST_DB_ADD(manifest, .name = "test3", .id = 65536, .lastSystemId = 99999);
HRN_MANIFEST_FILE_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/16387/PG_9.4_201409291/65536/" PG_FILE_PGVERSION);
HRN_MANIFEST_FILE_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/16387/PG_9.5_201510051/65536/" PG_FILE_PGVERSION);
}
MEM_CONTEXT_END();
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest),
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.4_201409291/32768/)|(^pg_data/base/65536/)"
"|(^pg_tblspc/16387/PG_9.4_201409291/65536/)",
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.5_201510051/32768/)|(^pg_data/base/65536/)"
"|(^pg_tblspc/16387/PG_9.5_201510051/65536/)",
"check expression");
TEST_RESULT_LOG(
@ -1546,7 +1546,7 @@ testRun(void)
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest),
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.4_201409291/16384/)",
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.5_201510051/16384/)",
"check expression");
TEST_RESULT_LOG(
@ -1562,7 +1562,7 @@ testRun(void)
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest),
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.4_201409291/16384/)",
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.5_201510051/16384/)",
"check expression");
TEST_RESULT_LOG(
@ -1578,7 +1578,7 @@ testRun(void)
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest),
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_9.4_201409291/16385/)",
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_9.5_201510051/16385/)",
"check expression");
TEST_RESULT_LOG(
@ -1620,10 +1620,10 @@ testRun(void)
TEST_RESULT_STR_Z(
restoreSelectiveExpression(manifest),
"(^pg_data/base/1/)|(^pg_tblspc/16387/PG_9.4_201409291/1/)|"
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_9.4_201409291/16385/)|"
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.4_201409291/32768/)|"
"(^pg_data/base/65536/)|(^pg_tblspc/16387/PG_9.4_201409291/65536/)",
"(^pg_data/base/1/)|(^pg_tblspc/16387/PG_9.5_201510051/1/)|"
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_9.5_201510051/16385/)|"
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.5_201510051/32768/)|"
"(^pg_data/base/65536/)|(^pg_tblspc/16387/PG_9.5_201510051/65536/)",
"check expression");
TEST_RESULT_LOG(
@ -1651,7 +1651,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"a_setting = 'a'\n"
"b_setting = 'b'\n"
@ -1667,7 +1667,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = '/usr/local/bin/pg_wrapper.sh --beta --lock-path=" HRN_PATH "/lock --log-path=" HRN_PATH
" --pg1-path=/pg --repo1-path=/repo --stanza=test1 archive-get %f \"%p\"'\n",
@ -1681,7 +1681,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n",
"check recovery options");
@ -1725,7 +1725,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"recovery_target_time = 'TIME'\n"
@ -1742,7 +1742,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"recovery_target_time = 'TIME'\n"
@ -1758,7 +1758,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"recovery_target_name = 'NAME'\n",
@ -1779,26 +1779,6 @@ testRun(void)
"recovery_target_lsn = '5218/5E35BBA8'\n",
"check recovery options");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("recovery target action = shutdown");
argList = strLstDup(argBaseList);
hrnCfgArgRawZ(argList, cfgOptType, "immediate");
hrnCfgArgRawZ(argList, cfgOptTargetAction, "shutdown");
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"recovery_target = 'immediate'\n"
"recovery_target_action = 'shutdown'\n",
"check recovery options");
TEST_ERROR(
restoreRecoveryConf(PG_VERSION_94, restoreLabel), OptionInvalidError,
"target-action=shutdown is only available in PostgreSQL >= 9.5");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("recovery target action = pause");
@ -1808,11 +1788,11 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"recovery_target = 'immediate'\n"
"pause_at_recovery_target = 'false'\n",
"recovery_target_action = 'promote'\n",
"check recovery options");
// -------------------------------------------------------------------------------------------------------------------------
@ -1823,7 +1803,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"standby_mode = 'on'\n",
@ -1838,7 +1818,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_RESULT_STR_Z(
restoreRecoveryConf(PG_VERSION_94, restoreLabel),
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
RECOVERY_SETTING_HEADER
"restore_command = 'my_restore_command'\n"
"standby_mode = 'on'\n"
@ -1853,7 +1833,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdRestore, argList);
TEST_ERROR(
restoreRecoveryConf(PG_VERSION_94, restoreLabel), OptionInvalidError,
restoreRecoveryConf(PG_VERSION_95, restoreLabel), OptionInvalidError,
"option 'archive-mode' is not supported on PostgreSQL < 12\n"
"HINT: 'archive_mode' should be manually set to 'off' in postgresql.conf.");
@ -2119,8 +2099,8 @@ testRun(void)
manifest = manifestNewInternal();
manifest->pub.info = infoNew(NULL);
manifest->pub.data.backupLabel = strNewZ(TEST_LABEL);
manifest->pub.data.pgVersion = PG_VERSION_94;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_94);
manifest->pub.data.pgVersion = PG_VERSION_95;
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
manifest->pub.data.backupType = backupTypeFull;
manifest->pub.data.backupTimestampStart = 1482182860;
manifest->pub.data.backupTimestampCopyStart = 1482182861; // So file timestamps should be less than this
@ -2136,12 +2116,12 @@ testRun(void)
// PG_VERSION
HRN_MANIFEST_FILE_ADD(
manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1");
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_Z "\n");
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
// Store the file also to the encrypted repo
HRN_STORAGE_PUT_Z(
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_Z "\n",
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_95_Z "\n",
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS_ARCHIVE);
// pg_tblspc
@ -2198,7 +2178,7 @@ testRun(void)
"P00 DETAIL: create path '" TEST_PATH "/pg/global'\n"
"P00 DETAIL: create path '" TEST_PATH "/pg/pg_tblspc'\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (4B, 100.00%%) checksum"
" 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P00 INFO: write " TEST_PATH "/pg/recovery.conf\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc'\n"
@ -2294,7 +2274,7 @@ testRun(void)
.tablespaceId = 1, .tablespaceName = "ts1");
HRN_MANIFEST_PATH_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC);
HRN_MANIFEST_PATH_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1");
HRN_MANIFEST_PATH_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1/PG_9.4_201409291");
HRN_MANIFEST_PATH_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1/PG_9.5_201510051");
HRN_MANIFEST_LINK_ADD(
manifest, .name = MANIFEST_TARGET_PGDATA "/" MANIFEST_TARGET_PGTBLSPC "/1", .destination = TEST_PATH "/ts/1");
@ -2304,11 +2284,11 @@ testRun(void)
// pg_tblspc/1/16384/PG_VERSION
HRN_MANIFEST_FILE_ADD(
manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION, .size = 4,
.timestamp = 1482182860, .checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1");
.timestamp = 1482182860, .checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
HRN_STORAGE_PUT_Z(
storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/" MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION,
PG_VERSION_94_Z "\n");
PG_VERSION_95_Z "\n");
// Always sort
lstSort(manifest->pub.targetList, sortOrderAsc);
@ -2332,7 +2312,8 @@ testRun(void)
TEST_RESULT_LOG(
"P00 INFO: repo1: restore backup set 20161219-212741F, recovery will start at 2016-12-19 21:27:40\n"
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.4_201409291' exists\n"
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.5_201510051' exists\n"
"P00 DETAIL: skip 'tablespace_map' -- tablespace links will be created based on mappings\n"
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/pg'\n"
"P00 DETAIL: update mode for '" TEST_PATH "/pg' to 0700\n"
"P00 DETAIL: remove invalid file '" TEST_PATH "/pg/bogus-file'\n"
@ -2345,21 +2326,20 @@ testRun(void)
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.conf (10B, 73.53%) checksum"
" 1a49a3c2240449fee1422e4afcf44d5b96378511\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION - exists and matches size 4 and modification time 1482182860"
" (4B, 85.29%) checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" (4B, 85.29%) checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, 88.24%) checksum"
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/tablespace_map (0B, 88.24%)\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, 100.00%)"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P00 WARN: recovery type is preserve but recovery file does not exist at '" TEST_PATH "/pg/recovery.conf'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/16384'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.4_201409291'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.5_201510051'\n"
"P00 WARN: backup does not contain 'global/pg_control' -- cluster will not start\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/global'\n"
"P00 INFO: restore size = 34B, file total = 6");
"P00 INFO: restore size = 34B, file total = 5");
TEST_STORAGE_LIST(
storagePg(), NULL,
@ -2370,8 +2350,7 @@ testRun(void)
"pg_tblspc/1> {d=" TEST_PATH "/ts/1}\n"
"postgresql.auto.conf {s=15, t=1482182861}\n"
"postgresql.conf {s=10, t=1482182860}\n"
"size-mismatch {s=1, t=1482182861}\n"
"tablespace_map {s=0, t=1482182860}\n",
"size-mismatch {s=1, t=1482182861}\n",
.level = storageInfoLevelBasic, .includeDot = true);
TEST_STORAGE_LIST(
@ -2379,7 +2358,7 @@ testRun(void)
".> {d=" TEST_PATH "/ts/1}\n"
"16384/\n"
"16384/PG_VERSION {s=4, t=1482182860}\n"
"PG_9.4_201409291/\n",
"PG_9.5_201510051/\n",
.level = storageInfoLevelBasic, .includeDot = true);
// PG_VERSION was not restored because delta force relies on time and size which were the same in the manifest and on disk
@ -2410,28 +2389,28 @@ testRun(void)
TEST_RESULT_LOG(
"P00 INFO: repo1: restore backup set 20161219-212741F, recovery will start at 2016-12-19 21:27:40\n"
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.4_201409291' exists\n"
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.5_201510051' exists\n"
"P00 DETAIL: skip 'tablespace_map' -- tablespace links will be created based on mappings\n"
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/pg'\n"
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/ts/1/PG_9.4_201409291'\n"
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/ts/1/PG_9.5_201510051'\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.auto.conf (15B, [PCT]) checksum"
" 37a0c84d42c3ec3d08c311cec2cef2a7ab55a7c3\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.conf (10B, [PCT]) checksum"
" 1a49a3c2240449fee1422e4afcf44d5b96378511\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (4B, [PCT]) checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (4B, [PCT]) checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, [PCT]) checksum"
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/tablespace_map (0B, [PCT])\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, [PCT])"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P00 WARN: recovery type is preserve but recovery file does not exist at '" TEST_PATH "/pg/recovery.conf'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/16384'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.4_201409291'\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.5_201510051'\n"
"P00 WARN: backup does not contain 'global/pg_control' -- cluster will not start\n"
"P00 DETAIL: sync path '" TEST_PATH "/pg/global'\n"
"P00 INFO: restore size = [SIZE], file total = 6");
"P00 INFO: restore size = [SIZE], file total = 5");
TEST_STORAGE_LIST(
storagePg(), NULL,
@ -2442,8 +2421,7 @@ testRun(void)
"pg_tblspc/1> {d=" TEST_PATH "/ts/1}\n"
"postgresql.auto.conf {s=15, t=1482182861}\n"
"postgresql.conf {s=10, t=1482182860}\n"
"size-mismatch {s=1, t=1482182861}\n"
"tablespace_map {s=0, t=1482182860}\n",
"size-mismatch {s=1, t=1482182861}\n",
.level = storageInfoLevelBasic, .includeDot = true);
TEST_STORAGE_LIST(
@ -2451,14 +2429,14 @@ testRun(void)
".> {d=" TEST_PATH "/ts/1}\n"
"16384/\n"
"16384/PG_VERSION {s=4, t=1482182860}\n"
"PG_9.4_201409291/\n",
"PG_9.5_201510051/\n",
.level = storageInfoLevelBasic, .includeDot = true);
// PG_VERSION was restored by the force option
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_94_Z "\n", .comment = "check PG_VERSION was restored");
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_95_Z "\n", .comment = "check PG_VERSION was restored");
// Remove tablespace
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.4_201409291", .recurse = true);
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.5_201510051", .recurse = true);
// Remove files
HRN_STORAGE_REMOVE(storagePgWrite(), "postgresql.conf");
@ -2619,8 +2597,8 @@ testRun(void)
// base/16384/PG_VERSION
HRN_MANIFEST_FILE_ADD(
manifest, .name = TEST_PGDATA "base/16384/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1");
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n");
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
// base/16384/16385
fileBuffer = bufNew(16384);
@ -2639,8 +2617,8 @@ testRun(void)
// base/32768/PG_VERSION
HRN_MANIFEST_FILE_ADD(
manifest, .name = TEST_PGDATA "base/32768/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1");
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n");
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
// base/32768/32769
fileBuffer = bufNew(32768);
@ -2816,7 +2794,6 @@ testRun(void)
"P00 DETAIL: remove invalid path '" TEST_PATH "/pg/bogus1'\n"
"P00 DETAIL: remove invalid path '" TEST_PATH "/pg/global/bogus3'\n"
"P00 DETAIL: remove invalid link '" TEST_PATH "/pg/pg_wal2'\n"
"P00 DETAIL: remove invalid file '" TEST_PATH "/pg/tablespace_map'\n"
"P00 DETAIL: create path '" TEST_PATH "/pg/base/16384'\n"
"P00 DETAIL: create path '" TEST_PATH "/pg/base/32768'\n"
"P00 DETAIL: create symlink '" TEST_PATH "/pg/pg_xact' to '../xact'\n"
@ -2838,9 +2815,9 @@ testRun(void)
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_hba.conf (11B, [PCT]) checksum"
" 401215e092779574988a854d8c7caed7f91dba4b\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/32768/PG_VERSION (4B, [PCT])"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION (4B, [PCT])"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/10 (bundle 20161219-212741F/1/1, 8KB, [PCT])"
" checksum 28757c756c03c37aca13692cb719c18d1510c190\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (bundle 1/0, 4B, [PCT]) checksum"
@ -2964,7 +2941,7 @@ testRun(void)
// Enlarge a file so it gets truncated. Keep timestamp the same to prove that it gets updated after the truncate.
HRN_STORAGE_PUT_Z(
storagePgWrite(), "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n\n", .modeFile = 0600,
storagePgWrite(), "base/16384/" PG_FILE_PGVERSION, PG_VERSION_95_Z "\n\n", .modeFile = 0600,
.timeModified = 1482182860);
// Enlarge a zero-length file so it gets truncated
@ -3032,9 +3009,9 @@ testRun(void)
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_hba.conf - exists and matches backup (11B, [PCT])"
" checksum 401215e092779574988a854d8c7caed7f91dba4b\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/32768/PG_VERSION - exists and matches backup (4B, [PCT])"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION - exists and matches backup (4B, [PCT])"
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/10 - exists and matches backup (bundle 20161219-212741F/1/1, 8KB,"
" [PCT]) checksum 28757c756c03c37aca13692cb719c18d1510c190\n"
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION - exists and matches backup (bundle 1/0, 4B, [PCT])"

View File

@ -563,10 +563,10 @@ testRun(void)
TEST_TITLE("pgControl and database match");
// Create pg_control
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
HRN_PQ_SCRIPT_SET(
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg", false, NULL, NULL));
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL));
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create - db online");
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'db' on repo1");
@ -584,7 +584,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argList);
HRN_PQ_SCRIPT_SET(
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_94, TEST_PATH "/pg", false, NULL, NULL));
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL));
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - db online");
TEST_RESULT_LOG(
@ -637,7 +637,7 @@ testRun(void)
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_13);
// Create pg_control for standby
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
HRN_PQ_SCRIPT_SET(
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_13, TEST_PATH "/pg", true, NULL, NULL),

View File

@ -36,12 +36,12 @@ testRun(void)
uint64_t fileSize = 7;
const Buffer *fileChecksum = bufNewDecode(encodingHex, STRDEF("d1cd8a7d11daa26814b93eb604e1d49ab4b43770"));
#define TEST_BACKUP_DB1_94 \
"db-catalog-version=201409291\n" \
#define TEST_BACKUP_DB1_95 \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n" \
"db-version=\"9.4\"\n"
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
"db-version=\"9.5\"\n"
#define TEST_BACKUP_DB2_11 \
"db-catalog-version=201707211\n" \
@ -80,8 +80,8 @@ testRun(void)
"\"option-checksum-page\":true,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
#define TEST_BACKUP_DB1_HISTORY \
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_94_Z "," \
"\"db-version\":\"9.4\"}"
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_95_Z "," \
"\"db-version\":\"9.5\"}"
#define TEST_BACKUP_DB2_HISTORY \
"2={\"db-catalog-version\":201707211,\"db-control-version\":1100,\"db-system-id\":" HRN_PG_SYSTEMID_11_Z "," \
@ -104,11 +104,11 @@ testRun(void)
#define TEST_ARCHIVE_INFO_BASE \
"[db]\n" \
"db-id=1\n" \
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n" \
"db-version=\"9.4\"\n" \
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
"db-version=\"9.5\"\n" \
"\n" \
"[db:history]\n" \
"1={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.4\"}"
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}"
#define TEST_ARCHIVE_INFO_MULTI_HISTORY_BASE \
"[db]\n" \
@ -117,7 +117,7 @@ testRun(void)
"db-version=\"11\"\n" \
"\n" \
"[db:history]\n" \
"1={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.4\"}\n" \
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n" \
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"
#define TEST_MANIFEST_HEADER \
@ -131,11 +131,11 @@ testRun(void)
#define TEST_MANIFEST_DB_94 \
"\n" \
"[backup:db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n" \
"db-version=\"9.4\"\n"
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
"db-version=\"9.5\"\n"
#define TEST_MANIFEST_OPTION_ALL \
"\n" \
@ -234,7 +234,7 @@ testRun(void)
"db-catalog-version=201608131\n"
"db-control-version=960\n"
"db-id=1\n"
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n" // 9.4 system id is used so version will trigger error
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" // 9.5 system id is used so version will trigger error
"db-version=\"9.6\"\n"
TEST_MANIFEST_OPTION_ALL
TEST_MANIFEST_TARGET
@ -257,7 +257,7 @@ testRun(void)
"P00 DETAIL: unable to open missing file '" TEST_PATH "/repo/backup/db/20181119-152138F/backup.manifest.copy'"
" for read\n"
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.6, system-id"
" " HRN_PG_SYSTEMID_94_Z ") is not in the backup.info history, skipping");
" " HRN_PG_SYSTEMID_95_Z ") is not in the backup.info history, skipping");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("rerun test with db-system-id invalid and no main");
@ -268,11 +268,11 @@ testRun(void)
TEST_MANIFEST_HEADER
"\n"
"[backup:db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=0\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
TEST_MANIFEST_OPTION_ALL
TEST_MANIFEST_TARGET
TEST_MANIFEST_DB
@ -291,7 +291,7 @@ testRun(void)
TEST_RESULT_LOG(
"P00 DETAIL: unable to open missing file '" TEST_PATH "/repo/backup/db/20181119-152138F/backup.manifest' for read\n"
"P00 DETAIL: 20181119-152138F/backup.manifest is missing or unusable, using copy\n"
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.4, system-id 0) is not in the"
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.5, system-id 0) is not in the"
" backup.info history, skipping");
// -------------------------------------------------------------------------------------------------------------------------
@ -302,11 +302,11 @@ testRun(void)
TEST_MANIFEST_HEADER
"\n"
"[backup:db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=0\n"
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n"
"db-version=\"9.4\"\n"
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n"
"db-version=\"9.5\"\n"
TEST_MANIFEST_OPTION_ALL
TEST_MANIFEST_TARGET
TEST_MANIFEST_DB
@ -325,8 +325,8 @@ testRun(void)
TEST_RESULT_LOG(
"P00 DETAIL: unable to open missing file '" TEST_PATH "/repo/backup/db/20181119-152138F/backup.manifest' for read\n"
"P00 DETAIL: 20181119-152138F/backup.manifest is missing or unusable, using copy\n"
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 0, version 9.4, system-id"
" " HRN_PG_SYSTEMID_94_Z ") is not in the backup.info history, skipping");
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 0, version 9.5, system-id"
" " HRN_PG_SYSTEMID_95_Z ") is not in the backup.info history, skipping");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("missing main manifest, errored copy");
@ -394,7 +394,7 @@ testRun(void)
VerifyArchiveResult archiveResult =
{
.archiveId = strNewZ("9.4-1"),
.archiveId = strNewZ("9.5-1"),
.walRangeList = lstNewP(sizeof(VerifyWalRange), .comparator = lstComparatorStr),
};
List *archiveIdResultList = lstNewP(sizeof(VerifyArchiveResult), .comparator = archiveIdComparator);
@ -405,7 +405,7 @@ testRun(void)
TEST_TITLE("Single WAL");
archiveIdResult->pgWalInfo.size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT;
archiveIdResult->pgWalInfo.version = PG_VERSION_94;
archiveIdResult->pgWalInfo.version = PG_VERSION_95;
strLstAddZ(walFileList, "000000020000000200000000-daa497dba64008db824607940609ba1cd7c6c501.gz");
@ -430,7 +430,7 @@ testRun(void)
TEST_RESULT_UINT(errTotal, 1, "duplicate WAL error");
TEST_RESULT_UINT(strLstSize(walFileList), 0, "all WAL removed from WAL file list");
TEST_RESULT_UINT(lstSize(archiveIdResult->walRangeList), 0, "no range");
TEST_RESULT_LOG("P00 INFO: duplicate WAL '000000020000000200000000' for '9.4-1' exists, skipping");
TEST_RESULT_LOG("P00 INFO: duplicate WAL '000000020000000200000000' for '9.5-1' exists, skipping");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("duplicates at beginning and end of list are removed");
@ -457,8 +457,8 @@ testRun(void)
TEST_RESULT_STR_Z(walRangeResult->start, "0000000200000001000000FD", "start range");
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000000", "stop range");
TEST_RESULT_LOG(
"P00 INFO: duplicate WAL '000000020000000100000000' for '9.4-1' exists, skipping\n"
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.4-1' exists, skipping");
"P00 INFO: duplicate WAL '000000020000000100000000' for '9.5-1' exists, skipping\n"
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.5-1' exists, skipping");
}
// *****************************************************************************************************************************
@ -507,7 +507,7 @@ testRun(void)
"db-version=\"11\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":6625592122879095777,\"db-version\":\"9.4\"}\n"
"1={\"db-id\":6625592122879095777,\"db-version\":\"9.5\"}\n"
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
"archive.info history system id mismatch");
@ -529,7 +529,7 @@ testRun(void)
"db-version=\"11\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.5\"}\n"
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.6\"}\n"
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
"archive.info history version mismatch");
@ -551,7 +551,7 @@ testRun(void)
"db-version=\"11\"\n"
"\n"
"[db:history]\n"
"3={\"db-id\":" HRN_PG_SYSTEMID_94_Z ",\"db-version\":\"9.4\"}\n"
"3={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n"
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
"archive.info history id mismatch");
@ -580,7 +580,7 @@ testRun(void)
strLstAddZ(backupList, "20181119-152138F");
strLstAddZ(backupList, "20181119-152900F");
StringList *archiveIdList = strLstComparatorSet(strLstNew(), archiveIdComparator);
strLstAddZ(archiveIdList, "9.4-1");
strLstAddZ(archiveIdList, "9.5-1");
strLstAddZ(archiveIdList, "11-2");
unsigned int errTotal = 0;
@ -721,7 +721,7 @@ testRun(void)
TEST_BACKUP_DB1_CURRENT_FULL1
"\n"
"[db]\n"
TEST_BACKUP_DB1_94
TEST_BACKUP_DB1_95
"\n"
"[db:history]\n"
TEST_BACKUP_DB1_HISTORY,
@ -782,7 +782,7 @@ testRun(void)
"P00 INFO: stanza: db\n"
" status: error\n"
" backup info file and archive info file do not match\n"
" archive: id = 1, version = 9.4, system-id = 10000000000000090400\n"
" archive: id = 1, version = 9.5, system-id = 10000000000000090500\n"
" backup : id = 2, version = 11, system-id = 10000000000000110000\n"
" HINT: this may be a symptom of repository corruption!");
@ -971,7 +971,7 @@ testRun(void)
.comment = "remove duplicate WAL");
HRN_STORAGE_PATH_CREATE(
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.4-1", .comment = "empty path for old archiveId");
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.5-1", .comment = "empty path for old archiveId");
HRN_STORAGE_PATH_CREATE(
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/11-2/0000000100000000", .comment = "empty timeline path");
@ -1002,7 +1002,7 @@ testRun(void)
" checksum invalid: 1, size invalid: 1", "verifyProcess() no text, no verbose");
TEST_RESULT_LOG(
"P00 DETAIL: no backups exist in the repo\n"
"P00 DETAIL: archive path '9.4-1' is empty\n"
"P00 DETAIL: archive path '9.5-1' is empty\n"
"P00 DETAIL: path '11-2/0000000100000000' does not contain any valid WAL to be processed\n"
"P01 INFO: invalid checksum"
" '11-2/0000000200000007/000000020000000700000FFD-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz'\n"
@ -1023,7 +1023,7 @@ testRun(void)
verifyProcess(cfgOptionBool(cfgOptVerbose)),
"stanza: db\n"
"status: error\n"
" archiveId: 9.4-1, total WAL checked: 0, total valid WAL: 0\n"
" archiveId: 9.5-1, total WAL checked: 0, total valid WAL: 0\n"
" archiveId: 11-2, total WAL checked: 4, total valid WAL: 2\n"
" missing: 0, checksum invalid: 1, size invalid: 1, other: 0\n"
" backup: none found",
@ -1045,7 +1045,7 @@ testRun(void)
verifyProcess(cfgOptionBool(cfgOptVerbose)),
"stanza: db\n"
"status: error\n"
" archiveId: 9.4-1, total WAL checked: 0, total valid WAL: 0\n"
" archiveId: 9.5-1, total WAL checked: 0, total valid WAL: 0\n"
" archiveId: 11-2, total WAL checked: 4, total valid WAL: 2\n"
" missing: 0, checksum invalid: 1, size invalid: 1, other: 0\n"
" backup: none found", "verify text output, verbose, with verify failures");
@ -1261,7 +1261,7 @@ testRun(void)
// Check output of verify command stored in file
TEST_STORAGE_GET(storageTest, strZ(stdoutFile), "", .remove = true);
TEST_RESULT_LOG(
"P00 DETAIL: archive path '9.4-1' is empty\n"
"P00 DETAIL: archive path '9.5-1' is empty\n"
"P00 DETAIL: path '11-2/0000000100000000' does not contain any valid WAL to be processed\n"
"P01 INFO: invalid checksum"
" '11-2/0000000200000007/000000020000000700000FFD-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz'\n"

View File

@ -83,7 +83,7 @@ testRun(void)
HRN_PQ_SCRIPT_OPEN(1, "dbname='testdb' port=5432"),
HRN_PQ_SCRIPT_SET_SEARCH_PATH(1),
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(1),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_95, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_SET_APPLICATION_NAME(1),
HRN_PQ_SCRIPT_IS_STANDBY_QUERY(1, false),
HRN_PQ_SCRIPT_CLOSE(1),
@ -91,7 +91,7 @@ testRun(void)
HRN_PQ_SCRIPT_OPEN(1, "dbname='testdb' port=5432"),
HRN_PQ_SCRIPT_SET_SEARCH_PATH(1),
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(1),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_95, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_SET_APPLICATION_NAME(1),
HRN_PQ_SCRIPT_IS_STANDBY_QUERY(1, false),
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(1, "2/3"),
@ -130,7 +130,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdBackup, argList);
// Create control file
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
// Create client
ProtocolClient *client = NULL;
@ -204,7 +204,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdBackup, argList);
// Create control file
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_94, .checkpoint = pgLsnFromStr(STRDEF("1/1")));
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95, .checkpoint = pgLsnFromStr(STRDEF("1/1")));
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error when unable to select any pg_settings");
@ -680,7 +680,7 @@ testRun(void)
HRN_CFG_LOAD(cfgCmdBackup, argList);
// Create control file
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_94);
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error connecting to primary");
@ -706,7 +706,7 @@ testRun(void)
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
HRN_PQ_SCRIPT_SET_SEARCH_PATH(1),
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(1),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_95, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_SET_APPLICATION_NAME(1),
HRN_PQ_SCRIPT_IS_STANDBY_QUERY(1, true),
HRN_PQ_SCRIPT_CLOSE(1));
@ -723,7 +723,7 @@ testRun(void)
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432 user='bob'"),
HRN_PQ_SCRIPT_SET_SEARCH_PATH(1),
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(1),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_94, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_VALIDATE_QUERY(1, PG_VERSION_95, TEST_PATH "/pg", NULL, NULL),
HRN_PQ_SCRIPT_SET_APPLICATION_NAME(1),
HRN_PQ_SCRIPT_IS_STANDBY_QUERY(1, false),
HRN_PQ_SCRIPT_CLOSE(1));
@ -736,7 +736,7 @@ testRun(void)
HRN_PQ_SCRIPT_SET(
HRN_PQ_SCRIPT_OPEN_GE_93(
1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_94, TEST_PATH "/pg1", false, NULL, NULL),
1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
HRN_PQ_SCRIPT_CLOSE(1));
TEST_ASSIGN(result, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary only");
@ -745,7 +745,7 @@ testRun(void)
TEST_RESULT_BOOL(result.primary != NULL, true, "check primary");
TEST_RESULT_INT(result.standbyIdx, 0, "check standby id");
TEST_RESULT_BOOL(result.standby == NULL, true, "check standby");
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_94, "version set");
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_95, "version set");
TEST_RESULT_STR_Z(dbPgDataPath(result.primary), TEST_PATH "/pg1", "path set");
TEST_RESULT_VOID(dbFree(result.primary), "free primary");

View File

@ -28,10 +28,10 @@ testRun(void)
"[db]\n"
"db-id=1\n"
"db-system-id=6569239123849665679\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.4\"}\n");
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.5\"}\n");
InfoArchive *info = NULL;
@ -43,7 +43,7 @@ testRun(void)
}
MEM_CONTEXT_TEMP_END();
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", "archiveId set");
TEST_RESULT_STR_Z(infoArchiveId(info), "9.5-1", "archiveId set");
TEST_RESULT_PTR(infoArchivePg(info), info->pub.infoPg, "infoPg set");
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, "no cipher sub");
@ -61,8 +61,8 @@ testRun(void)
// Create the same content by creating a new object
TEST_ASSIGN(
info, infoArchiveNew(PG_VERSION_94, 6569239123849665679, NULL), "infoArchiveNew() - no sub cipher");
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", "archiveId set");
info, infoArchiveNew(PG_VERSION_95, 6569239123849665679, NULL), "infoArchiveNew() - no sub cipher");
TEST_RESULT_STR_Z(infoArchiveId(info), "9.5-1", "archiveId set");
TEST_RESULT_PTR(infoArchivePg(info), info->pub.infoPg, "infoPg set");
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, "no cipher sub");
TEST_RESULT_INT(infoPgDataTotal(infoArchivePg(info)), 1, "history set");
@ -97,10 +97,10 @@ testRun(void)
TEST_TITLE("increment history");
InfoPgData infoPgData = {0};
TEST_RESULT_VOID(infoArchivePgSet(info, PG_VERSION_94, 6569239123849665679), "add another infoPg");
TEST_RESULT_VOID(infoArchivePgSet(info, PG_VERSION_95, 6569239123849665679), "add another infoPg");
TEST_RESULT_INT(infoPgDataTotal(infoArchivePg(info)), 2, "history incremented");
TEST_ASSIGN(infoPgData, infoPgDataCurrent(infoArchivePg(info)), "get current infoPgData");
TEST_RESULT_INT(infoPgData.version, PG_VERSION_94, "version set");
TEST_RESULT_INT(infoPgData.version, PG_VERSION_95, "version set");
TEST_RESULT_UINT(infoPgData.systemId, 6569239123849665679, "systemId set");
// -------------------------------------------------------------------------------------------------------------------------
@ -115,24 +115,24 @@ testRun(void)
"[db]\n"
"db-id=2\n"
"db-system-id=6626363367545678089\n"
"db-version=\"9.5\"\n"
"db-version=\"17\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":6625592122879095702,\"db-version\":\"9.4\"}\n"
"2={\"db-id\":6626363367545678089,\"db-version\":\"9.5\"}\n");
"1={\"db-id\":6625592122879095702,\"db-version\":\"9.6\"}\n"
"2={\"db-id\":6626363367545678089,\"db-version\":\"17\"}\n");
TEST_ASSIGN(info, infoArchiveNewLoad(ioBufferReadNew(contentLoad)), "new archive info");
TEST_RESULT_STR_Z(infoArchiveIdHistoryMatch(info, 2, 90500, 6626363367545678089), "9.5-2", "full match found");
TEST_RESULT_STR_Z(infoArchiveIdHistoryMatch(info, 2, 170000, 6626363367545678089), "17-2", "full match found");
TEST_RESULT_STR_Z(infoArchiveIdHistoryMatch(info, 2, 90400, 6625592122879095702), "9.4-1", "partial match found");
TEST_RESULT_STR_Z(infoArchiveIdHistoryMatch(info, 2, 90600, 6625592122879095702), "9.6-1", "partial match found");
TEST_ERROR(
infoArchiveIdHistoryMatch(info, 2, 90400, 6625592122879095799), ArchiveMismatchError,
"unable to retrieve the archive id for database version '9.4' and system-id '6625592122879095799'");
infoArchiveIdHistoryMatch(info, 2, 90500, 6625592122879095799), ArchiveMismatchError,
"unable to retrieve the archive id for database version '9.5' and system-id '6625592122879095799'");
TEST_ERROR(
infoArchiveIdHistoryMatch(info, 2, 90400, 6626363367545678089), ArchiveMismatchError,
"unable to retrieve the archive id for database version '9.4' and system-id '6626363367545678089'");
infoArchiveIdHistoryMatch(info, 2, 90500, 6626363367545678089), ArchiveMismatchError,
"unable to retrieve the archive id for database version '9.5' and system-id '6626363367545678089'");
}
// *****************************************************************************************************************************

View File

@ -28,18 +28,18 @@ testRun(void)
// File with section to ignore
const Buffer *contentLoad = harnessInfoChecksumZ(
"[db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=6569239123849665679\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[ignore-section]\n"
"key1=\"value1\"\n"
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.4\"}\n");
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.5\"}\n");
InfoBackup *infoBackup = NULL;
@ -63,7 +63,7 @@ testRun(void)
Buffer *contentCompare = bufNew(0);
TEST_ASSIGN(
infoBackup, infoBackupNew(PG_VERSION_94, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_94), NULL),
infoBackup, infoBackupNew(PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95), NULL),
"infoBackupNew() - no cipher sub");
TEST_RESULT_VOID(infoBackupSave(infoBackup, ioBufferWriteNew(contentCompare)), "save backup info from new");
TEST_RESULT_STR(strNewBuf(contentCompare), strNewBuf(contentSave), "check save");
@ -99,13 +99,13 @@ testRun(void)
InfoPgData infoPgData = {0};
TEST_RESULT_VOID(
infoBackupPgSet(infoBackup, PG_VERSION_94, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_94)),
infoBackupPgSet(infoBackup, PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95)),
"add another infoPg");
TEST_RESULT_INT(infoPgDataTotal(infoBackupPg(infoBackup)), 2, "history incremented");
TEST_ASSIGN(infoPgData, infoPgDataCurrent(infoBackupPg(infoBackup)), "get current infoPgData");
TEST_RESULT_INT(infoPgData.version, PG_VERSION_94, "version set");
TEST_RESULT_INT(infoPgData.version, PG_VERSION_95, "version set");
TEST_RESULT_UINT(infoPgData.systemId, 6569239123849665679, "systemId set");
TEST_RESULT_UINT(infoPgData.catalogVersion, 201409291, "catalogVersion set");
TEST_RESULT_UINT(infoPgData.catalogVersion, 201510051, "catalogVersion set");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("object free");
@ -144,15 +144,15 @@ testRun(void)
"\"option-checksum-page\":false,\"option-compress\":true,\"option-hardlink\":false,\"option-online\":true}\n"
"\n"
"[db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=6569239123849665679\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.4\"}\n");
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.5\"}\n");
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(contentLoad)), "new backup info");
@ -265,11 +265,11 @@ testRun(void)
#define TEST_MANIFEST_BACKUPDB \
"\n" \
"[backup:db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=6569239123849665679\n" \
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
#define TEST_MANIFEST_FILE_DEFAULT \
"\n" \
@ -942,15 +942,15 @@ testRun(void)
"\"option-online\":true}\n"
"\n"
"[db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=6569239123849665679\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[db:history]\n"
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.4\"}\n");
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
",\"db-version\":\"9.5\"}\n");
InfoBackup *infoBackup;
StringList *dependencyList;

View File

@ -50,15 +50,15 @@ testRun(void)
TEST_ASSIGN(
infoPg,
infoPgSet(
infoPgNew(infoPgArchive, NULL), infoPgArchive, PG_VERSION_94, 6569239123849665679,
hrnPgCatalogVersion(PG_VERSION_94)),
infoPgNew(infoPgArchive, NULL), infoPgArchive, PG_VERSION_95, 6569239123849665679,
hrnPgCatalogVersion(PG_VERSION_95)),
"infoPgSet - infoPgArchive");
TEST_RESULT_INT(infoPgDataTotal(infoPg), 1, " 1 history");
TEST_RESULT_INT(infoPgDataCurrentId(infoPg), 0, " 0 historyCurrent");
InfoPgData pgData = infoPgData(infoPg, infoPgDataCurrentId(infoPg));
TEST_RESULT_INT(pgData.id, 1, " id set");
TEST_RESULT_UINT(pgData.systemId, 6569239123849665679, " system-id set");
TEST_RESULT_UINT(pgData.version, PG_VERSION_94, " version set");
TEST_RESULT_UINT(pgData.version, PG_VERSION_95, " version set");
TEST_RESULT_UINT(pgData.catalogVersion, 0, " catalog version not set for archive");
TEST_ASSIGN(
@ -77,16 +77,16 @@ testRun(void)
TEST_ASSIGN(
infoPg,
infoPgSet(
infoPgNew(infoPgBackup, STRDEF("123xyz")), infoPgBackup, PG_VERSION_94, 6569239123849665679,
hrnPgCatalogVersion(PG_VERSION_94)),
infoPgNew(infoPgBackup, STRDEF("123xyz")), infoPgBackup, PG_VERSION_95, 6569239123849665679,
hrnPgCatalogVersion(PG_VERSION_95)),
"infoPgSet - infoPgBackup");
TEST_RESULT_INT(infoPgDataTotal(infoPg), 1, " 1 history");
TEST_RESULT_INT(infoPgDataCurrentId(infoPg), 0, " 0 historyCurrent");
pgData = infoPgData(infoPg, infoPgDataCurrentId(infoPg));
TEST_RESULT_INT(pgData.id, 1, " id set");
TEST_RESULT_UINT(pgData.systemId, 6569239123849665679, " system-id set");
TEST_RESULT_UINT(pgData.version, PG_VERSION_94, " version set");
TEST_RESULT_UINT(pgData.catalogVersion, 201409291, " catalog version updated");
TEST_RESULT_UINT(pgData.version, PG_VERSION_95, " version set");
TEST_RESULT_UINT(pgData.catalogVersion, 201510051, " catalog version updated");
TEST_RESULT_STR_Z(infoCipherPass(infoPgInfo(infoPg)), "123xyz", " cipherPass set");
}
@ -102,13 +102,13 @@ testRun(void)
"[db]\n"
"db-id=1\n"
"db-system-id=6569239123849665679\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[db:backup]\n"
"key=\"value\"\n"
"\n"
"[db:history]\n"
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.4\"}\n"
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.5\"}\n"
"\n"
"[later]\n"
"key=\"value\"\n");
@ -129,10 +129,10 @@ testRun(void)
InfoPgData pgData = infoPgDataCurrent(infoPg);
TEST_RESULT_INT(pgData.id, 1, " id set");
TEST_RESULT_UINT(pgData.version, PG_VERSION_94, " version set");
TEST_RESULT_UINT(pgData.version, PG_VERSION_95, " version set");
TEST_RESULT_UINT(pgData.systemId, 6569239123849665679, " system-id set");
TEST_RESULT_INT(infoPgDataTotal(infoPg), 1, " check pg data total");
TEST_RESULT_STR_Z(infoPgArchiveId(infoPg, 0), "9.4-1", " check pg archive id");
TEST_RESULT_STR_Z(infoPgArchiveId(infoPg, 0), "9.5-1", " check pg archive id");
TEST_RESULT_STR(infoPgCipherPass(infoPg), NULL, " no cipher passphrase");
Buffer *contentSave = bufNew(0);

View File

@ -70,11 +70,11 @@ testRun(void)
#define TEST_MANIFEST_DB_94 \
"\n" \
"[backup:db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=0\n" \
"db-system-id=0\n" \
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
#define TEST_MANIFEST_DB_12 \
"\n" \
@ -162,10 +162,10 @@ testRun(void)
Storage *storagePgWrite = storagePosixNewP(STRDEF(TEST_PATH "/pg"), .write = true);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("manifest with all features - 9.4");
TEST_TITLE("manifest with all features - 9.5");
// Version
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.4\n", .modeFile = 0600, .timeModified = 1565282100);
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.5\n", .modeFile = 0600, .timeModified = 1565282100);
// base/1 directory
HRN_STORAGE_PATH_CREATE(storagePgWrite, PG_PATH_BASE, .mode = 0700);
@ -267,13 +267,13 @@ testRun(void)
storagePgWrite, "pg_xlog/archive_status/" BOGUS_STR, "TESTDATA", .modeFile = 0600, .timeModified = 1565282120);
// Tablespace 1
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.4_201409291/1", .mode = 0700);
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.5_201510051/1", .mode = 0700);
HRN_STORAGE_PATH_CREATE(storagePgWrite, MANIFEST_TARGET_PGTBLSPC, .mode = 0700);
THROW_ON_SYS_ERROR(symlink("../../ts/1", TEST_PATH "/pg/pg_tblspc/1") == -1, FileOpenError, "unable to create symlink");
HRN_STORAGE_PUT_Z(
storagePgWrite,"pg_tblspc/1/PG_9.4_201409291/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
storagePgWrite,"pg_tblspc/1/PG_9.5_201510051/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
HRN_STORAGE_PUT_Z(
storagePgWrite,"pg_tblspc/1/PG_9.4_201409291/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
storagePgWrite,"pg_tblspc/1/PG_9.5_201510051/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
.timeModified = 1565282115);
// Add tablespaceList with error (no name)
@ -288,7 +288,7 @@ testRun(void)
// Test tablespace error
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, exclusionList,
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, exclusionList,
pckWriteResult(tablespaceList)),
AssertError,
"tablespace with oid 1 not found in tablespace map\n"
@ -313,7 +313,7 @@ testRun(void)
TEST_ASSIGN(
manifest,
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, NULL,
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL,
pckWriteResult(tablespaceList)),
"build manifest");
TEST_RESULT_VOID(manifestBackupLabelSet(manifest, STRDEF("20190818-084502F")), "backup label set");
@ -347,7 +347,7 @@ testRun(void)
"pg_data/pg_xlog/BOGUS={\"size\":0,\"timestamp\":1565282108}\n"
"pg_data/pg_xlog/archive_status/BOGUS={\"size\":8,\"timestamp\":1565282120}\n"
"pg_data/postgresql.conf={\"size\":14,\"timestamp\":1565282116}\n"
"pg_tblspc/1/PG_9.4_201409291/1/16384={\"size\":8,\"timestamp\":1565282115}\n"
"pg_tblspc/1/PG_9.5_201510051/1/16384={\"size\":8,\"timestamp\":1565282115}\n"
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_TRUE
"\n"
"[target:link]\n"
@ -374,8 +374,8 @@ testRun(void)
"pg_data/pg_xlog/archive_status={\"mode\":\"0777\"}\n"
"pg_tblspc={}\n"
"pg_tblspc/1={}\n"
"pg_tblspc/1/PG_9.4_201409291={}\n"
"pg_tblspc/1/PG_9.4_201409291/1={}\n"
"pg_tblspc/1/PG_9.5_201510051={}\n"
"pg_tblspc/1/PG_9.5_201510051/1={}\n"
TEST_MANIFEST_PATH_DEFAULT)),
"check manifest");
@ -390,10 +390,10 @@ testRun(void)
// Remove symlinks and directories
THROW_ON_SYS_ERROR(unlink(TEST_PATH "/pg/pg_tblspc/1") == -1, FileRemoveError, "unable to remove symlink");
HRN_STORAGE_PATH_REMOVE(storageTest,"ts/1/PG_9.4_201409291", .recurse = true);
HRN_STORAGE_PATH_REMOVE(storageTest,"ts/1/PG_9.5_201510051", .recurse = true);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("manifest with all features - 9.4, online");
TEST_TITLE("manifest with all features - 9.5, online");
// Create a path other than archive_status under pg_xlog for code coverage
HRN_STORAGE_PATH_CREATE(storagePgWrite, "pg_xlog/somepath", .mode = 0700);
@ -403,14 +403,14 @@ testRun(void)
HRN_STORAGE_PUT_Z(
storagePgWrite, "pg_wal/000000010000000000000001", "WALDATA", .modeFile = 0600, .timeModified = 1565282120);
// Files to conditionally ignore before 9.4
// Files to conditionally ignore before 9.5
HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTGRESQLAUTOCONFTMP, .modeFile = 0600, .timeModified = 1565282101);
// Test manifest - temp tables, unlogged tables, pg_serial and pg_xlog files ignored
TEST_ASSIGN(
manifest,
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, true, false, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, true, false, false, false, NULL, NULL, NULL),
"build manifest");
contentSave = bufNew(0);
@ -490,10 +490,10 @@ testRun(void)
HRN_STORAGE_REMOVE(storageTest, TEST_PATH "/wal/wal");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("manifest with all features - 9.4, checksum-page");
TEST_TITLE("manifest with all features - 9.5, checksum-page");
// Version
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.4\n", .modeFile = 0600, .timeModified = 1565282100);
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.5\n", .modeFile = 0600, .timeModified = 1565282100);
// Put a pgcontrol (always primary:true)
HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, .modeFile = 0600, .timeModified = 1565282101);
@ -514,12 +514,12 @@ testRun(void)
HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_BACKUPLABEL, .modeFile = 0600, .timeModified = 1565282101);
// Tablespace 1
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.4_201409291/1", .mode = 0700);
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.5_201510051/1", .mode = 0700);
THROW_ON_SYS_ERROR(symlink("../../ts/1", TEST_PATH "/pg/pg_tblspc/1") == -1, FileOpenError, "unable to create symlink");
HRN_STORAGE_PUT_Z(
storagePgWrite, "pg_tblspc/1/PG_9.4_201409291/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
storagePgWrite, "pg_tblspc/1/PG_9.5_201510051/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
HRN_STORAGE_PUT_Z(
storagePgWrite, "pg_tblspc/1/PG_9.4_201409291/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
storagePgWrite, "pg_tblspc/1/PG_9.5_201510051/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
.timeModified = 1565282115);
// Add checksum-page files to exclude from checksum-page validation in database relation directories
@ -527,19 +527,19 @@ testRun(void)
HRN_STORAGE_PUT_EMPTY(
storagePgWrite, PG_PATH_BASE "/1/" PG_FILE_PGFILENODEMAP, .modeFile = 0600, .timeModified = 1565282120);
HRN_STORAGE_PUT_EMPTY(
storagePgWrite, "pg_tblspc/1/PG_9.4_201409291/1/" PG_FILE_PGVERSION, .modeFile = 0600, .timeModified = 1565282120);
storagePgWrite, "pg_tblspc/1/PG_9.5_201510051/1/" PG_FILE_PGVERSION, .modeFile = 0600, .timeModified = 1565282120);
// Tablespace 2
HRN_STORAGE_PATH_CREATE(storageTest, "ts/2/PG_9.4_201409291/1", .mode = 0700);
HRN_STORAGE_PATH_CREATE(storageTest, "ts/2/PG_9.5_201510051/1", .mode = 0700);
THROW_ON_SYS_ERROR(symlink("../../ts/2", TEST_PATH "/pg/pg_tblspc/2") == -1, FileOpenError, "unable to create symlink");
HRN_STORAGE_PUT_Z(
storagePgWrite, "pg_tblspc/2/PG_9.4_201409291/1/16385", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
storagePgWrite, "pg_tblspc/2/PG_9.5_201510051/1/16385", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
// Test manifest - pg_dynshmem, pg_replslot and postgresql.auto.conf.tmp files ignored
TEST_ASSIGN(
manifest,
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, true, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, true, false, false, NULL, NULL, NULL),
"build manifest");
contentSave = bufNew(0);
@ -580,9 +580,9 @@ testRun(void)
"pg_data/postgresql.conf={\"size\":14,\"timestamp\":1565282116}\n"
"pg_data/recovery.signal={\"size\":0,\"timestamp\":1565282101}\n"
"pg_data/standby.signal={\"size\":0,\"timestamp\":1565282101}\n"
"pg_tblspc/1/PG_9.4_201409291/1/16384={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
"pg_tblspc/1/PG_9.4_201409291/1/PG_VERSION={\"size\":0,\"timestamp\":1565282120}\n"
"pg_tblspc/2/PG_9.4_201409291/1/16385={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
"pg_tblspc/1/PG_9.5_201510051/1/16384={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
"pg_tblspc/1/PG_9.5_201510051/1/PG_VERSION={\"size\":0,\"timestamp\":1565282120}\n"
"pg_tblspc/2/PG_9.5_201510051/1/16385={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_FALSE
"\n"
"[target:link]\n"
@ -613,11 +613,11 @@ testRun(void)
"pg_data/pg_xlog={}\n"
"pg_tblspc={}\n"
"pg_tblspc/1={}\n"
"pg_tblspc/1/PG_9.4_201409291={}\n"
"pg_tblspc/1/PG_9.4_201409291/1={}\n"
"pg_tblspc/1/PG_9.5_201510051={}\n"
"pg_tblspc/1/PG_9.5_201510051/1={}\n"
"pg_tblspc/2={}\n"
"pg_tblspc/2/PG_9.4_201409291={}\n"
"pg_tblspc/2/PG_9.4_201409291/1={}\n"
"pg_tblspc/2/PG_9.5_201510051={}\n"
"pg_tblspc/2/PG_9.5_201510051/1={}\n"
TEST_MANIFEST_PATH_DEFAULT)),
"check manifest");
@ -855,7 +855,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
LinkDestinationError, "link 'link' destination '" TEST_PATH "/pg/base' is in PGDATA");
THROW_ON_SYS_ERROR(unlink(TEST_PATH "/pg/link") == -1, FileRemoveError, "unable to remove symlink");
@ -867,7 +867,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
LinkExpectedError, "'pg_data/pg_tblspc/somedir' is not a symlink - pg_tblspc should contain only symlinks");
HRN_STORAGE_PATH_REMOVE(storagePgWrite, MANIFEST_TARGET_PGTBLSPC "/somedir");
@ -879,7 +879,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
LinkExpectedError, "'pg_data/pg_tblspc/somefile' is not a symlink - pg_tblspc should contain only symlinks");
TEST_STORAGE_EXISTS(storagePgWrite, MANIFEST_TARGET_PGTBLSPC "/somefile", .remove = true);
@ -891,7 +891,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, true, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, true, false, false, NULL, NULL, NULL),
FileOpenError, "unable to get info for missing path/file '" TEST_PATH "/pg/link-to-link'");
THROW_ON_SYS_ERROR(unlink(TEST_PATH "/pg/link-to-link") == -1, FileRemoveError, "unable to remove symlink");
@ -907,7 +907,7 @@ testRun(void)
TEST_ERROR(
manifestNewBuild(
storagePg, PG_VERSION_94, hrnPgCatalogVersion(PG_VERSION_94), 0, false, false, false, false, NULL, NULL, NULL),
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
LinkDestinationError, "link '" TEST_PATH "/pg/linktolink' cannot reference another link '" TEST_PATH "/linktest'");
#undef TEST_MANIFEST_HEADER
@ -1420,11 +1420,11 @@ testRun(void)
"backup-type=\"full\"\n"
"\n"
"[backup:db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=1\n"
"db-system-id=1000000000000000094\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[backup:option]\n"
"option-archive-check=true\n"
@ -1508,11 +1508,11 @@ testRun(void)
"backup-type=\"full\"\n" \
"\n" \
"[backup:db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=1000000000000000094\n" \
"db-version=\"9.4\"\n" \
"db-version=\"9.5\"\n" \
"\n" \
"[backup:option]\n" \
"option-archive-check=true\n" \
@ -1632,11 +1632,11 @@ testRun(void)
"backup-type=\"full\"\n"
"\n"
"[backup:db]\n"
"db-catalog-version=201409291\n"
"db-catalog-version=201510051\n"
"db-control-version=942\n"
"db-id=2\n"
"db-system-id=2000000000000000094\n"
"db-version=\"9.4\"\n"
"db-version=\"9.5\"\n"
"\n"
"[backup:option]\n"
"option-archive-check=false\n"
@ -1980,11 +1980,11 @@ testRun(void)
"ignore-key=\"ignore-value\"\n" \
"\n" \
"[backup:db]\n" \
"db-catalog-version=201409291\n" \
"db-catalog-version=201510051\n" \
"db-control-version=942\n" \
"db-id=1\n" \
"db-system-id=1000000000000000094\n" \
"db-version=\"9.4\"\n" \
"db-version=\"9.5\"\n" \
"ignore-key=\"ignore-value\"\n" \
"\n" \
"[backup:option]\n" \

View File

@ -18,15 +18,14 @@ Test definition
static HrnHostTestDefine testMatrix[] =
{
// {uncrustify_off - struct alignment}
{.pg = "9.4", .repo = "pg2", .tls = 0, .stg = "azure", .enc = 1, .cmp = "lz4", .rt = 1, .bnd = 1, .bi = 0},
{.pg = "9.5", .repo = "repo", .tls = 1, .stg = "s3", .enc = 0, .cmp = "bz2", .rt = 1, .bnd = 1, .bi = 1},
{.pg = "9.6", .repo = "repo", .tls = 0, .stg = "posix", .enc = 0, .cmp = "none", .rt = 2, .bnd = 1, .bi = 1},
{.pg = "9.6", .repo = "repo", .tls = 0, .stg = "azure", .enc = 0, .cmp = "none", .rt = 2, .bnd = 1, .bi = 1},
{.pg = "10", .repo = "pg2", .tls = 0, .stg = "sftp", .enc = 1, .cmp = "gz", .rt = 1, .bnd = 1, .bi = 0},
{.pg = "11", .repo = "repo", .tls = 1, .stg = "gcs", .enc = 0, .cmp = "zst", .rt = 2, .bnd = 0, .bi = 0},
{.pg = "12", .repo = "repo", .tls = 0, .stg = "s3", .enc = 1, .cmp = "lz4", .rt = 1, .bnd = 1, .bi = 1},
{.pg = "13", .repo = "pg2", .tls = 1, .stg = "posix", .enc = 0, .cmp = "none", .rt = 1, .bnd = 0, .bi = 0},
{.pg = "14", .repo = "repo", .tls = 0, .stg = "gcs", .enc = 0, .cmp = "lz4", .rt = 1, .bnd = 1, .bi = 0},
{.pg = "15", .repo = "pg2", .tls = 0, .stg = "azure", .enc = 0, .cmp = "none", .rt = 2, .bnd = 1, .bi = 1},
{.pg = "15", .repo = "pg2", .tls = 0, .stg = "azure", .enc = 1, .cmp = "none", .rt = 2, .bnd = 1, .bi = 1},
{.pg = "16", .repo = "repo", .tls = 0, .stg = "sftp", .enc = 0, .cmp = "zst", .rt = 1, .bnd = 1, .bi = 1},
{.pg = "17", .repo = "repo", .tls = 0, .stg = "posix", .enc = 0, .cmp = "none", .rt = 1, .bnd = 0, .bi = 0},
// {uncrustify_on}

View File

@ -24,7 +24,7 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("pgVersionFromStr() and pgVersionToStr()"))
{
TEST_ERROR(pgVersionFromStr(STRDEF("9.4.4")), AssertError, "version 9.4.4 format is invalid");
TEST_ERROR(pgVersionFromStr(STRDEF("9.6.4")), AssertError, "version 9.6.4 format is invalid");
TEST_ERROR(pgVersionFromStr(STRDEF("abc")), AssertError, "version abc format is invalid");
TEST_ERROR(pgVersionFromStr(NULL), AssertError, "assertion 'version != NULL' failed");
@ -34,7 +34,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_STR_Z(pgVersionToStr(PG_VERSION_11), "11", "infoPgVersionToString 11");
TEST_RESULT_STR_Z(pgVersionToStr(PG_VERSION_96), "9.6", "infoPgVersionToString 9.6");
TEST_RESULT_STR_Z(pgVersionToStr(94456), "9.44", "infoPgVersionToString 94456");
TEST_RESULT_STR_Z(pgVersionToStr(96456), "9.64", "infoPgVersionToString 96456");
}
// *****************************************************************************************************************************
@ -59,7 +59,7 @@ testRun(void)
pgControlVersion(70300), VersionNotSupportedError,
"invalid PostgreSQL version 70300\n"
"HINT: is this version of PostgreSQL supported?");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_94), 942, "9.4 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_95), 942, "9.5 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_11), 1100, "11 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_17), 1700, "17 control version");
}
@ -163,13 +163,13 @@ testRun(void)
TEST_TITLE("check all valid page sizes");
HRN_PG_CONTROL_PUT(
storageTest, PG_VERSION_94, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_94),
storageTest, PG_VERSION_95, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_95),
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88, .pageSize = pgPageSize8);
TEST_ASSIGN(info, pgControlFromFile(storageTest, NULL), "get control info");
TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_94, " check version");
TEST_RESULT_UINT(info.catalogVersion, 201409291, " check catalog version");
TEST_RESULT_UINT(info.version, PG_VERSION_95, " check version");
TEST_RESULT_UINT(info.catalogVersion, 201510051, " check catalog version");
TEST_RESULT_UINT(info.checkpoint, 0xAABBAABBEEFFEEFF, "check checkpoint");
TEST_RESULT_UINT(info.timeline, 88, "check timeline");
TEST_RESULT_UINT(info.pageSize, pgPageSize8, "check page size");
@ -291,15 +291,15 @@ testRun(void)
// Start with an invalid crc but write a valid one at a greater offset to test the forced scan
control = hrnPgControlToBuffer(
0, 0xFADEFADE, (PgControl){.version = PG_VERSION_94, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
crcOffset = pgInterfaceVersion(PG_VERSION_94)->controlCrcOffset() + sizeof(uint32_t) * 2;
*((uint32_t *)(bufPtr(control) + crcOffset)) = crc32One(bufPtrConst(control), crcOffset);
0, 0xFADEFADE, (PgControl){.version = PG_VERSION_95, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
crcOffset = pgInterfaceVersion(PG_VERSION_95)->controlCrcOffset() + sizeof(uint32_t) * 2;
*((uint32_t *)(bufPtr(control) + crcOffset)) = crc32cOne(bufPtrConst(control), crcOffset);
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_94_Z));
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
TEST_RESULT_UINT(info.checkpoint, 777, "check checkpoint");
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_94_Z)), "invalidate checkpoint");
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_94_Z));
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_95_Z)), "invalidate checkpoint");
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
TEST_RESULT_UINT(info.checkpoint, 0xDEAD, "check invalid checkpoint");
}
@ -345,7 +345,7 @@ testRun(void)
TEST_RESULT_STR_Z(pgLsnName(PG_VERSION_96), "location", "check location name");
TEST_RESULT_STR_Z(pgLsnName(PG_VERSION_10), "lsn", "check lsn name");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_94, 201409291), "PG_9.4_201409291", "check 9.4 tablespace id");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_95, 201510051), "PG_9.5_201510051", "check 9.5 tablespace id");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_16, 999999999), "PG_16_999999999", "check 16 tablespace id");
TEST_RESULT_STR_Z(pgWalName(PG_VERSION_96), "xlog", "check xlog name");
@ -482,12 +482,12 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
memset(bufPtr(result), 0, bufSize(result));
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_94, .systemId = 0xEAEAEAEA, .size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT);
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_95, .systemId = 0xEAEAEAEA, .size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT);
storagePutP(storageNewWriteP(storageTest, walFile), result);
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, NULL), "get wal info v9.4");
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, NULL), "get wal info v9.5");
TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_94, " check version");
TEST_RESULT_UINT(info.version, PG_VERSION_95, " check version");
TEST_RESULT_UINT(info.size, HRN_PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");
// -------------------------------------------------------------------------------------------------------------------------

View File

@ -1500,14 +1500,14 @@ testRun(void)
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/simple")), TEST_PATH "/archive/db/simple",
"check simple path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/700000007000000070000000")),
TEST_PATH "/archive/db/9.4-1/7000000070000000/700000007000000070000000", "check segment path");
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/700000007000000070000000")),
TEST_PATH "/archive/db/17-1/7000000070000000/700000007000000070000000", "check segment path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/00000008.history")),
TEST_PATH "/archive/db/9.4-1/00000008.history", "check history path");
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/00000008.history")),
TEST_PATH "/archive/db/17-1/00000008.history", "check history path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/000000010000014C0000001A.00000028.backup")),
TEST_PATH "/archive/db/9.4-1/000000010000014C/000000010000014C0000001A.00000028.backup",
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/000000010000014C0000001A.00000028.backup")),
TEST_PATH "/archive/db/17-1/000000010000014C/000000010000014C0000001A.00000028.backup",
"check archive backup path");
TEST_RESULT_STR_Z(storagePathP(storage, STORAGE_REPO_BACKUP_STR), TEST_PATH "/backup/db", "check backup path");

View File

@ -7253,14 +7253,14 @@ testRun(void)
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/simple")), TEST_PATH "/archive/db/simple",
"check simple path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/700000007000000070000000")),
TEST_PATH "/archive/db/9.4-1/7000000070000000/700000007000000070000000", "check segment path");
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/700000007000000070000000")),
TEST_PATH "/archive/db/17-1/7000000070000000/700000007000000070000000", "check segment path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/00000008.history")),
TEST_PATH "/archive/db/9.4-1/00000008.history", "check history path");
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/00000008.history")),
TEST_PATH "/archive/db/17-1/00000008.history", "check history path");
TEST_RESULT_STR_Z(
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/9.4-1/000000010000014C0000001A.00000028.backup")),
TEST_PATH "/archive/db/9.4-1/000000010000014C/000000010000014C0000001A.00000028.backup",
storagePathP(storage, STRDEF(STORAGE_REPO_ARCHIVE "/17-1/000000010000014C0000001A.00000028.backup")),
TEST_PATH "/archive/db/17-1/000000010000014C/000000010000014C0000001A.00000028.backup",
"check archive backup path");
TEST_RESULT_STR_Z(storagePathP(storage, STORAGE_REPO_BACKUP_STR), TEST_PATH "/backup/db", "check backup path");