You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-06-20 01:17:49 +02:00
Remove support for PostgreSQL 9.5.
Per our policy to support five EOL versions of PostgreSQL, 9.5 is no longer supported by pgBackRest. Remove all logic associated with 9.5 and update the tests. An effort was made to advance versions as much as possible in the tests while still providing coverage. Hopefully this will reduce churn when future versions expire, though it has created a bit more here. Tests for 9.4/9.5 are left in the expire/info tests to demonstrate that these commands work with old versions present.
This commit is contained in:
+2
-2
@@ -505,8 +505,8 @@ A PostgreSQL libpq shim is provided to simulate interactions with PostgreSQL. Be
|
||||
```
|
||||
// Set up two standbys but no primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
|
||||
// Close the "inner" session first (8) then the outer (1)
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
|
||||
@@ -572,8 +572,8 @@ HRN_FORK_END();
|
||||
<code-block>
|
||||
// Set up two standbys but no primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
|
||||
// Close the "inner" session first (8) then the outer (1)
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
|
||||
@@ -1,2 +1,16 @@
|
||||
<release date="XXXX-XX-XX" version="2.58.0dev" title="Under Development">
|
||||
<release-core-list>
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<github-pull-request id="2692"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-reviewer id="douglas.j.hunley"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Remove support for <proper>PostgreSQL</proper> <id>9.5</id>.</p>
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
</release-core-list>
|
||||
</release>
|
||||
|
||||
@@ -1361,6 +1361,7 @@ option:
|
||||
section: global
|
||||
type: boolean
|
||||
default: false
|
||||
internal: true
|
||||
command:
|
||||
backup: {}
|
||||
command-role:
|
||||
|
||||
@@ -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.5
|
||||
- 9.6
|
||||
- 10
|
||||
- 11
|
||||
|
||||
@@ -1090,13 +1090,11 @@ backupStart(const BackupData *const backupData)
|
||||
|
||||
// Start backup
|
||||
LOG_INFO_FMT(
|
||||
"execute %sexclusive backup start: backup begins after the %s checkpoint completes",
|
||||
backupData->version >= PG_VERSION_96 ? "non-" : "",
|
||||
"execute backup start: backup begins after the %s checkpoint completes",
|
||||
cfgOptionBool(cfgOptStartFast) ? "requested immediate" : "next regular");
|
||||
|
||||
const DbBackupStartResult dbBackupStartResult = dbBackupStart(
|
||||
backupData->dbPrimary, cfgOptionBool(cfgOptStartFast), cfgOptionBool(cfgOptStopAuto),
|
||||
cfgOptionBool(cfgOptArchiveCheck));
|
||||
backupData->dbPrimary, cfgOptionBool(cfgOptStartFast), cfgOptionBool(cfgOptArchiveCheck));
|
||||
|
||||
MEM_CONTEXT_PRIOR_BEGIN()
|
||||
{
|
||||
@@ -1263,8 +1261,7 @@ backupStop(BackupData *const backupData, Manifest *const manifest)
|
||||
{
|
||||
// Stop the backup
|
||||
LOG_INFO_FMT(
|
||||
"execute %sexclusive backup stop and wait for all WAL segments to archive",
|
||||
backupData->version >= PG_VERSION_96 ? "non-" : "");
|
||||
"execute backup stop and wait for all WAL segments to archive");
|
||||
|
||||
const DbBackupStopResult dbBackupStopResult = dbBackupStop(backupData->dbPrimary);
|
||||
|
||||
|
||||
@@ -371,6 +371,15 @@ cfgLoadUpdateOption(void)
|
||||
if (cfgOptionTest(cfgOptRepoTargetTime) && cfgOptionSource(cfgOptRepo) == cfgSourceDefault)
|
||||
THROW_FMT(OptionInvalidError, "option '" CFGOPT_REPO_TARGET_TIME "' not valid without option '" CFGOPT_REPO "'");
|
||||
|
||||
// The stop-auto option is deprecated
|
||||
if (cfgOptionValid(cfgOptStopAuto) && cfgOptionSource(cfgOptStopAuto) != cfgSourceDefault)
|
||||
{
|
||||
LOG_WARN(
|
||||
"option '" CFGOPT_STOP_AUTO "' is deprecated\n"
|
||||
"HINT: all supported versions use non-exclusive backup.\n"
|
||||
"HINT: stop using this option to avoid an error when it is removed.");
|
||||
}
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
||||
+42
-97
@@ -306,8 +306,7 @@ dbOpen(Db *const this)
|
||||
|
||||
// There is no need to have parallelism enabled in a backup session. In particular, 9.6 marks pg_stop_backup() as
|
||||
// parallel-safe but an error will be thrown if pg_stop_backup() is run in a worker.
|
||||
if (dbPgVersion(this) >= PG_VERSION_PARALLEL_QUERY)
|
||||
dbExec(this, STRDEF("set max_parallel_workers_per_gather = 0"));
|
||||
dbExec(this, STRDEF("set max_parallel_workers_per_gather = 0"));
|
||||
|
||||
// Is the cluster a standby?
|
||||
this->pub.standby = dbIsInRecovery(this);
|
||||
@@ -348,7 +347,7 @@ dbBackupStartQuery(const unsigned int pgVersion, const bool startFast)
|
||||
strCatZ(result, ", " FALSE_Z);
|
||||
|
||||
// Use non-exclusive backup mode when available
|
||||
if (pgVersion >= PG_VERSION_96 && pgVersion <= PG_VERSION_14)
|
||||
if (pgVersion <= PG_VERSION_14)
|
||||
strCatZ(result, ", " FALSE_Z);
|
||||
|
||||
// Complete query
|
||||
@@ -358,12 +357,11 @@ dbBackupStartQuery(const unsigned int pgVersion, const bool startFast)
|
||||
}
|
||||
|
||||
FN_EXTERN DbBackupStartResult
|
||||
dbBackupStart(Db *const this, const bool startFast, const bool stopAuto, const bool archiveCheck)
|
||||
dbBackupStart(Db *const this, const bool startFast, const bool archiveCheck)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(DB, this);
|
||||
FUNCTION_LOG_PARAM(BOOL, startFast);
|
||||
FUNCTION_LOG_PARAM(BOOL, stopAuto);
|
||||
FUNCTION_LOG_PARAM(BOOL, archiveCheck);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
@@ -375,35 +373,6 @@ dbBackupStart(Db *const this, const bool startFast, const bool stopAuto, const b
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Acquire the backup advisory lock to make sure that backups are not running from multiple backup servers against the same
|
||||
// database cluster when PostgreSQL <= 9.5. This lock helps make the stop-auto option safe. On PostgreSQL > 9.5 multiple
|
||||
// backups are allowed on the same cluster.
|
||||
if (dbPgVersion(this) <= PG_VERSION_95 &&
|
||||
!pckReadBoolP(dbQueryColumn(this, STRDEF("select pg_catalog.pg_try_advisory_lock(" PG_BACKUP_ADVISORY_LOCK ")::bool"))))
|
||||
{
|
||||
THROW(
|
||||
LockAcquireError,
|
||||
"unable to acquire " PROJECT_NAME " advisory lock\n"
|
||||
"HINT: is another " PROJECT_NAME " backup already running on this cluster?");
|
||||
}
|
||||
|
||||
// If stop-auto is enabled check for a running backup
|
||||
if (stopAuto)
|
||||
{
|
||||
// Feature is not needed for PostgreSQL >= 9.6 since backups are run in non-exclusive mode
|
||||
if (dbPgVersion(this) < PG_VERSION_96)
|
||||
{
|
||||
if (pckReadBoolP(dbQueryColumn(this, STRDEF("select pg_catalog.pg_is_in_backup()::bool"))))
|
||||
{
|
||||
LOG_WARN(
|
||||
"the cluster is already in backup mode but no " PROJECT_NAME " backup process is running."
|
||||
" pg_stop_backup() will be called so a new backup can be started.");
|
||||
|
||||
dbBackupStop(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When the start-fast option is disabled and db-timeout is smaller than checkpoint_timeout, the command may timeout
|
||||
// before the backup actually starts
|
||||
if (!startFast && dbDbTimeout(this) <= dbCheckpointTimeout(this))
|
||||
@@ -486,28 +455,14 @@ dbBackupStopQuery(const unsigned int pgVersion)
|
||||
String *const result = strCatFmt(
|
||||
strNew(),
|
||||
"select lsn::text as lsn,\n"
|
||||
" pg_catalog.pg_%sfile_name(lsn)::text as wal_segment_name",
|
||||
strZ(pgWalName(pgVersion)));
|
||||
|
||||
// For PostgreSQL >= 9.6 the backup label and tablespace map are returned
|
||||
if (pgVersion >= PG_VERSION_96)
|
||||
{
|
||||
strCatZ(
|
||||
result,
|
||||
",\n"
|
||||
" labelfile::text as backuplabel_file,\n"
|
||||
" spcmapfile::text as tablespacemap_file");
|
||||
}
|
||||
|
||||
// Build stop backup function
|
||||
strCatFmt(
|
||||
result,
|
||||
"\n"
|
||||
" pg_catalog.pg_%sfile_name(lsn)::text as wal_segment_name,\n"
|
||||
" labelfile::text as backuplabel_file,\n"
|
||||
" spcmapfile::text as tablespacemap_file\n"
|
||||
" from pg_catalog.pg_%s(",
|
||||
pgVersion >= PG_VERSION_15 ? "backup_stop" : "stop_backup");
|
||||
strZ(pgWalName(pgVersion)), pgVersion >= PG_VERSION_15 ? "backup_stop" : "stop_backup");
|
||||
|
||||
// Use non-exclusive backup mode when available
|
||||
if (pgVersion >= PG_VERSION_96 && pgVersion <= PG_VERSION_14)
|
||||
if (pgVersion <= PG_VERSION_14)
|
||||
strCatZ(result, FALSE_Z);
|
||||
|
||||
// Disable archive checking since we do this elsewhere
|
||||
@@ -522,9 +477,6 @@ dbBackupStopQuery(const unsigned int pgVersion)
|
||||
// Complete query
|
||||
strCatZ(result, ")");
|
||||
|
||||
if (pgVersion < PG_VERSION_96)
|
||||
strCatZ(result, " as lsn");
|
||||
|
||||
FUNCTION_TEST_RETURN(STRING, result);
|
||||
}
|
||||
|
||||
@@ -551,22 +503,18 @@ dbBackupStop(Db *const this)
|
||||
{
|
||||
result.lsn = pckReadStrP(read);
|
||||
result.walSegmentName = pckReadStrP(read);
|
||||
result.backupLabel = pckReadStrP(read);
|
||||
|
||||
if (dbPgVersion(this) >= PG_VERSION_96)
|
||||
{
|
||||
result.backupLabel = pckReadStrP(read);
|
||||
// Return the tablespace map if it is not empty
|
||||
String *const tablespaceMap = pckReadStrP(read);
|
||||
String *const tablespaceMapTrim = strTrim(strDup(tablespaceMap));
|
||||
|
||||
// Return the tablespace map if it is not empty
|
||||
String *const tablespaceMap = pckReadStrP(read);
|
||||
String *const tablespaceMapTrim = strTrim(strDup(tablespaceMap));
|
||||
if (!strEmpty(tablespaceMapTrim))
|
||||
result.tablespaceMap = tablespaceMap;
|
||||
else
|
||||
strFree(tablespaceMap);
|
||||
|
||||
if (!strEmpty(tablespaceMapTrim))
|
||||
result.tablespaceMap = tablespaceMap;
|
||||
else
|
||||
strFree(tablespaceMap);
|
||||
|
||||
strFree(tablespaceMapTrim);
|
||||
}
|
||||
strFree(tablespaceMapTrim);
|
||||
}
|
||||
MEM_CONTEXT_PRIOR_END();
|
||||
}
|
||||
@@ -690,38 +638,35 @@ dbReplayWait(Db *const this, const String *const targetLsn, const uint32_t targe
|
||||
// Perform a checkpoint
|
||||
dbExec(this, STRDEF("checkpoint"));
|
||||
|
||||
// On PostgreSQL >= 9.6 the checkpoint location can be verified so loop until lsn has been reached or timeout
|
||||
if (dbPgVersion(this) >= PG_VERSION_96)
|
||||
// Loop until the checkpoint has reached the target lsn (or timeout)
|
||||
wait = waitNew(timeout);
|
||||
targetReached = false;
|
||||
const String *checkpointLsn = NULL;
|
||||
|
||||
do
|
||||
{
|
||||
Wait *const wait = waitNew(timeout);
|
||||
targetReached = false;
|
||||
const String *checkpointLsn = NULL;
|
||||
// Build the query
|
||||
const String *const query = strNewFmt(
|
||||
"select (checkpoint_%s >= '%s')::bool as targetReached,\n"
|
||||
" checkpoint_%s::text as checkpointLsn\n"
|
||||
" from pg_catalog.pg_control_checkpoint()",
|
||||
lsnName, strZ(targetLsn), lsnName);
|
||||
|
||||
do
|
||||
{
|
||||
// Build the query
|
||||
const String *const query = strNewFmt(
|
||||
"select (checkpoint_%s >= '%s')::bool as targetReached,\n"
|
||||
" checkpoint_%s::text as checkpointLsn\n"
|
||||
" from pg_catalog.pg_control_checkpoint()",
|
||||
lsnName, strZ(targetLsn), lsnName);
|
||||
// Execute the query and get checkpointLsn
|
||||
PackRead *const read = dbQueryRow(this, query);
|
||||
targetReached = pckReadBoolP(read);
|
||||
checkpointLsn = pckReadStrP(read);
|
||||
|
||||
// Execute the query and get checkpointLsn
|
||||
PackRead *const read = dbQueryRow(this, query);
|
||||
targetReached = pckReadBoolP(read);
|
||||
checkpointLsn = pckReadStrP(read);
|
||||
protocolKeepAlive();
|
||||
}
|
||||
while (!targetReached && waitMore(wait));
|
||||
|
||||
protocolKeepAlive();
|
||||
}
|
||||
while (!targetReached && waitMore(wait));
|
||||
|
||||
// Error if a timeout occurred before the target lsn was reached
|
||||
if (!targetReached)
|
||||
{
|
||||
THROW_FMT(
|
||||
ArchiveTimeoutError, "timeout before standby checkpoint lsn reached %s - only reached %s", strZ(targetLsn),
|
||||
strZ(checkpointLsn));
|
||||
}
|
||||
// Error if a timeout occurred before the target lsn was reached
|
||||
if (!targetReached)
|
||||
{
|
||||
THROW_FMT(
|
||||
ArchiveTimeoutError, "timeout before standby checkpoint lsn reached %s - only reached %s", strZ(targetLsn),
|
||||
strZ(checkpointLsn));
|
||||
}
|
||||
|
||||
// Reload pg_control in case timeline was updated by the checkpoint
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ typedef struct DbBackupStartResult
|
||||
String *walSegmentCheck; // Segment used to check archiving, may be NULL
|
||||
} DbBackupStartResult;
|
||||
|
||||
FN_EXTERN DbBackupStartResult dbBackupStart(Db *this, bool startFast, bool stopAuto, bool archiveCheck);
|
||||
FN_EXTERN DbBackupStartResult dbBackupStart(Db *this, bool startFast, bool archiveCheck);
|
||||
|
||||
// Stop backup and return starting lsn, wal segment name, backup label, and tablespace map
|
||||
typedef struct DbBackupStopResult
|
||||
|
||||
+2
-4
@@ -1038,10 +1038,8 @@ manifestBuildInfo(
|
||||
pgVersion < PG_VERSION_12) ||
|
||||
// Skip temp file for safely writing postgresql.auto.conf
|
||||
(strEqZ(info->name, PG_FILE_POSTGRESQLAUTOCONFTMP)) ||
|
||||
// Skip backup_label in versions where non-exclusive backup is supported
|
||||
(strEqZ(info->name, PG_FILE_BACKUPLABEL) && pgVersion >= PG_VERSION_96) ||
|
||||
// Skip old backup labels
|
||||
strEqZ(info->name, PG_FILE_BACKUPLABELOLD) ||
|
||||
// Skip obsolete backup_label/backup_label.old
|
||||
strEqZ(info->name, PG_FILE_BACKUPLABEL) || strEqZ(info->name, PG_FILE_BACKUPLABELOLD) ||
|
||||
// Skip backup_manifest/tmp in versions where it is created
|
||||
((strEqZ(info->name, PG_FILE_BACKUPMANIFEST) || strEqZ(info->name, PG_FILE_BACKUPMANIFEST_TMP)) &&
|
||||
pgVersion >= PG_VERSION_13) ||
|
||||
|
||||
@@ -19,7 +19,7 @@ runtime cost and makes the rules a bit easier to follow.
|
||||
If a comment has syntax only changes, then the new version of the comment can be applied to older versions of the type.
|
||||
|
||||
If a comment has changed in a way that implies a difference in the way the type is used, then a new version of the comment and type
|
||||
should be created. See the CheckPoint type difference between 9.5 and 9.6 as an example.
|
||||
should be created.
|
||||
|
||||
Unversioned types that are only used by versioned types are also included in this file.
|
||||
***********************************************************************************************************************************/
|
||||
@@ -242,19 +242,6 @@ Types from src/include/catalog/catversion.h
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201608131
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_95
|
||||
|
||||
/*
|
||||
* 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 201510051
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@@ -322,11 +309,6 @@ 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_95
|
||||
|
||||
/* Version identifier for this pg_control format */
|
||||
#define PG_CONTROL_VERSION 942
|
||||
|
||||
#endif
|
||||
|
||||
// MOCK_AUTH_NONCE_LEN define
|
||||
@@ -498,45 +480,6 @@ typedef struct CheckPoint
|
||||
TransactionId oldestActiveXid;
|
||||
} CheckPoint;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_95
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
TransactionId oldestCommitTsXid; /* oldest Xid with valid commit
|
||||
* timestamp */
|
||||
TransactionId newestCommitTsXid; /* newest Xid with valid commit
|
||||
* timestamp */
|
||||
|
||||
/*
|
||||
* 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
|
||||
@@ -1535,146 +1478,6 @@ typedef struct ControlFileData
|
||||
pg_crc32c crc;
|
||||
} ControlFileData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_95
|
||||
|
||||
/*
|
||||
* Contents of pg_control.
|
||||
*
|
||||
* NOTE: try to keep this under 512 bytes so that it will fit on one physical
|
||||
* sector of typical disk drives. This reduces the odds of corruption due to
|
||||
* power failure midway through a write.
|
||||
*/
|
||||
typedef struct ControlFileData
|
||||
{
|
||||
/*
|
||||
* Unique system identifier --- to ensure we match up xlog files with the
|
||||
* installation that produced them.
|
||||
*/
|
||||
uint64 system_identifier;
|
||||
|
||||
/*
|
||||
* Version identifier information. Keep these fields at the same offset,
|
||||
* especially pg_control_version; they won't be real useful if they move
|
||||
* around. (For historical reasons they must be 8 bytes into the file
|
||||
* rather than immediately at the front.)
|
||||
*
|
||||
* pg_control_version identifies the format of pg_control itself.
|
||||
* catalog_version_no identifies the format of the system catalogs.
|
||||
*
|
||||
* There are additional version identifiers in individual files; for
|
||||
* example, WAL logs contain per-page magic numbers that can serve as
|
||||
* version cues for the WAL log.
|
||||
*/
|
||||
uint32 pg_control_version; /* PG_CONTROL_VERSION */
|
||||
uint32 catalog_version_no; /* see catversion.h */
|
||||
|
||||
/*
|
||||
* System status data
|
||||
*/
|
||||
DBState state; /* see enum above */
|
||||
pg_time_t time; /* time stamp of last pg_control update */
|
||||
XLogRecPtr checkPoint; /* last check point record ptr */
|
||||
XLogRecPtr prevCheckPoint; /* previous check point record ptr */
|
||||
|
||||
CheckPoint checkPointCopy; /* copy of last check point record */
|
||||
|
||||
XLogRecPtr unloggedLSN; /* current fake LSN value, for unlogged rels */
|
||||
|
||||
/*
|
||||
* These two values determine the minimum point we must recover up to
|
||||
* before starting up:
|
||||
*
|
||||
* minRecoveryPoint is updated to the latest replayed LSN whenever we
|
||||
* flush a data change during archive recovery. That guards against
|
||||
* starting archive recovery, aborting it, and restarting with an earlier
|
||||
* stop location. If we've already flushed data changes from WAL record X
|
||||
* to disk, we mustn't start up until we reach X again. Zero when not
|
||||
* doing archive recovery.
|
||||
*
|
||||
* backupStartPoint is the redo pointer of the backup start checkpoint, if
|
||||
* we are recovering from an online backup and haven't reached the end of
|
||||
* backup yet. It is reset to zero when the end of backup is reached, and
|
||||
* we mustn't start up before that. A boolean would suffice otherwise, but
|
||||
* we use the redo pointer as a cross-check when we see an end-of-backup
|
||||
* record, to make sure the end-of-backup record corresponds the base
|
||||
* backup we're recovering from.
|
||||
*
|
||||
* backupEndPoint is the backup end location, if we are recovering from an
|
||||
* online backup which was taken from the standby and haven't reached the
|
||||
* end of backup yet. It is initialized to the minimum recovery point in
|
||||
* pg_control which was backed up last. It is reset to zero when the end
|
||||
* of backup is reached, and we mustn't start up before that.
|
||||
*
|
||||
* If backupEndRequired is true, we know for sure that we're restoring
|
||||
* from a backup, and must see a backup-end record before we can safely
|
||||
* start up. If it's false, but backupStartPoint is set, a backup_label
|
||||
* file was found at startup but it may have been a leftover from a stray
|
||||
* pg_start_backup() call, not accompanied by pg_stop_backup().
|
||||
*/
|
||||
XLogRecPtr minRecoveryPoint;
|
||||
TimeLineID minRecoveryPointTLI;
|
||||
XLogRecPtr backupStartPoint;
|
||||
XLogRecPtr backupEndPoint;
|
||||
bool backupEndRequired;
|
||||
|
||||
/*
|
||||
* Parameter settings that determine if the WAL can be used for archival
|
||||
* or hot standby.
|
||||
*/
|
||||
int wal_level;
|
||||
bool wal_log_hints;
|
||||
int MaxConnections;
|
||||
int max_worker_processes;
|
||||
int max_prepared_xacts;
|
||||
int max_locks_per_xact;
|
||||
bool track_commit_timestamp;
|
||||
|
||||
/*
|
||||
* This data is used to check for hardware-architecture compatibility of
|
||||
* the database and the backend executable. We need not check endianness
|
||||
* explicitly, since the pg_control version will surely look wrong to a
|
||||
* machine of different endianness, but we do need to worry about MAXALIGN
|
||||
* and floating-point format. (Note: storage layout nominally also
|
||||
* depends on SHORTALIGN and INTALIGN, but in practice these are the same
|
||||
* on all architectures of interest.)
|
||||
*
|
||||
* Testing just one double value is not a very bulletproof test for
|
||||
* floating-point compatibility, but it will catch most cases.
|
||||
*/
|
||||
uint32 maxAlign; /* alignment requirement for tuples */
|
||||
double floatFormat; /* constant 1234567.0 */
|
||||
#define FLOATFORMAT_VALUE 1234567.0
|
||||
|
||||
/*
|
||||
* This data is used to make sure that configuration of this database is
|
||||
* compatible with the backend executable.
|
||||
*/
|
||||
uint32 blcksz; /* data block size for this DB */
|
||||
uint32 relseg_size; /* blocks per segment of large relation */
|
||||
|
||||
uint32 xlog_blcksz; /* block size within WAL files */
|
||||
uint32 xlog_seg_size; /* size of each WAL segment */
|
||||
|
||||
uint32 nameDataLen; /* catalog name field width */
|
||||
uint32 indexMaxKeys; /* max number of columns in an index */
|
||||
|
||||
uint32 toast_max_chunk_size; /* chunk size in TOAST tables */
|
||||
uint32 loblksize; /* chunk size in pg_largeobject */
|
||||
|
||||
/* flag indicating internal format of timestamp, interval, time */
|
||||
bool enableIntTimes; /* int64 storage enabled? */
|
||||
|
||||
/* flags indicating pass-by-value status of various types */
|
||||
bool float4ByVal; /* float4 pass-by-value? */
|
||||
bool float8ByVal; /* float8, int8, etc pass-by-value? */
|
||||
|
||||
/* Are data pages protected by checksums? Zero if no checksum version */
|
||||
uint32 data_checksum_version;
|
||||
|
||||
/* CRC of all above ... MUST BE LAST! */
|
||||
pg_crc32c crc;
|
||||
} ControlFileData;
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@@ -1725,10 +1528,6 @@ Types from src/include/access/xlog_internal.h
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD093 /* can be used as WAL version indicator */
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_95
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD087 /* can be used as WAL version indicator */
|
||||
|
||||
#endif
|
||||
|
||||
// XLogPageHeaderData type
|
||||
@@ -1756,7 +1555,7 @@ typedef struct XLogPageHeaderData
|
||||
uint32 xlp_rem_len; /* total len of remaining data for record */
|
||||
} XLogPageHeaderData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_95
|
||||
#elif PG_VERSION >= PG_VERSION_96
|
||||
|
||||
/*
|
||||
* Each page of XLOG file has a header like this:
|
||||
|
||||
@@ -9,7 +9,6 @@ Automatically generated by 'build-code postgres-version' -- do not modify direct
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL version constants
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_VERSION_95 90500
|
||||
#define PG_VERSION_96 90600
|
||||
#define PG_VERSION_10 100000
|
||||
#define PG_VERSION_11 110000
|
||||
@@ -26,7 +25,6 @@ PostgreSQL version constants
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL version string constants for use in error messages
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_VERSION_95_Z "9.5"
|
||||
#define PG_VERSION_96_Z "9.6"
|
||||
#define PG_VERSION_10_Z "10"
|
||||
#define PG_VERSION_11_Z "11"
|
||||
|
||||
@@ -14,9 +14,6 @@ PostgreSQL name
|
||||
/***********************************************************************************************************************************
|
||||
Version where various PostgreSQL capabilities were introduced
|
||||
***********************************************************************************************************************************/
|
||||
// parallel query supported
|
||||
#define PG_VERSION_PARALLEL_QUERY PG_VERSION_96
|
||||
|
||||
// xlog was renamed to wal
|
||||
#define PG_VERSION_WAL_RENAME PG_VERSION_10
|
||||
|
||||
|
||||
+6
-6
@@ -12,20 +12,20 @@
|
||||
# - docker login -u pgbackrest
|
||||
# - DATE=YYYYMMDDX;VM=X;ARCH=X;BASE=pgbackrest/test:${VM?}-base-${ARCH?};docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
|
||||
# **********************************************************************************************************************************
|
||||
20251004A:
|
||||
20251106A:
|
||||
aarch64:
|
||||
u22: 1e0f3dbc1772764b31ffdac85a1d1c24abe97cb3
|
||||
u22: 8ee008aecbcf21b205116969db4000838c989a4a
|
||||
|
||||
x86_64:
|
||||
u22: 8ee008aecbcf21b205116969db4000838c989a4a
|
||||
|
||||
20251004A:
|
||||
ppc64le:
|
||||
u22: ff068e44059b064f963bf450831d7733611b8fab
|
||||
|
||||
s390x:
|
||||
u22: ff068e44059b064f963bf450831d7733611b8fab
|
||||
|
||||
20250926A:
|
||||
x86_64:
|
||||
u22: 1e0f3dbc1772764b31ffdac85a1d1c24abe97cb3
|
||||
|
||||
20250822A:
|
||||
x86_64:
|
||||
a321: dab99d91eed1710c68dae28efa5cd0e27e0a7f60
|
||||
|
||||
@@ -15,8 +15,6 @@ use pgBackRestDoc::Common::Log;
|
||||
####################################################################################################################################
|
||||
# PostgreSQL version numbers
|
||||
####################################################################################################################################
|
||||
use constant PG_VERSION_95 => '9.5';
|
||||
push @EXPORT, qw(PG_VERSION_95);
|
||||
use constant PG_VERSION_96 => '9.6';
|
||||
push @EXPORT, qw(PG_VERSION_96);
|
||||
use constant PG_VERSION_10 => '10';
|
||||
@@ -48,8 +46,8 @@ sub versionSupport
|
||||
# Assign function parameters, defaults, and log debug info
|
||||
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
|
||||
|
||||
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, PG_VERSION_18);
|
||||
my @strySupportVersion = (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, PG_VERSION_18);
|
||||
|
||||
# Return from function and log return values if any
|
||||
return logDebugReturn
|
||||
|
||||
@@ -168,7 +168,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_95);
|
||||
my $strDbVersion = (defined($self->{oTest}->{&TEST_DB}) ? $self->{oTest}->{&TEST_DB} : PG_VERSION_96);
|
||||
$strDbVersion =~ s/\.//;
|
||||
|
||||
&log($self->{bDryRun} && !$self->{bVmOut} || $self->{bShowOutputAsync} ? INFO : DETAIL, "${strTest}" .
|
||||
|
||||
@@ -228,7 +228,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
@@ -243,7 +242,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_95,
|
||||
PG_VERSION_96,
|
||||
PG_VERSION_10,
|
||||
PG_VERSION_11,
|
||||
|
||||
@@ -250,10 +250,7 @@ hrnBackupPqScript(const unsigned int pgVersion, const time_t backupTimeStart, Hr
|
||||
// Generate pq script
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
// Connect to primary
|
||||
if (pgVersion <= PG_VERSION_95)
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", pgVersion, pg1Path, false, NULL, NULL));
|
||||
else
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", pgVersion, pg1Path, false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", pgVersion, pg1Path, false, NULL, NULL));
|
||||
|
||||
// Connect to standby
|
||||
if (param.backupStandby)
|
||||
@@ -261,37 +258,24 @@ hrnBackupPqScript(const unsigned int pgVersion, const time_t backupTimeStart, Hr
|
||||
// Save standby pg_control with updated info
|
||||
HRN_STORAGE_PUT(storagePgIdxWrite(1), PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL, hrnPgControlToBuffer(0, 0, pgControl));
|
||||
|
||||
if (pgVersion <= PG_VERSION_95)
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_OPEN_GE_93(2, "dbname='postgres' port=5433", pgVersion, pg2Path, true, NULL, NULL));
|
||||
if (param.backupStandbyError)
|
||||
{
|
||||
HRN_PQ_SCRIPT_ADD(
|
||||
{.session = 2, .function = HRN_PQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
|
||||
{.session = 2, .function = HRN_PQ_STATUS, .resultInt = CONNECTION_BAD},
|
||||
{.session = 2, .function = HRN_PQ_ERRORMESSAGE, .resultZ = "error"});
|
||||
|
||||
param.backupStandby = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (param.backupStandbyError)
|
||||
{
|
||||
HRN_PQ_SCRIPT_ADD(
|
||||
{.session = 2, .function = HRN_PQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
|
||||
{.session = 2, .function = HRN_PQ_STATUS, .resultInt = CONNECTION_BAD},
|
||||
{.session = 2, .function = HRN_PQ_ERRORMESSAGE, .resultZ = "error"});
|
||||
|
||||
param.backupStandby = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
HRN_PQ_SCRIPT_ADD(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(2, "dbname='postgres' port=5433", pgVersion, pg2Path, true, NULL, NULL));
|
||||
}
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_OPEN(2, "dbname='postgres' port=5433", pgVersion, pg2Path, true, NULL, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
// Get start time
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_TIME_QUERY(1, (int64_t)backupTimeStart * 1000));
|
||||
|
||||
// Get advisory lock and check if backup is in progress (only for exclusive backup)
|
||||
if (pgVersion <= PG_VERSION_95)
|
||||
{
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_ADVISORY_LOCK(1, true));
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_IS_IN_BACKUP(1, false));
|
||||
}
|
||||
|
||||
// Perform archive check
|
||||
if (!param.noArchiveCheck)
|
||||
{
|
||||
@@ -304,9 +288,7 @@ hrnBackupPqScript(const unsigned int pgVersion, const time_t backupTimeStart, Hr
|
||||
}
|
||||
|
||||
// Start backup
|
||||
if (pgVersion <= PG_VERSION_95)
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_START_BACKUP_LE_95(1, param.startFast, lsnStartStr, walSegmentStart));
|
||||
else if (pgVersion <= PG_VERSION_96)
|
||||
if (pgVersion == PG_VERSION_96)
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_START_BACKUP_96(1, param.startFast, lsnStartStr, walSegmentStart));
|
||||
else
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_START_BACKUP_GE_10(1, param.startFast, lsnStartStr, walSegmentStart));
|
||||
@@ -358,9 +340,7 @@ hrnBackupPqScript(const unsigned int pgVersion, const time_t backupTimeStart, Hr
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_IS_STANDBY_QUERY(2, true));
|
||||
|
||||
// Stop backup
|
||||
if (pgVersion <= PG_VERSION_95)
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_STOP_BACKUP_LE_95(1, lsnStopStr, walSegmentStop));
|
||||
else if (pgVersion <= PG_VERSION_96)
|
||||
if (pgVersion == PG_VERSION_96)
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_STOP_BACKUP_96(1, lsnStopStr, walSegmentStop, tablespace));
|
||||
else
|
||||
HRN_PQ_SCRIPT_ADD(HRN_PQ_SCRIPT_STOP_BACKUP_GE_10(1, lsnStopStr, walSegmentStop, tablespace));
|
||||
|
||||
@@ -11,14 +11,6 @@ Harness for PostgreSQL Interface
|
||||
/***********************************************************************************************************************************
|
||||
Interface definition
|
||||
***********************************************************************************************************************************/
|
||||
uint32_t hrnPgInterfaceCatalogVersion094(void);
|
||||
void hrnPgInterfaceControl094(unsigned int controlVersion, unsigned int crc, PgControl pgControl, uint8_t *buffer);
|
||||
void hrnPgInterfaceWal094(unsigned int magic, PgWal pgWal, uint8_t *buffer);
|
||||
|
||||
uint32_t hrnPgInterfaceCatalogVersion095(void);
|
||||
void hrnPgInterfaceControl095(unsigned int controlVersion, unsigned int crc, PgControl pgControl, uint8_t *buffer);
|
||||
void hrnPgInterfaceWal095(unsigned int magic, PgWal pgWal, uint8_t *buffer);
|
||||
|
||||
uint32_t hrnPgInterfaceCatalogVersion096(void);
|
||||
void hrnPgInterfaceControl096(unsigned int controlVersion, unsigned int crc, PgControl pgControl, uint8_t *buffer);
|
||||
void hrnPgInterfaceWal096(unsigned int magic, PgWal pgWal, uint8_t *buffer);
|
||||
@@ -146,13 +138,6 @@ static const HrnPgInterface hrnPgInterface[] =
|
||||
.control = hrnPgInterfaceControl096,
|
||||
.wal = hrnPgInterfaceWal096,
|
||||
},
|
||||
{
|
||||
.version = PG_VERSION_95,
|
||||
|
||||
.catalogVersion = hrnPgInterfaceCatalogVersion095,
|
||||
.control = hrnPgInterfaceControl095,
|
||||
.wal = hrnPgInterfaceWal095,
|
||||
},
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
||||
@@ -22,8 +22,6 @@ Default wal segment size
|
||||
/***********************************************************************************************************************************
|
||||
System id constants by version
|
||||
***********************************************************************************************************************************/
|
||||
#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)
|
||||
#define HRN_PG_SYSTEMID_96_Z "10000000000000090600"
|
||||
#define HRN_PG_SYSTEMID_10 (10000000000000000000ULL + (uint64_t)PG_VERSION_10)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/***********************************************************************************************************************************
|
||||
Harness for PostgreSQL Interface (see PG_VERSION for version)
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#define PG_VERSION PG_VERSION_95
|
||||
|
||||
#include "common/harnessPostgres/harnessVersion.intern.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
HRN_PG_INTERFACE(095);
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@@ -51,7 +51,7 @@ Data type constants
|
||||
/***********************************************************************************************************************************
|
||||
Macros for defining groups of functions that implement various queries and commands
|
||||
***********************************************************************************************************************************/
|
||||
#define HRN_PQ_SCRIPT_OPEN(sessionParam, connectParam) \
|
||||
#define HRN_PQ_SCRIPT_CONNECT(sessionParam, connectParam) \
|
||||
{.session = sessionParam, .function = HRN_PQ_CONNECTDB, .param = "[\"" connectParam "\"]"}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_STATUS, .resultInt = CONNECTION_OK}
|
||||
|
||||
@@ -213,58 +213,6 @@ Macros for defining groups of functions that implement various queries and comma
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_ADVISORY_LOCK(sessionParam, lockAcquiredParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, .param = "[\"select pg_catalog.pg_try_advisory_lock(12340078987004321)::bool\"]", \
|
||||
.resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CONSUMEINPUT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_ISBUSY}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_RESULTSTATUS, .resultInt = PGRES_TUPLES_OK}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NTUPLES, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NFIELDS, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[0]", .resultInt = HRN_PQ_TYPE_BOOL}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,0]", .resultZ = cvtBoolToConstZ(lockAcquiredParam)}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_IS_IN_BACKUP(sessionParam, inBackupParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, .param = "[\"select pg_catalog.pg_is_in_backup()::bool\"]", \
|
||||
.resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CONSUMEINPUT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_ISBUSY}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_RESULTSTATUS, .resultInt = PGRES_TUPLES_OK}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NTUPLES, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NFIELDS, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[0]", .resultInt = HRN_PQ_TYPE_BOOL}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,0]", .resultZ = cvtBoolToConstZ(inBackupParam)}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_START_BACKUP_LE_95(sessionParam, startFastParam, lsnParam, walSegmentNameParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, \
|
||||
.param = zNewFmt( \
|
||||
"[\"select lsn::text as lsn,\\n" \
|
||||
" pg_catalog.pg_xlogfile_name(lsn)::text as wal_segment_name\\n" \
|
||||
" from pg_catalog.pg_start_backup('pgBackRest backup started at ' || current_timestamp, %s) as lsn\"]", \
|
||||
cvtBoolToConstZ(startFastParam)), \
|
||||
.resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CONSUMEINPUT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_ISBUSY}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_RESULTSTATUS, .resultInt = PGRES_TUPLES_OK}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NTUPLES, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NFIELDS, .resultInt = 2}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[0]", .resultInt = HRN_PQ_TYPE_TEXT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[1]", .resultInt = HRN_PQ_TYPE_TEXT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,0]", .resultZ = lsnParam}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,1]", .resultZ = walSegmentNameParam}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_START_BACKUP_96(sessionParam, startFastParam, lsnParam, walSegmentNameParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, \
|
||||
@@ -331,27 +279,6 @@ Macros for defining groups of functions that implement various queries and comma
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_STOP_BACKUP_LE_95(sessionParam, lsnParam, walSegmentNameParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, \
|
||||
.param = \
|
||||
"[\"select lsn::text as lsn,\\n" \
|
||||
" pg_catalog.pg_xlogfile_name(lsn)::text as wal_segment_name\\n" \
|
||||
" from pg_catalog.pg_stop_backup() as lsn\"]", \
|
||||
.resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CONSUMEINPUT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_ISBUSY}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_RESULTSTATUS, .resultInt = PGRES_TUPLES_OK}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NTUPLES, .resultInt = 1}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_NFIELDS, .resultInt = 2}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[0]", .resultInt = HRN_PQ_TYPE_TEXT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_FTYPE, .param = "[1]", .resultInt = HRN_PQ_TYPE_TEXT}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,0]", .resultZ = lsnParam}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETVALUE, .param = "[0,1]", .resultZ = walSegmentNameParam}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_CLEAR}, \
|
||||
{.session = sessionParam, .function = HRN_PQ_GETRESULT, .resultNull = true}
|
||||
|
||||
#define HRN_PQ_SCRIPT_STOP_BACKUP_96(sessionParam, lsnParam, walSegmentNameParam, tablespaceMapParam) \
|
||||
{.session = sessionParam, \
|
||||
.function = HRN_PQ_SENDQUERY, \
|
||||
@@ -563,10 +490,6 @@ Macros for defining groups of functions that implement various queries and comma
|
||||
HRN_PQ_SCRIPT_CHECKPOINT_TARGET_REACHED( \
|
||||
sessionParam, "lsn", targetLsnParam, targetReachedParam, checkpointLsnParam, sleepParam)
|
||||
|
||||
#define HRN_PQ_SCRIPT_REPLAY_WAIT_LE_95(sessionParam, targetLsnParam) \
|
||||
HRN_PQ_SCRIPT_REPLAY_TARGET_REACHED_LE_96(sessionParam, targetLsnParam, true, "X/X"), \
|
||||
HRN_PQ_SCRIPT_CHECKPOINT(sessionParam)
|
||||
|
||||
#define HRN_PQ_SCRIPT_REPLAY_WAIT_96(sessionParam, targetLsnParam) \
|
||||
HRN_PQ_SCRIPT_REPLAY_TARGET_REACHED_LE_96(sessionParam, targetLsnParam, true, "X/X"), \
|
||||
HRN_PQ_SCRIPT_CHECKPOINT(sessionParam), \
|
||||
@@ -583,16 +506,8 @@ Macros for defining groups of functions that implement various queries and comma
|
||||
/***********************************************************************************************************************************
|
||||
Macros to simplify dbOpen() for specific database versions
|
||||
***********************************************************************************************************************************/
|
||||
#define HRN_PQ_SCRIPT_OPEN_GE_93(sessionParam, connectParam, pgVersion, pgPathParam, standbyParam, archiveMode, archiveCommand) \
|
||||
HRN_PQ_SCRIPT_OPEN(sessionParam, connectParam), \
|
||||
HRN_PQ_SCRIPT_SET_SEARCH_PATH(sessionParam), \
|
||||
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(sessionParam), \
|
||||
HRN_PQ_SCRIPT_VALIDATE_QUERY(sessionParam, pgVersion, pgPathParam, archiveMode, archiveCommand), \
|
||||
HRN_PQ_SCRIPT_SET_APPLICATION_NAME(sessionParam), \
|
||||
HRN_PQ_SCRIPT_IS_STANDBY_QUERY(sessionParam, standbyParam)
|
||||
|
||||
#define HRN_PQ_SCRIPT_OPEN_GE_96(sessionParam, connectParam, pgVersion, pgPathParam, standbyParam, archiveMode, archiveCommand) \
|
||||
HRN_PQ_SCRIPT_OPEN(sessionParam, connectParam), \
|
||||
#define HRN_PQ_SCRIPT_OPEN(sessionParam, connectParam, pgVersion, pgPathParam, standbyParam, archiveMode, archiveCommand) \
|
||||
HRN_PQ_SCRIPT_CONNECT(sessionParam, connectParam), \
|
||||
HRN_PQ_SCRIPT_SET_SEARCH_PATH(sessionParam), \
|
||||
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(sessionParam), \
|
||||
HRN_PQ_SCRIPT_VALIDATE_QUERY(sessionParam, pgVersion, pgPathParam, archiveMode, archiveCommand), \
|
||||
|
||||
@@ -51,11 +51,11 @@ testRun(void)
|
||||
HRN_INFO_PUT(
|
||||
storageRepoWrite(), STORAGE_REPO_BACKUP "/" INFO_BACKUP_FILE,
|
||||
"[db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=202506291\n"
|
||||
"db-control-version=1800\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=6626363367545678089\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[backup:current]\n"
|
||||
"20201116-200000F={\"backrest-format\":5,\"backrest-version\":\"2.30\","
|
||||
@@ -68,8 +68,8 @@ testRun(void)
|
||||
"\"option-online\":true}\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6626363367545678089"
|
||||
",\"db-version\":\"9.5\"}\n",
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":6626363367545678089"
|
||||
",\"db-version\":\"18\"}\n",
|
||||
.comment = "write backup info - stanza1, repo1");
|
||||
|
||||
// Add backup manifest
|
||||
@@ -84,11 +84,11 @@ testRun(void)
|
||||
"backup-type=\"full\"\n" \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=202506291\n" \
|
||||
"db-control-version=1800\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=6626363367545678089\n" \
|
||||
"db-version=\"9.5\"\n" \
|
||||
"db-version=\"18\"\n" \
|
||||
"\n" \
|
||||
"[backup:option]\n" \
|
||||
"option-archive-check=true\n" \
|
||||
|
||||
@@ -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_95), "0000000100000001000000FF",
|
||||
walSegmentNext(STRDEF("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_18), "0000000100000001000000FF",
|
||||
"get next");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check overflow by version");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
walSegmentNext(STRDEF("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_95), "000000990000000200000000",
|
||||
"get next overflow >= 9.5");
|
||||
walSegmentNext(STRDEF("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_10), "000000990000000200000000",
|
||||
"get next overflow <= 10");
|
||||
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_95, 1), "000000010000000100000000\n",
|
||||
walSegmentRange(STRDEF("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_10, 1), "000000010000000100000000\n",
|
||||
"get single");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check range by version");
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_95, 4),
|
||||
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_10, 4),
|
||||
"0000000100000001000000FD\n0000000100000001000000FE\n0000000100000001000000FF\n000000010000000200000000\n",
|
||||
"get range >= 9.5");
|
||||
"get range <= 10");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walSegmentRange(STRDEF("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8),
|
||||
"000000080000000A00000000\n000000080000000A00000001\n000000080000000A00000002\n000000080000000A00000003\n"
|
||||
|
||||
@@ -36,7 +36,7 @@ testRun(void)
|
||||
TEST_TITLE("path missing");
|
||||
|
||||
TEST_ERROR(
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_18),
|
||||
PathMissingError, "unable to list file info for missing path '" TEST_PATH "/spool/archive/test1/in'");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -45,7 +45,7 @@ testRun(void)
|
||||
HRN_STORAGE_PATH_CREATE(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN);
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_18),
|
||||
"000000010000000100000001\n000000010000000100000002\n", "queue size smaller than min");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -54,7 +54,7 @@ testRun(void)
|
||||
queueSize = (16 * 1024 * 1024) * 3;
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_18),
|
||||
"000000010000000100000001\n000000010000000100000002\n000000010000000100000003\n", "empty queue");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -116,13 +116,13 @@ testRun(void)
|
||||
"db-id=1\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"15\"}\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.5, system-id 5555555555555555555\n"
|
||||
" version 15, 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.5\"}\n");
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"15\"}\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.5, system-id 5555555555555555555\n"
|
||||
" version 15, 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.5\"}\n"
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"16\"}\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_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
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_95_Z ",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_18_Z ",\"db-version\":\"18\"}\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_95);
|
||||
HRN_PG_WAL_TO_BUFFER(walBuffer1, PG_VERSION_18);
|
||||
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.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
|
||||
storageTest, zNewFmt("repo/archive/test/18-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_95_Z ",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_18_Z ",\"db-version\":\"18\"}\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.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
|
||||
storageTest, zNewFmt("repo/archive/test/18-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.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
|
||||
storageTest, zNewFmt("repo/archive/test/18-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
|
||||
.comment = "check repo1 for WAL 1 file");
|
||||
|
||||
TEST_STORAGE_EXISTS(
|
||||
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1),
|
||||
storageTest, zNewFmt("repo3/archive/test/18-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_95);
|
||||
HRN_PG_WAL_TO_BUFFER(walBuffer2, PG_VERSION_18);
|
||||
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.5-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
|
||||
storageTest, zNewFmt("repo/archive/test/18-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
|
||||
.comment = "check repo1 for WAL 2 file");
|
||||
TEST_STORAGE_EXISTS(
|
||||
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1),
|
||||
storageTest, zNewFmt("repo3/archive/test/18-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_95);
|
||||
HRN_PG_WAL_TO_BUFFER(walBuffer3, PG_VERSION_18);
|
||||
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.5-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
|
||||
storageTest, zNewFmt("repo/archive/test/18-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
|
||||
.comment = "check repo1 for WAL 3 file");
|
||||
TEST_STORAGE_EXISTS(
|
||||
storageTest, zNewFmt("repo3/archive/test/9.5-1/0000000100000001/000000010000000100000003-%s", walBuffer3Sha1),
|
||||
storageTest, zNewFmt("repo3/archive/test/18-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
|
||||
|
||||
@@ -1534,7 +1534,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_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
// Create stanza
|
||||
argList = strLstNew();
|
||||
@@ -1557,11 +1557,11 @@ testRun(void)
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
dbFree(
|
||||
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
|
||||
backupInit(infoBackupNew(PG_VERSION_18, HRN_PG_SYSTEMID_18, hrnPgCatalogVersion(PG_VERSION_18), NULL))->dbPrimary),
|
||||
"backup init");
|
||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptChecksumPage), false, "check checksum-page");
|
||||
|
||||
@@ -1572,7 +1572,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_95, .pageChecksumVersion = 1);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18, .pageChecksumVersion = 1);
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
@@ -1584,24 +1584,24 @@ testRun(void)
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
dbFree(
|
||||
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
|
||||
backupInit(infoBackupNew(PG_VERSION_18, HRN_PG_SYSTEMID_18, hrnPgCatalogVersion(PG_VERSION_18), 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_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
dbFree(
|
||||
backupInit(infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL))->dbPrimary),
|
||||
backupInit(infoBackupNew(PG_VERSION_18, HRN_PG_SYSTEMID_18, hrnPgCatalogVersion(PG_VERSION_18), NULL))->dbPrimary),
|
||||
"backup init");
|
||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptChecksumPage), false, "check checksum-page");
|
||||
}
|
||||
@@ -1613,7 +1613,7 @@ testRun(void)
|
||||
TEST_TITLE("sleep retries and stall error");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
// Create stanza
|
||||
StringList *argList = strLstNew();
|
||||
@@ -1635,7 +1635,7 @@ testRun(void)
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// Advance the time slowly to force retries
|
||||
HRN_PQ_SCRIPT_TIME_QUERY(1, 1575392588998),
|
||||
@@ -1649,7 +1649,7 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_TIME_QUERY(1, 1575392589999));
|
||||
|
||||
BackupData *backupData = backupInit(
|
||||
infoBackupNew(PG_VERSION_95, HRN_PG_SYSTEMID_95, hrnPgCatalogVersion(PG_VERSION_95), NULL));
|
||||
infoBackupNew(PG_VERSION_18, HRN_PG_SYSTEMID_18, hrnPgCatalogVersion(PG_VERSION_18), 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");
|
||||
@@ -1898,7 +1898,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
cmdStanzaCreate();
|
||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||
@@ -1950,7 +1950,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() ? "ead3f998dc6dbc4b444f89cd449dcb81801a21ed" : "6f7fb3cd71dbef602850d05332cdd1c8e4a64121") :
|
||||
(TEST_BIG_ENDIAN() ? "a73da1cfddf849880b4f6f0f4209ce71043f2ac1" : "807d4464138ef085e41844a9f488f067b3d46d46") :
|
||||
"a90290adaf2e8a36d53b0c15d277e23e1b321fdb");
|
||||
|
||||
// Make pg no longer appear to be running
|
||||
@@ -2134,7 +2134,7 @@ testRun(void)
|
||||
hrnLogReplaceAdd("\\) checksum [a-f0-9]{40}", "[a-f0-9]{40}$", "SHA1", false);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("online 9.5 resume uncompressed full backup");
|
||||
TEST_TITLE("online 14 resume uncompressed full backup");
|
||||
|
||||
time_t backupTimeStart = BACKUP_EPOCH;
|
||||
|
||||
@@ -2148,7 +2148,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_14);
|
||||
|
||||
cmdStanzaCreate();
|
||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||
@@ -2160,19 +2160,18 @@ testRun(void)
|
||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeFull);
|
||||
hrnCfgArgRawBool(argList, cfgOptStopAuto, true);
|
||||
hrnCfgArgRawBool(argList, cfgOptCompress, false);
|
||||
hrnCfgArgRawBool(argList, cfgOptArchiveCheck, false);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Add files
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), "postgresql.conf", "CONFIGSTUFF", .timeModified = backupTimeStart);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_95_Z, .timeModified = backupTimeStart);
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_95)), .noParentCreate = true);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_14_Z, .timeModified = backupTimeStart);
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_14)), .noParentCreate = true);
|
||||
|
||||
// Create a backup manifest that looks like a halted backup manifest
|
||||
Manifest *manifestResume = manifestNewBuild(
|
||||
storagePg(), PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
storagePg(), PG_VERSION_14, hrnPgCatalogVersion(PG_VERSION_14), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
|
||||
manifestResume->pub.data.backupType = backupTypeFull;
|
||||
const String *resumeLabel = backupLabelCreate(backupTypeFull, NULL, backupTimeStart);
|
||||
@@ -2186,8 +2185,8 @@ testRun(void)
|
||||
ManifestFilePack **const filePack = manifestFilePackFindInternal(manifestResume, STRDEF("pg_data/PG_VERSION"));
|
||||
ManifestFile file = manifestFileUnpack(manifestResume, *filePack);
|
||||
|
||||
file.checksumSha1 = bufPtr(bufNewDecode(encodingHex, STRDEF("06d06bb31b570b94d7b4325f511f853dbe771c21")));
|
||||
file.checksumRepoSha1 = bufPtr(bufNewDecode(encodingHex, STRDEF("06d06bb31b570b94d7b4325f511f853dbe771c21")));
|
||||
file.checksumSha1 = bufPtr(bufNewDecode(encodingHex, STRDEF("fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b")));
|
||||
file.checksumRepoSha1 = bufPtr(bufNewDecode(encodingHex, STRDEF("fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b")));
|
||||
|
||||
manifestFilePackUpdate(manifestResume, filePack, &file);
|
||||
|
||||
@@ -2200,29 +2199,31 @@ testRun(void)
|
||||
strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT, strZ(resumeLabel)))));
|
||||
|
||||
// Run backup
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D944C000000000, lsn = 5d944c0/0\n"
|
||||
"P00 WARN: resumable backup 20191002-070640F of same type exists -- invalid files will be removed then the backup"
|
||||
" will resume\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/postgresql.conf (11B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: checksum resumed file " TEST_PATH "/pg1/PG_VERSION (3B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P01 DETAIL: checksum resumed file " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D944C000000000, lsn = 5d944c0/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: new backup label = 20191002-070640F\n"
|
||||
"P00 INFO: full backup size = [SIZE], file total = 3");
|
||||
"P00 INFO: full backup size = [SIZE], file total = 4");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
testBackupValidateP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")),
|
||||
".> {d=20191002-070640F}\n"
|
||||
"pg_data/PG_VERSION {s=3}\n"
|
||||
"pg_data/PG_VERSION {s=2}\n"
|
||||
"pg_data/backup_label {s=17, ts=+52427}\n"
|
||||
"pg_data/global/pg_control {s=8192}\n"
|
||||
"pg_data/pg_xlog/\n"
|
||||
"pg_data/pg_wal/\n"
|
||||
"pg_data/postgresql.conf {s=11}\n"
|
||||
"--------\n"
|
||||
"[backup:target]\n"
|
||||
@@ -2231,7 +2232,7 @@ testRun(void)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("online resumed compressed 9.5 full backup");
|
||||
TEST_TITLE("online resumed compressed 14 full backup");
|
||||
|
||||
// Backup start time
|
||||
backupTimeStart = BACKUP_EPOCH + 100000;
|
||||
@@ -2244,13 +2245,12 @@ testRun(void)
|
||||
hrnCfgArgRaw(argList, cfgOptPgPath, pg1Path);
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeFull);
|
||||
hrnCfgArgRawBool(argList, cfgOptStopAuto, true);
|
||||
hrnCfgArgRawBool(argList, cfgOptArchiveCopy, true);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create a backup manifest that looks like a halted backup manifest
|
||||
Manifest *manifestResume = manifestNewBuild(
|
||||
storagePg(), PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
storagePg(), PG_VERSION_14, hrnPgCatalogVersion(PG_VERSION_14), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
|
||||
manifestResume->pub.data.backupType = backupTypeFull;
|
||||
manifestResume->pub.data.backupOptionCompressType = compressTypeGz;
|
||||
@@ -2324,7 +2324,7 @@ testRun(void)
|
||||
((Storage *)storageRepoWrite())->pub.interface.feature ^= 1 << storageFeaturePathSync;
|
||||
|
||||
// Run backup
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
// Enable storage features
|
||||
@@ -2333,7 +2333,7 @@ testRun(void)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D95D3000000000, lsn = 5d95d30/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105D95D2F000000FF\n"
|
||||
"P00 WARN: resumable backup 20191003-105320F of same type exists -- invalid files will be removed then the backup"
|
||||
@@ -2359,22 +2359,24 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/time-mismatch (4B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/size-mismatch (4B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/not-in-resume (4B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (3B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/zero-size (0B, [PCT])\n"
|
||||
"P00 INFO: execute exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D95D3000000000, lsn = 5d95d30/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105D95D3000000000:0000000105D95D3000000000\n"
|
||||
"P00 DETAIL: copy segment 0000000105D95D3000000000 to backup\n"
|
||||
"P00 INFO: new backup label = 20191003-105320F\n"
|
||||
"P00 INFO: full backup size = [SIZE], file total = 8");
|
||||
"P00 INFO: full backup size = [SIZE], file total = 9");
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
testBackupValidateP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")),
|
||||
".> {d=20191003-105320F}\n"
|
||||
"pg_data/PG_VERSION.gz {s=3, ts=-100000}\n"
|
||||
"pg_data/PG_VERSION.gz {s=2, ts=-100000}\n"
|
||||
"pg_data/backup_label.gz {s=17, ts=+2}\n"
|
||||
"pg_data/global/pg_control.gz {s=8192}\n"
|
||||
"pg_data/not-in-resume.gz {s=4}\n"
|
||||
"pg_data/pg_xlog/0000000105D95D3000000000.gz {s=16777216, ts=+2}\n"
|
||||
"pg_data/pg_wal/0000000105D95D3000000000.gz {s=16777216, ts=+2}\n"
|
||||
"pg_data/postgresql.conf.gz {s=11, ts=-100000}\n"
|
||||
"pg_data/size-mismatch.gz {s=4}\n"
|
||||
"pg_data/time-mismatch.gz {s=4}\n"
|
||||
@@ -2392,7 +2394,7 @@ testRun(void)
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("online resumed compressed 9.5 full delta backup");
|
||||
TEST_TITLE("online resumed compressed 14 full delta backup");
|
||||
|
||||
backupTimeStart = BACKUP_EPOCH + 200000;
|
||||
|
||||
@@ -2404,13 +2406,12 @@ testRun(void)
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||
hrnCfgArgRawStrId(argList, cfgOptType, backupTypeFull);
|
||||
hrnCfgArgRawBool(argList, cfgOptDelta, true);
|
||||
hrnCfgArgRawBool(argList, cfgOptStopAuto, true);
|
||||
hrnCfgArgRawBool(argList, cfgOptRepoHardlink, true);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create a backup manifest that looks like a halted backup manifest
|
||||
Manifest *manifestResume = manifestNewBuild(
|
||||
storagePg(), PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
storagePg(), PG_VERSION_14, hrnPgCatalogVersion(PG_VERSION_14), 0, true, false, false, false, NULL, NULL, NULL);
|
||||
|
||||
manifestResume->pub.data.backupOptionCompressType = compressTypeGz;
|
||||
const String *resumeLabel = backupLabelCreate(backupTypeFull, NULL, backupTimeStart - 100000);
|
||||
@@ -2477,12 +2478,12 @@ testRun(void)
|
||||
// Run backup
|
||||
HRN_BACKUP_SCRIPT_SET(
|
||||
{.op = hrnBackupScriptOpRemove, .file = storagePathP(storagePg(), STRDEF("removed-during"))});
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
// Check log
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D9759000000000, lsn = 5d97590/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105D9758F000000FF\n"
|
||||
"P00 WARN: resumable backup 20191003-105321F of same type exists -- invalid files will be removed then the backup"
|
||||
@@ -2503,21 +2504,23 @@ testRun(void)
|
||||
" NOTE: this does not indicate a problem with the PostgreSQL page checksums.\n"
|
||||
"P01 DETAIL: skip file removed by database " TEST_PATH "/pg1/removed-during\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/content-mismatch (4B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (3B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D9759000000000, lsn = 5d97590/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105D9759000000000:0000000105D9759000000000\n"
|
||||
"P00 INFO: new backup label = 20191003-105321F\n"
|
||||
"P00 INFO: full backup size = [SIZE], file total = 6");
|
||||
"P00 INFO: full backup size = [SIZE], file total = 7");
|
||||
|
||||
// Check repo directory
|
||||
TEST_RESULT_STR_Z(
|
||||
testBackupValidateP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")),
|
||||
".> {d=20191003-105321F}\n"
|
||||
"pg_data/PG_VERSION.gz {s=3, ts=-200000}\n"
|
||||
"pg_data/PG_VERSION.gz {s=2, ts=-200000}\n"
|
||||
"pg_data/backup_label.gz {s=17, ts=+2}\n"
|
||||
"pg_data/content-mismatch.gz {s=4}\n"
|
||||
"pg_data/global/pg_control.gz {s=8192}\n"
|
||||
"pg_data/pg_xlog/\n"
|
||||
"pg_data/pg_wal/\n"
|
||||
"pg_data/postgresql.conf.gz {s=11, ts=-200000}\n"
|
||||
"pg_data/repo-size-mismatch.gz {s=4}\n"
|
||||
"pg_data/time-mismatch2.gz {s=4, ts=+100}\n"
|
||||
@@ -2545,27 +2548,31 @@ testRun(void)
|
||||
strNewFmt(STORAGE_REPO_BACKUP "/%s/" BACKUP_MANIFEST_FILE INFO_COPY_EXT, strZ(resumeLabel)))));
|
||||
|
||||
// Back errors on backup type
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
// Check log
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: backup '20191003-105321F' missing manifest removed from backup.info\n"
|
||||
"P00 INFO: execute exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D9759000000000, lsn = 5d97590/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105D9758F000000FF\n"
|
||||
"P00 WARN: backup '20191003-105321F' cannot be resumed: new backup type 'full' does not match resumable backup"
|
||||
" type 'diff'\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/postgresql.conf (11B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (3B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D9759000000000, lsn = 5d97590/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105D9759000000000:0000000105D9759000000000\n"
|
||||
"P00 INFO: new backup label = 20191004-144000F\n"
|
||||
"P00 INFO: full backup size = [SIZE], file total = 3");
|
||||
"P00 INFO: full backup size = [SIZE], file total = 4");
|
||||
}
|
||||
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), "pg_wal", .errorOnMissing = true);
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite(), "pg_xlog");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("online 9.6 backup-standby full backup");
|
||||
|
||||
@@ -2855,7 +2862,7 @@ testRun(void)
|
||||
"P00 WARN: unable to check pg2: [DbConnectError] unable to connect to 'dbname='postgres' port=5433': error\n"
|
||||
"P00 WARN: unable to find a standby to perform the backup, using primary instead\n"
|
||||
"P00 INFO: last backup label = 20191020-193320F_20191021-232000I, version = " PROJECT_VERSION "\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the requested immediate checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the requested immediate checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DAFC3000000000, lsn = 5dafc30/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105DAFC2F000000FF\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/base/1/4 (bundle 1/0, 40KB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -2863,7 +2870,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/16476, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191020-193320F\n"
|
||||
"P00 DETAIL: reference pg_data/postgresql.conf to 20191020-193320F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DAFC3000000000, lsn = 5dafc30/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DAFC3000000000:0000000105DAFC3000000000\n"
|
||||
@@ -2883,6 +2890,8 @@ testRun(void)
|
||||
"[backup:target]\n"
|
||||
"pg_data={\"path\":\"" TEST_PATH "/pg1\",\"type\":\"path\"}\n",
|
||||
"compare file list");
|
||||
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), "pg_xlog", .errorOnMissing = true);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -2898,7 +2907,7 @@ testRun(void)
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_Z, .timeModified = backupTimeStart);
|
||||
|
||||
// Update wal path
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_95)));
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_14)));
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_11)), .noParentCreate = true);
|
||||
|
||||
// Upgrade stanza
|
||||
@@ -3001,7 +3010,7 @@ testRun(void)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DB5DE000000000, lsn = 5db5de0/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DB5DE000000000\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/base/1/3 (40KB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -3016,7 +3025,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/postgresql.conf (11B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/pg_tblspc/32768/PG_11_201809051/1/5 (0B, [PCT])\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DB5DE000000002, lsn = 5db5de0/280000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 DETAIL: wrote 'tablespace_map' file returned from backup stop function\n"
|
||||
@@ -3083,7 +3092,7 @@ testRun(void)
|
||||
// Check log
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191027-181320F, version = " PROJECT_VERSION "\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DB764000000000, lsn = 5db7640/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105DB763F00000FFF");
|
||||
|
||||
@@ -3144,7 +3153,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191027-181320F, version = " PROJECT_VERSION "\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000002C05DB8EB000000000, lsn = 5db8eb0/0\n"
|
||||
"P00 INFO: check archive for segment 0000002C05DB8EB000000000\n"
|
||||
"P00 WARN: a timeline switch has occurred since the 20191027-181320F backup, enabling delta checksum\n"
|
||||
@@ -3160,7 +3169,7 @@ testRun(void)
|
||||
"P00 DETAIL: hardlink pg_data/PG_VERSION to 20191027-181320F\n"
|
||||
"P00 DETAIL: hardlink pg_data/postgresql.conf to 20191027-181320F\n"
|
||||
"P00 DETAIL: hardlink pg_tblspc/32768/PG_11_201809051/1/5 to 20191027-181320F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000002C05DB8EB000000001, lsn = 5db8eb0/180000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 DETAIL: wrote 'tablespace_map' file returned from backup stop function\n"
|
||||
@@ -3252,7 +3261,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DB8EB000000000, lsn = 5db8eb0/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DB8EB000000000\n"
|
||||
"P00 DETAIL: store zero-length file " TEST_PATH "/pg1/zero\n"
|
||||
@@ -3267,7 +3276,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/95, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/bigish.dat (bundle 2/0, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 3/0, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DB8EB000000001, lsn = 5db8eb0/180000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 DETAIL: wrote 'tablespace_map' file returned from backup stop function\n"
|
||||
@@ -3341,14 +3350,14 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191030-014640F, version = " PROJECT_VERSION "\n"
|
||||
"P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from 20191030-014640F\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DBBF8000000000, lsn = 5dbbf80/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DBBF8000000000\n"
|
||||
"P00 DETAIL: store zero-length file " TEST_PATH "/pg1/zero\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/0, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: match file from prior backup " TEST_PATH "/pg1/PG_VERSION (2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191030-014640F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DBBF8000000001, lsn = 5dbbf80/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DBBF8000000000:0000000105DBBF8000000001\n"
|
||||
@@ -3432,7 +3441,7 @@ testRun(void)
|
||||
"raised from local-1 shim protocol: unable to open missing file '" TEST_PATH "/pg1/global/pg_control' for read");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DBF06000000000, lsn = 5dbf060/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DBF06000000000\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-no-resume (24KB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -3445,7 +3454,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DBF06000000000, lsn = 5dbf060/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DBF06000000000\n"
|
||||
"P00 INFO: backup '20191103-165320F' cannot be resumed: partially deleted by prior resume or invalid\n"
|
||||
@@ -3453,7 +3462,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-grow (24KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/0, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/8192, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DBF06000000001, lsn = 5dbf060/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DBF06000000000:0000000105DBF06000000001\n"
|
||||
@@ -3550,7 +3559,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: backup '20191103-165320F' missing manifest removed from backup.info\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC08C000000000, lsn = 5dc08c0/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC08C000000000\n"
|
||||
"P00 WARN: resumable backup 20191103-165320F of same type exists -- invalid files will be removed then the backup"
|
||||
@@ -3572,7 +3581,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-shrink-below (bundle 1/40987, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-shrink (bundle 1/57393, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-same (bundle 1/73807, 16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC08C000000001, lsn = 5dc08c0/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC08C000000000:0000000105DC08C000000001\n"
|
||||
@@ -3690,7 +3699,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191103-165320F, version = " PROJECT_VERSION "\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC213000000000, lsn = 5dc2130/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC213000000000\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-larger (1.4MB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -3706,7 +3715,7 @@ testRun(void)
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191103-165320F\n"
|
||||
"P00 DETAIL: reference pg_data/block-incr-same to 20191103-165320F\n"
|
||||
"P00 DETAIL: reference pg_data/normal-same to 20191103-165320F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC213000000001, lsn = 5dc2130/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC213000000000:0000000105DC213000000001\n"
|
||||
@@ -3804,14 +3813,14 @@ testRun(void)
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC520000000000, lsn = 5dc5200/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC520000000000\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-no-resume (24KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-grow (24KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/0, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/24, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC520000000001, lsn = 5dc5200/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC520000000000:0000000105DC520000000001\n"
|
||||
@@ -3884,7 +3893,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: backup '20191108-080000F' missing manifest removed from backup.info\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC6A7000000000, lsn = 5dc6a70/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC6A7000000000\n"
|
||||
"P00 WARN: resumable backup 20191108-080000F of same type exists -- invalid files will be removed then the backup"
|
||||
@@ -3897,7 +3906,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/block-incr-wayback (16KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/0, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/24, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC6A7000000001, lsn = 5dc6a70/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC6A7000000000:0000000105DC6A7000000001\n"
|
||||
@@ -3982,7 +3991,7 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191108-080000F, version = " PROJECT_VERSION "\n"
|
||||
"P00 WARN: diff backup cannot alter compress-type option to 'bz2', reset to value in 20191108-080000F\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC82D000000000, lsn = 5dc82d0/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC82D000000000\n"
|
||||
"P00 WARN: file 'block-incr-grow' has same timestamp (1573200000) as prior but different size (prior 24576,"
|
||||
@@ -3995,7 +4004,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/312, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191108-080000F\n"
|
||||
"P00 DETAIL: reference pg_data/block-incr-wayback to 20191108-080000F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC82D000000001, lsn = 5dc82d0/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC82D000000000:0000000105DC82D000000001\n"
|
||||
@@ -4048,7 +4057,7 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191108-080000F_20191110-153320D, version = " PROJECT_VERSION "\n"
|
||||
"P00 WARN: incr backup cannot alter compress-type option to 'bz2', reset to value in 20191108-080000F_20191110-153320D\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC8F1000000000, lsn = 5dc8f10/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105DC8F0F000007FF\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (8KB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -4057,7 +4066,7 @@ testRun(void)
|
||||
"P00 DETAIL: reference pg_data/block-age-to-zero to 20191108-080000F_20191110-153320D\n"
|
||||
"P00 DETAIL: reference pg_data/block-incr-grow to 20191108-080000F_20191110-153320D\n"
|
||||
"P00 DETAIL: reference pg_data/block-incr-wayback to 20191108-080000F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC8F1000000000, lsn = 5dc8f10/100000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC8F1000000000:0000000105DC8F1000000000\n"
|
||||
@@ -4139,7 +4148,7 @@ testRun(void)
|
||||
TEST_RESULT_UINT(storageInfoP(storagePgWrite(), STRDEF("global/1")).size, 16384, "check global/1 grew");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105DC9B4000000000, lsn = 5dc9b40/0\n"
|
||||
"P00 INFO: check archive for segment 0000000105DC9B4000000000\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/2 (16KB, [PCT]) checksum [SHA1]\n"
|
||||
@@ -4147,7 +4156,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/1 (12KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/0, 8KB, [PCT]) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/PG_VERSION (bundle 1/8224, 2B, [PCT]) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105DC9B4000000001, lsn = 5dc9b40/300000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105DC9B4000000000:0000000105DC9B4000000001\n"
|
||||
|
||||
@@ -245,7 +245,7 @@ testRun(void)
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_96);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ERROR(cmdCheck(), ConfigError, "primary database not found\nHINT: check indexed pg-path/pg-host configurations");
|
||||
@@ -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_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_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_18, "/pgdata", true, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -287,7 +287,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
// Only confirming we get passed the check for repoIsLocal || more than one pg-path configured
|
||||
@@ -310,7 +310,7 @@ testRun(void)
|
||||
|
||||
// Primary database connection ok
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ERROR(
|
||||
@@ -344,8 +344,8 @@ testRun(void)
|
||||
|
||||
// Standby database path doesn't match pg_control
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH, true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH, true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -387,8 +387,8 @@ testRun(void)
|
||||
|
||||
// Single repo config - error when checking archive mode setting on database
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, "off", NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, "off", NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(1),
|
||||
HRN_PQ_SCRIPT_CLOSE(8));
|
||||
@@ -408,8 +408,8 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argListRepo2);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -470,7 +470,7 @@ testRun(void)
|
||||
|
||||
// Error when WAL segment not found
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(1, "wal", "000000010000000100000001"),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -518,7 +518,7 @@ testRun(void)
|
||||
|
||||
// WAL segment switch is performed once for all repos
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(1, "wal", "000000010000000100000001"),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -584,8 +584,8 @@ testRun(void)
|
||||
DbGetResult db = {0};
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_11, "/badpath", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_11, "/badpath", true, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(1),
|
||||
HRN_PQ_SCRIPT_CLOSE(8));
|
||||
@@ -598,9 +598,9 @@ testRun(void)
|
||||
TEST_TITLE("checkDbConfig() version mismatch");
|
||||
|
||||
TEST_ERROR(
|
||||
checkDbConfig(PG_VERSION_95, db.primaryIdx, db.primary, false), DbMismatchError,
|
||||
checkDbConfig(PG_VERSION_96, 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_95_Z "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n"
|
||||
PG_VERSION_96_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.");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -648,7 +648,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, "always", NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, "always", NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
@@ -696,27 +696,27 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("checkStanzaInfo() - corrupted backup file: system id and version");
|
||||
|
||||
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
||||
backupInfo = infoBackupNew(PG_VERSION_18, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_18), NULL);
|
||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||
|
||||
TEST_ERROR(
|
||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||
"backup info file and archive info file do not match\n"
|
||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||
"backup : id = 1, version = 9.5, system-id = 6569239123849665999\n"
|
||||
"backup : id = 1, version = 18, system-id = 6569239123849665999\n"
|
||||
"HINT: this may be a symptom of repository corruption!");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("checkStanzaInfo() - corrupted backup file: version");
|
||||
|
||||
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95), NULL);
|
||||
backupInfo = infoBackupNew(PG_VERSION_18, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_18), NULL);
|
||||
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
|
||||
|
||||
TEST_ERROR(
|
||||
checkStanzaInfo(&archivePg, &backupPg), FileInvalidError,
|
||||
"backup info file and archive info file do not match\n"
|
||||
"archive: id = 1, version = 9.6, system-id = 6569239123849665679\n"
|
||||
"backup : id = 1, version = 9.5, system-id = 6569239123849665679\n"
|
||||
"backup : id = 1, version = 18, system-id = 6569239123849665679\n"
|
||||
"HINT: this may be a symptom of repository corruption!");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -754,7 +754,7 @@ testRun(void)
|
||||
// Version mismatch
|
||||
TEST_ERROR(
|
||||
checkStanzaInfoPg(
|
||||
storageRepoIdx(0), PG_VERSION_95, HRN_PG_SYSTEMID_95, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
||||
storageRepoIdx(0), PG_VERSION_18, HRN_PG_SYSTEMID_18, cfgOptionIdxStrId(cfgOptRepoCipherType, 0),
|
||||
cfgOptionIdxStr(cfgOptRepoCipherPass, 0)),
|
||||
FileInvalidError,
|
||||
"backup and archive info files exist but do not match the database\n"
|
||||
|
||||
@@ -49,7 +49,6 @@ testRun(void)
|
||||
"repo2-block=y\n"
|
||||
"\n"
|
||||
"archive-check=n\n"
|
||||
"stop-auto=y\n"
|
||||
"compress-type=none\n"
|
||||
"\n"
|
||||
"[test]\n"
|
||||
@@ -73,7 +72,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
// Create pg_control and run stanza-create
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_14);
|
||||
TEST_RESULT_VOID(cmdStanzaCreate(), "stanza create");
|
||||
}
|
||||
|
||||
@@ -84,7 +83,7 @@ testRun(void)
|
||||
|
||||
// Version file that will not be updated after the full backup
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storagePgWrite(), PG_PATH_BASE "/" PG_FILE_PGVERSION, PG_VERSION_95_Z, .timeModified = backupTimeStart);
|
||||
storagePgWrite(), PG_PATH_BASE "/" PG_FILE_PGVERSION, PG_VERSION_14_Z "\n", .timeModified = backupTimeStart);
|
||||
|
||||
// Zeroed file large enough to use block incr
|
||||
Buffer *relation = bufNew(8 * 8192);
|
||||
@@ -98,7 +97,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Backup to repo1
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup repo1");
|
||||
|
||||
// Backup to repo2
|
||||
@@ -106,7 +105,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
hrnBackupPqScriptP(
|
||||
PG_VERSION_95, backupTimeStart, .noArchiveCheck = true, .noWal = true, .cipherType = cipherTypeAes256Cbc,
|
||||
PG_VERSION_14, backupTimeStart, .noArchiveCheck = true, .noWal = true, .cipherType = cipherTypeAes256Cbc,
|
||||
.cipherPass = TEST_CIPHER_PASS);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup repo2");
|
||||
}
|
||||
@@ -129,7 +128,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Backup to repo1
|
||||
hrnBackupPqScriptP(PG_VERSION_95, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
hrnBackupPqScriptP(PG_VERSION_14, backupTimeStart, .noArchiveCheck = true, .noWal = true);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup repo1");
|
||||
|
||||
// Munge the pg_control checksum since it will vary by architecture
|
||||
@@ -153,7 +152,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
hrnBackupPqScriptP(
|
||||
PG_VERSION_95, backupTimeStart, .noArchiveCheck = true, .noWal = true, .cipherType = cipherTypeAes256Cbc,
|
||||
PG_VERSION_14, backupTimeStart, .noArchiveCheck = true, .noWal = true, .cipherType = cipherTypeAes256Cbc,
|
||||
.cipherPass = TEST_CIPHER_PASS);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup repo2");
|
||||
}
|
||||
@@ -273,6 +272,10 @@ testRun(void)
|
||||
"block: true\n"
|
||||
"\n"
|
||||
"file list:\n"
|
||||
" - pg_data/backup_label\n"
|
||||
" size: 17B, repo 17B\n"
|
||||
" checksum: 8e6f41ac87a7514be96260d65bacbffb11be77dc\n"
|
||||
"\n"
|
||||
" - pg_data/base/1/2\n"
|
||||
" size: 96KB, repo 64.1KB\n"
|
||||
" checksum: d4976e362696a43fb09e7d4e780d7d9352a2ec2e\n"
|
||||
@@ -282,7 +285,7 @@ testRun(void)
|
||||
" - pg_data/base/PG_VERSION\n"
|
||||
" reference: 20191002-070640F\n"
|
||||
" size: 3B, repo 3B\n"
|
||||
" checksum: 06d06bb31b570b94d7b4325f511f853dbe771c21\n"
|
||||
" checksum: 030514d80869744a4e2f60d2fd37d6081f5ed01a\n"
|
||||
" bundle: 1\n"
|
||||
"\n"
|
||||
" - pg_data/global/pg_control\n"
|
||||
@@ -311,7 +314,7 @@ testRun(void)
|
||||
" - pg_data/base/PG_VERSION\n"
|
||||
" reference: 20191002-070640F\n"
|
||||
" size: 3B, repo 3B\n"
|
||||
" checksum: 06d06bb31b570b94d7b4325f511f853dbe771c21\n"
|
||||
" checksum: 030514d80869744a4e2f60d2fd37d6081f5ed01a\n"
|
||||
" bundle: 1\n",
|
||||
"repo 1 text");
|
||||
|
||||
@@ -345,7 +348,7 @@ testRun(void)
|
||||
"\"name\":\"pg_data/base/PG_VERSION\","
|
||||
"\"reference\":\"20191002-070640F\","
|
||||
"\"size\":3,"
|
||||
"\"checksum\":\"06d06bb31b570b94d7b4325f511f853dbe771c21\","
|
||||
"\"checksum\":\"030514d80869744a4e2f60d2fd37d6081f5ed01a\","
|
||||
"\"repo\":{"
|
||||
"\"size\":3"
|
||||
"},"
|
||||
@@ -378,6 +381,10 @@ testRun(void)
|
||||
"block: true\n"
|
||||
"\n"
|
||||
"file list:\n"
|
||||
" - pg_data/backup_label\n"
|
||||
" size: 17B, repo 17B\n"
|
||||
" checksum: 8e6f41ac87a7514be96260d65bacbffb11be77dc\n"
|
||||
"\n"
|
||||
" - pg_data/base/1/2\n"
|
||||
" size: 96KB, repo 64.1KB\n"
|
||||
" checksum: d4976e362696a43fb09e7d4e780d7d9352a2ec2e\n"
|
||||
@@ -415,6 +422,13 @@ testRun(void)
|
||||
"\"block\":true"
|
||||
"},"
|
||||
"\"fileList\":["
|
||||
"{"
|
||||
"\"name\":\"pg_data/backup_label\","
|
||||
"\"size\":17,"
|
||||
"\"checksum\":\"8e6f41ac87a7514be96260d65bacbffb11be77dc\","
|
||||
"\"repo\":"
|
||||
"{\"size\":17}"
|
||||
"},"
|
||||
"{"
|
||||
"\"name\":\"pg_data/base/1/2\","
|
||||
"\"size\":98304,"
|
||||
|
||||
@@ -34,15 +34,15 @@ Test data for backup.info
|
||||
***********************************************************************************************************************************/
|
||||
#define TEST_RESTORE_BACKUP_INFO_DB \
|
||||
"[db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=202506291\n" \
|
||||
"db-control-version=1100\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=6569239123849665679\n" \
|
||||
"db-version=\"9.5\"\n" \
|
||||
"db-version=\"18\"\n" \
|
||||
"\n" \
|
||||
"[db:history]\n" \
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679," \
|
||||
"\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1100,\"db-system-id\":6569239123849665679," \
|
||||
"\"db-version\":\"18\"}\n"
|
||||
|
||||
#define TEST_RESTORE_BACKUP_INFO \
|
||||
"[backup:current]\n" \
|
||||
@@ -437,8 +437,8 @@ testRun(void)
|
||||
"db-version=\"10\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1100,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-catalog-version\":201707211,\"db-control-version\":1002,\"db-system-id\":6626363367545678089"
|
||||
",\"db-version\":\"10\"}\n");
|
||||
|
||||
@@ -701,7 +701,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error on mismatched label");
|
||||
|
||||
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_95, STRDEF("/pg"));
|
||||
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_18, STRDEF("/pg"));
|
||||
|
||||
TEST_ERROR(
|
||||
restoreManifestValidate(manifest, STRDEF("20161219-212741F_20161219-212918I")), FormatError,
|
||||
@@ -714,7 +714,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_95, pgPath);
|
||||
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_18, pgPath);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("remap data directory");
|
||||
@@ -1361,8 +1361,8 @@ testRun(void)
|
||||
OBJ_NEW_BASE_BEGIN(Manifest, .childQty = MEM_CONTEXT_QTY_MAX)
|
||||
{
|
||||
manifest = manifestNewInternal();
|
||||
manifest->pub.data.pgVersion = PG_VERSION_95;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_18;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_18);
|
||||
|
||||
HRN_MANIFEST_TARGET_ADD(manifest, .name = MANIFEST_TARGET_PGDATA, .path = "/pg");
|
||||
HRN_MANIFEST_FILE_ADD(manifest, .name = MANIFEST_TARGET_PGDATA "/" PG_FILE_PGVERSION);
|
||||
@@ -1508,7 +1508,7 @@ testRun(void)
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.5_201510051/32768/)",
|
||||
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_18_202506291/32768/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1518,20 +1518,20 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("one database selected with tablespace id");
|
||||
|
||||
manifest->pub.data.pgVersion = PG_VERSION_95;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_18;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_18);
|
||||
|
||||
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.5_201510051/65536/" PG_FILE_PGVERSION);
|
||||
HRN_MANIFEST_FILE_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/16387/PG_18_202506291/65536/" PG_FILE_PGVERSION);
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest),
|
||||
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.5_201510051/32768/)|(^pg_data/base/65536/)"
|
||||
"|(^pg_tblspc/16387/PG_9.5_201510051/65536/)",
|
||||
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_18_202506291/32768/)|(^pg_data/base/65536/)"
|
||||
"|(^pg_tblspc/16387/PG_18_202506291/65536/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1547,7 +1547,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest),
|
||||
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.5_201510051/16384/)",
|
||||
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_18_202506291/16384/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1563,7 +1563,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest),
|
||||
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_9.5_201510051/16384/)",
|
||||
"(^pg_data/base/16384/)|(^pg_tblspc/16387/PG_18_202506291/16384/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1579,7 +1579,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest),
|
||||
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_9.5_201510051/16385/)",
|
||||
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_18_202506291/16385/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1621,10 +1621,10 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest),
|
||||
"(^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/)",
|
||||
"(^pg_data/base/1/)|(^pg_tblspc/16387/PG_18_202506291/1/)|"
|
||||
"(^pg_data/base/16385/)|(^pg_tblspc/16387/PG_18_202506291/16385/)|"
|
||||
"(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_18_202506291/32768/)|"
|
||||
"(^pg_data/base/65536/)|(^pg_tblspc/16387/PG_18_202506291/65536/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@@ -1652,7 +1652,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_18, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"a_setting = 'a'\n"
|
||||
"b_setting = 'b'\n"
|
||||
@@ -1668,7 +1668,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_18, 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",
|
||||
@@ -1682,7 +1682,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_18, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n",
|
||||
"check recovery options");
|
||||
@@ -1726,7 +1726,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_11, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"recovery_target_time = 'TIME'\n"
|
||||
@@ -1743,7 +1743,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_18, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"recovery_target_time = 'TIME'\n"
|
||||
@@ -1759,7 +1759,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_18, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"recovery_target_name = 'NAME'\n",
|
||||
@@ -1789,7 +1789,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_11, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"recovery_target = 'immediate'\n"
|
||||
@@ -1804,7 +1804,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_11, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"standby_mode = 'on'\n",
|
||||
@@ -1819,7 +1819,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel),
|
||||
restoreRecoveryConf(PG_VERSION_11, restoreLabel),
|
||||
RECOVERY_SETTING_HEADER
|
||||
"restore_command = 'my_restore_command'\n"
|
||||
"standby_mode = 'on'\n",
|
||||
@@ -1840,7 +1840,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdRestore, argList);
|
||||
|
||||
TEST_ERROR(
|
||||
restoreRecoveryConf(PG_VERSION_95, restoreLabel), OptionInvalidError,
|
||||
restoreRecoveryConf(PG_VERSION_11, restoreLabel), OptionInvalidError,
|
||||
"option 'archive-mode' is not supported on PostgreSQL < 12\n"
|
||||
"HINT: 'archive_mode' should be manually set to 'off' in postgresql.conf.");
|
||||
|
||||
@@ -2254,8 +2254,8 @@ testRun(void)
|
||||
manifest = manifestNewInternal();
|
||||
manifest->pub.info = infoNew(NULL);
|
||||
manifest->pub.data.backupLabel = strNewZ(TEST_LABEL);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_95;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_95);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_11;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_11);
|
||||
manifest->pub.data.backupType = backupTypeFull;
|
||||
manifest->pub.data.backupTimestampStart = 1482182860;
|
||||
manifest->pub.data.backupTimestampCopyStart = 1482182861; // So file timestamps should be less than this
|
||||
@@ -2272,13 +2272,13 @@ testRun(void)
|
||||
|
||||
// PG_VERSION
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
|
||||
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
|
||||
manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 3, .timestamp = 1482182860,
|
||||
.checksumSha1 = "dd71038f3463f511ee7403dbcbc87195302d891c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_11_Z "\n");
|
||||
|
||||
// Store the file also to the encrypted repo
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_95_Z "\n",
|
||||
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_11_Z "\n",
|
||||
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS_ARCHIVE);
|
||||
|
||||
// pg_tblspc
|
||||
@@ -2321,7 +2321,7 @@ testRun(void)
|
||||
TEST_CIPHER_PASS_MANIFEST "\"\n\n" TEST_RESTORE_BACKUP_INFO_DB, .cipherType = cipherTypeAes256Cbc);
|
||||
|
||||
// Write archive.info to the encrypted repo
|
||||
InfoArchive *infoArchive = infoArchiveNew(PG_VERSION_95, 6569239123849665679, STRDEF(TEST_CIPHER_PASS_ARCHIVE));
|
||||
InfoArchive *infoArchive = infoArchiveNew(PG_VERSION_11, 6569239123849665679, STRDEF(TEST_CIPHER_PASS_ARCHIVE));
|
||||
infoArchiveSaveFile(
|
||||
infoArchive, storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE_STR, cipherTypeAes256Cbc, STRDEF(TEST_CIPHER_PASS));
|
||||
|
||||
@@ -2339,14 +2339,14 @@ testRun(void)
|
||||
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
|
||||
"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"
|
||||
" d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (3B, 100.00%%) checksum"
|
||||
" dd71038f3463f511ee7403dbcbc87195302d891c\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"
|
||||
"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 = 4B, file total = 1",
|
||||
"P00 INFO: restore size = 3B, file total = 1",
|
||||
TEST_PATH, TEST_PATH, TEST_PATH, TEST_PATH));
|
||||
|
||||
// Remove recovery.conf before file comparison since it will have a new timestamp. Make sure it existed, though.
|
||||
@@ -2355,7 +2355,7 @@ testRun(void)
|
||||
TEST_STORAGE_LIST(
|
||||
storagePg(), NULL,
|
||||
"./\n"
|
||||
"PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_VERSION {s=3, t=1482182860}\n"
|
||||
"global/\n"
|
||||
"pg_tblspc/\n",
|
||||
.level = storageInfoLevelBasic, .includeDot = true);
|
||||
@@ -2367,7 +2367,7 @@ testRun(void)
|
||||
HRN_INFO_PUT(storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE, TEST_RESTORE_BACKUP_INFO "\n" TEST_RESTORE_BACKUP_INFO_DB);
|
||||
|
||||
// Store archive.info to repo1 - repo1 will be selected because of the priority order
|
||||
infoArchive = infoArchiveNew(PG_VERSION_95, 6569239123849665679, NULL);
|
||||
infoArchive = infoArchiveNew(PG_VERSION_11, 6569239123849665679, NULL);
|
||||
infoArchiveSaveFile(infoArchive, storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE_STR, cipherTypeNone, NULL);
|
||||
|
||||
hrnCfgArgRawZ(argList, cfgOptTargetTimeline, "0xff");
|
||||
@@ -2375,7 +2375,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
cmdRestore(), FileMissingError,
|
||||
"unable to open missing file '" TEST_PATH "/repo/archive/test1/9.5-0/000000FF.history' for read");
|
||||
"unable to open missing file '" TEST_PATH "/repo/archive/test1/11-0/000000FF.history' for read");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("full restore with delta force");
|
||||
@@ -2416,7 +2416,7 @@ testRun(void)
|
||||
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), "size-mismatch", .modeFile = 0600);
|
||||
|
||||
// Overwrite PG_VERSION with bogus content that will not be detected by delta force because the time and size are the same
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, "BOG\n", .modeFile = 0600, .timeModified = 1482182860);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, "BG\n", .modeFile = 0600, .timeModified = 1482182860);
|
||||
|
||||
// Change destination of tablespace link
|
||||
THROW_ON_SYS_ERROR(
|
||||
@@ -2450,7 +2450,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.5_201510051");
|
||||
HRN_MANIFEST_PATH_ADD(manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1/PG_11_201809051");
|
||||
HRN_MANIFEST_LINK_ADD(
|
||||
manifest, .name = MANIFEST_TARGET_PGDATA "/" MANIFEST_TARGET_PGTBLSPC "/1", .destination = TEST_PATH "/ts/1");
|
||||
|
||||
@@ -2459,12 +2459,12 @@ 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 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
|
||||
manifest, .name = MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION, .size = 3,
|
||||
.timestamp = 1482182860, .checksumSha1 = "dd71038f3463f511ee7403dbcbc87195302d891c");
|
||||
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/" MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION,
|
||||
PG_VERSION_95_Z "\n");
|
||||
PG_VERSION_11_Z "\n");
|
||||
|
||||
// Always sort
|
||||
lstSort(manifest->pub.targetList, sortOrderAsc);
|
||||
@@ -2488,7 +2488,7 @@ 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.5_201510051' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_11_201809051' 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"
|
||||
@@ -2497,30 +2497,30 @@ testRun(void)
|
||||
"P00 DETAIL: remove special file '" TEST_PATH "/pg/pipe'\n"
|
||||
"P00 DETAIL: create symlink '" TEST_PATH "/pg/pg_tblspc/1' to '" TEST_PATH "/ts/1'\n"
|
||||
"P00 DETAIL: create path '" TEST_PATH "/pg/pg_tblspc/1/16384'\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.auto.conf (15B, 44.12%)"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.auto.conf (15B, 46.88%)"
|
||||
" checksum 37a0c84d42c3ec3d08c311cec2cef2a7ab55a7c3\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.conf (10B, 73.53%) checksum"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.conf (10B, 78.13%) 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 d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, 88.24%) checksum"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION - exists and matches size 3 and modification time 1482182860"
|
||||
" (3B, 87.50%) checksum dd71038f3463f511ee7403dbcbc87195302d891c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, 90.63%) checksum"
|
||||
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, 100.00%)"
|
||||
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (3B, 100.00%)"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\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.5_201510051'\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_11_201809051'\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 = 5");
|
||||
"P00 INFO: restore size = 32B, file total = 5");
|
||||
|
||||
TEST_STORAGE_LIST(
|
||||
storagePg(), NULL,
|
||||
"./\n"
|
||||
"PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_VERSION {s=3, t=1482182860}\n"
|
||||
"global/\n"
|
||||
"pg_tblspc/\n"
|
||||
"pg_tblspc/1> {d=" TEST_PATH "/ts/1}\n"
|
||||
@@ -2533,12 +2533,12 @@ testRun(void)
|
||||
storagePg(), "pg_tblspc/1",
|
||||
".> {d=" TEST_PATH "/ts/1}\n"
|
||||
"16384/\n"
|
||||
"16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_9.5_201510051/\n",
|
||||
"16384/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"PG_11_201809051/\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
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, "BOG\n", .comment = "check PG_VERSION was not restored");
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, "BG\n", .comment = "check PG_VERSION was not restored");
|
||||
|
||||
// Cleanup
|
||||
hrnCfgEnvKeyRemoveRaw(cfgOptRepoCipherPass, 2);
|
||||
@@ -2565,25 +2565,25 @@ 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.5_201510051' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_11_201809051' 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.5_201510051'\n"
|
||||
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/ts/1/PG_11_201809051'\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 d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (3B, [PCT]) checksum dd71038f3463f511ee7403dbcbc87195302d891c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, [PCT]) checksum"
|
||||
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, [PCT])"
|
||||
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (3B, [PCT])"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\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.5_201510051'\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_11_201809051'\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 = 5");
|
||||
@@ -2591,7 +2591,7 @@ testRun(void)
|
||||
TEST_STORAGE_LIST(
|
||||
storagePg(), NULL,
|
||||
"./\n"
|
||||
"PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_VERSION {s=3, t=1482182860}\n"
|
||||
"global/\n"
|
||||
"pg_tblspc/\n"
|
||||
"pg_tblspc/1> {d=" TEST_PATH "/ts/1}\n"
|
||||
@@ -2604,15 +2604,15 @@ testRun(void)
|
||||
storagePg(), "pg_tblspc/1",
|
||||
".> {d=" TEST_PATH "/ts/1}\n"
|
||||
"16384/\n"
|
||||
"16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_9.5_201510051/\n",
|
||||
"16384/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"PG_11_201809051/\n",
|
||||
.level = storageInfoLevelBasic, .includeDot = true);
|
||||
|
||||
// PG_VERSION was restored by the force option
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_95_Z "\n", .comment = "check PG_VERSION was restored");
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_11_Z "\n", .comment = "check PG_VERSION was restored");
|
||||
|
||||
// Remove tablespace
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.5_201510051", .recurse = true);
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_11_201809051", .recurse = true);
|
||||
|
||||
// Remove files
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "postgresql.conf");
|
||||
@@ -2693,8 +2693,8 @@ testRun(void)
|
||||
|
||||
// PG_VERSION
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 4, .sizeRepo = 4, .timestamp = 1482182860,
|
||||
.bundleId = 1, .checksumSha1 = "2fafe15172578a19dbc196723bca6a4a8ad70da8");
|
||||
manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 3, .sizeRepo = 3, .timestamp = 1482182860,
|
||||
.bundleId = 1, .checksumSha1 = "f5b7e6d36dc0113f61b36c700817d42b96f7b037");
|
||||
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA "yyy", .size = 3, .sizeRepo = 3, .timestamp = 1482182860, .bundleId = 1,
|
||||
@@ -2721,9 +2721,9 @@ testRun(void)
|
||||
|
||||
// base/1/PG_VERSION. File was written as part of bundle 1 above
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA "base/1/" PG_FILE_PGVERSION, .size = 4, .sizeRepo = 4,
|
||||
manifest, .name = TEST_PGDATA "base/1/" PG_FILE_PGVERSION, .size = 3, .sizeRepo = 3,
|
||||
.timestamp = 1482182860, .bundleId = 1, .bundleOffset = 4,
|
||||
.checksumSha1 = "2fafe15172578a19dbc196723bca6a4a8ad70da8");
|
||||
.checksumSha1 = "f5b7e6d36dc0113f61b36c700817d42b96f7b037");
|
||||
|
||||
// base/1/2
|
||||
fileBuffer = bufNew(8192);
|
||||
@@ -2774,9 +2774,9 @@ testRun(void)
|
||||
|
||||
// base/16384/PG_VERSION
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA "base/16384/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
|
||||
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
|
||||
manifest, .name = TEST_PGDATA "base/16384/" PG_FILE_PGVERSION, .size = 3, .timestamp = 1482182860,
|
||||
.checksumSha1 = "dd71038f3463f511ee7403dbcbc87195302d891c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_11_Z "\n");
|
||||
|
||||
// base/16384/16385
|
||||
fileBuffer = bufNew(16384);
|
||||
@@ -2794,9 +2794,9 @@ testRun(void)
|
||||
|
||||
// base/32768/PG_VERSION
|
||||
HRN_MANIFEST_FILE_ADD(
|
||||
manifest, .name = TEST_PGDATA "base/32768/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860,
|
||||
.checksumSha1 = "d3b57b066120b2abc25be3bac96c87cfc8d82a6c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_95_Z "\n");
|
||||
manifest, .name = TEST_PGDATA "base/32768/" PG_FILE_PGVERSION, .size = 3, .timestamp = 1482182860,
|
||||
.checksumSha1 = "dd71038f3463f511ee7403dbcbc87195302d891c");
|
||||
HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_11_Z "\n");
|
||||
|
||||
// base/32768/32769
|
||||
fileBuffer = bufNew(32768);
|
||||
@@ -2992,16 +2992,16 @@ testRun(void)
|
||||
" 98b8abb2e681e2a5a7d8ab082c0a79727887558d\n"
|
||||
"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 d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION (4B, [PCT])"
|
||||
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/32768/PG_VERSION (3B, [PCT])"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION (3B, [PCT])"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\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"
|
||||
" 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION (bundle 1/4, 4B, [PCT]) checksum"
|
||||
" 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (bundle 1/0, 3B, [PCT]) checksum"
|
||||
" f5b7e6d36dc0113f61b36c700817d42b96f7b037\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION (bundle 1/4, 3B, [PCT]) checksum"
|
||||
" f5b7e6d36dc0113f61b36c700817d42b96f7b037\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/yyy - exists and matches backup (bundle 1/8, 3B, [PCT]) checksum"
|
||||
" 186154712b2d5f6791d85b9a0987b98fa231779c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/xxxxx (bundle 1/11, 5B, [PCT]) checksum"
|
||||
@@ -3038,7 +3038,7 @@ testRun(void)
|
||||
TEST_STORAGE_LIST(
|
||||
storagePg(), NULL,
|
||||
"./\n"
|
||||
"PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_VERSION {s=3, t=1482182860}\n"
|
||||
"base/\n"
|
||||
"base/1/\n"
|
||||
"base/1/10 {s=8192, t=1482182860}\n"
|
||||
@@ -3047,15 +3047,15 @@ testRun(void)
|
||||
"base/1/21 {s=1, t=1482182860}\n"
|
||||
"base/1/30 {s=1, t=1482182860}\n"
|
||||
"base/1/31 {s=1, t=1482182860}\n"
|
||||
"base/1/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"base/1/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"base/1/bi-no-ref {s=24576, t=1482182860}\n"
|
||||
"base/1/bi-unused-ref {s=49152, t=1482182860}\n"
|
||||
"base/16384/\n"
|
||||
"base/16384/16385 {s=16384, t=1482182860}\n"
|
||||
"base/16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"base/16384/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"base/32768/\n"
|
||||
"base/32768/32769 {s=32768, t=1482182860}\n"
|
||||
"base/32768/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"base/32768/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"global/\n"
|
||||
"global/888 {s=0, t=1482182860}\n"
|
||||
"global/999 {s=0, t=1482182860}\n"
|
||||
@@ -3076,7 +3076,7 @@ testRun(void)
|
||||
storagePg(), "pg_tblspc/1",
|
||||
".> {d=" TEST_PATH "/ts/1}\n"
|
||||
"16384/\n"
|
||||
"16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"16384/PG_VERSION {s=3, t=1482182860}\n"
|
||||
"PG_10_201707211/\n",
|
||||
.level = storageInfoLevelBasic, .includeDot = true);
|
||||
|
||||
@@ -3119,7 +3119,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_95_Z "\n\n", .modeFile = 0600,
|
||||
storagePgWrite(), "base/16384/" PG_FILE_PGVERSION, PG_VERSION_11_Z "\n\n", .modeFile = 0600,
|
||||
.timeModified = 1482182860);
|
||||
|
||||
// Enlarge a zero-length file so it gets truncated
|
||||
@@ -3186,16 +3186,16 @@ testRun(void)
|
||||
" checksum 98b8abb2e681e2a5a7d8ab082c0a79727887558d\n"
|
||||
"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 d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION - exists and matches backup (4B, [PCT])"
|
||||
" checksum d3b57b066120b2abc25be3bac96c87cfc8d82a6c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/32768/PG_VERSION - exists and matches backup (3B, [PCT])"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/16384/PG_VERSION - exists and matches backup (3B, [PCT])"
|
||||
" checksum dd71038f3463f511ee7403dbcbc87195302d891c\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])"
|
||||
" checksum 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION - exists and matches backup (bundle 1/4, 4B, [PCT])"
|
||||
" checksum 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION - exists and matches backup (bundle 1/0, 3B, [PCT])"
|
||||
" checksum f5b7e6d36dc0113f61b36c700817d42b96f7b037\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION - exists and matches backup (bundle 1/4, 3B, [PCT])"
|
||||
" checksum f5b7e6d36dc0113f61b36c700817d42b96f7b037\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/yyy - exists and matches backup (bundle 1/8, 3B, [PCT]) checksum"
|
||||
" 186154712b2d5f6791d85b9a0987b98fa231779c\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/xxxxx - exists and matches backup (bundle 1/11, 5B, [PCT]) checksum"
|
||||
|
||||
@@ -424,25 +424,25 @@ testRun(void)
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=202506291\n"
|
||||
"db-control-version=1800\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_17_Z "\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":" HRN_PG_SYSTEMID_17_Z
|
||||
",\"db-version\":\"18\"}\n");
|
||||
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_17_Z "\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_17_Z ",\"db-version\":\"18\"}\n");
|
||||
|
||||
TEST_ERROR(
|
||||
cmdStanzaCreate(), FileInvalidError,
|
||||
@@ -563,10 +563,10 @@ testRun(void)
|
||||
TEST_TITLE("pgControl and database match");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_18);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, 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_95, TEST_PATH "/pg", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg", false, NULL, NULL));
|
||||
|
||||
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - db online");
|
||||
TEST_RESULT_LOG(
|
||||
@@ -598,7 +598,7 @@ testRun(void)
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_10);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL));
|
||||
|
||||
TEST_ERROR(
|
||||
pgValidate(), DbMismatchError,
|
||||
@@ -613,7 +613,7 @@ testRun(void)
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_15);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg2", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg2", false, NULL, NULL));
|
||||
|
||||
TEST_ERROR(
|
||||
pgValidate(), DbMismatchError,
|
||||
@@ -637,11 +637,11 @@ testRun(void)
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_13);
|
||||
|
||||
// Create pg_control for standby
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_13);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_13, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(2, "dbname='postgres' port=5434", PG_VERSION_13, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_13, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(2, "dbname='postgres' port=5434", PG_VERSION_13, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
PgControl pgControl = {0};
|
||||
TEST_ASSIGN(pgControl, pgValidate(), "validate primary on pg2");
|
||||
@@ -726,19 +726,19 @@ testRun(void)
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665999"
|
||||
",\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":6569239123849665999"
|
||||
",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.6\"}\n");
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_17_Z "\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_17_Z ",\"db-version\":\"18\"}\n");
|
||||
|
||||
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - archive.info file upgraded - version");
|
||||
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
|
||||
@@ -751,7 +751,7 @@ testRun(void)
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_17_Z ",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.6\"}\n",
|
||||
.comment = "put archive info to test file");
|
||||
|
||||
@@ -771,15 +771,15 @@ testRun(void)
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-catalog-version=202506291\n"
|
||||
"db-control-version=1800\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_17_Z "\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":" HRN_PG_SYSTEMID_17_Z
|
||||
",\"db-version\":\"18\"}\n");
|
||||
|
||||
TEST_RESULT_VOID(cmdStanzaUpgrade(), "stanza upgrade - backup.info file upgraded - version");
|
||||
TEST_RESULT_LOG("P00 INFO: stanza-upgrade for stanza 'db' on repo1");
|
||||
@@ -794,8 +794,8 @@ testRun(void)
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":" HRN_PG_SYSTEMID_17_Z
|
||||
",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.6\"}\n",
|
||||
.comment = "put backup info to test file");
|
||||
@@ -823,8 +823,8 @@ testRun(void)
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665999"
|
||||
",\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":6569239123849665999"
|
||||
",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z
|
||||
",\"db-version\":\"9.6\"}\n");
|
||||
HRN_INFO_PUT(
|
||||
|
||||
@@ -42,12 +42,12 @@ testRun(void)
|
||||
uint64_t fileSize = 7;
|
||||
const Buffer *fileChecksum = bufNewDecode(encodingHex, STRDEF("d1cd8a7d11daa26814b93eb604e1d49ab4b43770"));
|
||||
|
||||
#define TEST_BACKUP_DB1_95 \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
#define TEST_BACKUP_DB1_96 \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n" \
|
||||
"db-version=\"9.6\"\n"
|
||||
|
||||
#define TEST_BACKUP_DB2_11 \
|
||||
"db-catalog-version=201707211\n" \
|
||||
@@ -86,8 +86,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\":201510051,\"db-control-version\":942,\"db-system-id\":" HRN_PG_SYSTEMID_95_Z "," \
|
||||
"\"db-version\":\"9.5\"}"
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":" HRN_PG_SYSTEMID_96_Z "," \
|
||||
"\"db-version\":\"9.6\"}"
|
||||
|
||||
#define TEST_BACKUP_DB2_HISTORY \
|
||||
"2={\"db-catalog-version\":201707211,\"db-control-version\":1100,\"db-system-id\":" HRN_PG_SYSTEMID_11_Z "," \
|
||||
@@ -110,11 +110,11 @@ testRun(void)
|
||||
#define TEST_ARCHIVE_INFO_BASE \
|
||||
"[db]\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
|
||||
"db-version=\"9.5\"\n" \
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n" \
|
||||
"db-version=\"9.6\"\n" \
|
||||
"\n" \
|
||||
"[db:history]\n" \
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.6\"}"
|
||||
|
||||
#define TEST_ARCHIVE_INFO_MULTI_HISTORY_BASE \
|
||||
"[db]\n" \
|
||||
@@ -123,7 +123,7 @@ testRun(void)
|
||||
"db-version=\"11\"\n" \
|
||||
"\n" \
|
||||
"[db:history]\n" \
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n" \
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"9.6\"}\n" \
|
||||
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"
|
||||
|
||||
#define TEST_MANIFEST_HEADER \
|
||||
@@ -137,11 +137,11 @@ testRun(void)
|
||||
#define TEST_MANIFEST_DB_94 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n" \
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n" \
|
||||
"db-version=\"9.6\"\n"
|
||||
|
||||
#define TEST_MANIFEST_OPTION_ALL \
|
||||
"\n" \
|
||||
@@ -240,8 +240,8 @@ testRun(void)
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"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"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"10\"\n"
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
TEST_MANIFEST_TARGET
|
||||
TEST_MANIFEST_DB
|
||||
@@ -262,8 +262,8 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"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_95_Z ") is not in the backup.info history, skipping");
|
||||
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 10, system-id"
|
||||
" " HRN_PG_SYSTEMID_96_Z ") is not in the backup.info history, skipping");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("rerun test with db-system-id invalid and no main");
|
||||
@@ -274,11 +274,11 @@ testRun(void)
|
||||
TEST_MANIFEST_HEADER
|
||||
"\n"
|
||||
"[backup:db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=0\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
TEST_MANIFEST_TARGET
|
||||
TEST_MANIFEST_DB
|
||||
@@ -297,7 +297,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.5, system-id 0) is not in the"
|
||||
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.6, system-id 0) is not in the"
|
||||
" backup.info history, skipping");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -308,11 +308,11 @@ testRun(void)
|
||||
TEST_MANIFEST_HEADER
|
||||
"\n"
|
||||
"[backup:db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=0\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_95_Z "\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_96_Z "\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
TEST_MANIFEST_TARGET
|
||||
TEST_MANIFEST_DB
|
||||
@@ -331,8 +331,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.5, system-id"
|
||||
" " HRN_PG_SYSTEMID_95_Z ") is not in the backup.info history, skipping");
|
||||
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 0, version 9.6, system-id"
|
||||
" " HRN_PG_SYSTEMID_96_Z ") is not in the backup.info history, skipping");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("missing main manifest, errored copy");
|
||||
@@ -400,7 +400,7 @@ testRun(void)
|
||||
|
||||
VerifyArchiveResult archiveResult =
|
||||
{
|
||||
.archiveId = strNewZ("9.5-1"),
|
||||
.archiveId = strNewZ("9.6-1"),
|
||||
.walRangeList = lstNewP(sizeof(VerifyWalRange), .comparator = lstComparatorStr),
|
||||
};
|
||||
List *archiveIdResultList = lstNewP(sizeof(VerifyArchiveResult), .comparator = archiveIdComparator);
|
||||
@@ -411,7 +411,7 @@ testRun(void)
|
||||
TEST_TITLE("Single WAL");
|
||||
|
||||
archiveIdResult->pgWalInfo.size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT;
|
||||
archiveIdResult->pgWalInfo.version = PG_VERSION_95;
|
||||
archiveIdResult->pgWalInfo.version = PG_VERSION_18;
|
||||
|
||||
strLstAddZ(walFileList, "000000020000000200000000-daa497dba64008db824607940609ba1cd7c6c501.gz");
|
||||
|
||||
@@ -436,7 +436,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.5-1' exists, skipping");
|
||||
TEST_RESULT_LOG("P00 INFO: duplicate WAL '000000020000000200000000' for '9.6-1' exists, skipping");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("duplicates at beginning and end of list are removed");
|
||||
@@ -463,8 +463,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.5-1' exists, skipping\n"
|
||||
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.5-1' exists, skipping");
|
||||
"P00 INFO: duplicate WAL '000000020000000100000000' for '9.6-1' exists, skipping\n"
|
||||
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.6-1' exists, skipping");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
@@ -513,7 +513,7 @@ testRun(void)
|
||||
"db-version=\"11\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":6625592122879095777,\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-id\":6625592122879095777,\"db-version\":\"9.6\"}\n"
|
||||
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
|
||||
"archive.info history system id mismatch");
|
||||
|
||||
@@ -535,7 +535,7 @@ testRun(void)
|
||||
"db-version=\"11\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.6\"}\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"18\"}\n"
|
||||
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
|
||||
"archive.info history version mismatch");
|
||||
|
||||
@@ -557,7 +557,7 @@ testRun(void)
|
||||
"db-version=\"11\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"3={\"db-id\":" HRN_PG_SYSTEMID_95_Z ",\"db-version\":\"9.5\"}\n"
|
||||
"3={\"db-id\":" HRN_PG_SYSTEMID_96_Z ",\"db-version\":\"10\"}\n"
|
||||
"2={\"db-id\":" HRN_PG_SYSTEMID_11_Z ",\"db-version\":\"11\"}"))),
|
||||
"archive.info history id mismatch");
|
||||
|
||||
@@ -586,7 +586,7 @@ testRun(void)
|
||||
strLstAddZ(backupList, "20181119-152138F");
|
||||
strLstAddZ(backupList, "20181119-152900F");
|
||||
StringList *archiveIdList = strLstComparatorSet(strLstNew(), archiveIdComparator);
|
||||
strLstAddZ(archiveIdList, "9.5-1");
|
||||
strLstAddZ(archiveIdList, "9.6-1");
|
||||
strLstAddZ(archiveIdList, "11-2");
|
||||
|
||||
unsigned int errTotal = 0;
|
||||
@@ -727,7 +727,7 @@ testRun(void)
|
||||
TEST_BACKUP_DB1_CURRENT_FULL1
|
||||
"\n"
|
||||
"[db]\n"
|
||||
TEST_BACKUP_DB1_95
|
||||
TEST_BACKUP_DB1_96
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
TEST_BACKUP_DB1_HISTORY,
|
||||
@@ -788,7 +788,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.5, system-id = 10000000000000090500\n"
|
||||
" archive: id = 1, version = 9.6, system-id = 10000000000000090600\n"
|
||||
" backup : id = 2, version = 11, system-id = 10000000000000110000\n"
|
||||
" HINT: this may be a symptom of repository corruption!");
|
||||
|
||||
@@ -977,7 +977,7 @@ testRun(void)
|
||||
.comment = "remove duplicate WAL");
|
||||
|
||||
HRN_STORAGE_PATH_CREATE(
|
||||
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.5-1", .comment = "empty path for old archiveId");
|
||||
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.6-1", .comment = "empty path for old archiveId");
|
||||
HRN_STORAGE_PATH_CREATE(
|
||||
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/11-2/0000000100000000", .comment = "empty timeline path");
|
||||
|
||||
@@ -1008,7 +1008,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.5-1' is empty\n"
|
||||
"P00 DETAIL: archive path '9.6-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"
|
||||
@@ -1029,7 +1029,7 @@ testRun(void)
|
||||
verifyProcess(cfgOptionBool(cfgOptVerbose)),
|
||||
"stanza: db\n"
|
||||
"status: error\n"
|
||||
" archiveId: 9.5-1, total WAL checked: 0, total valid WAL: 0\n"
|
||||
" archiveId: 9.6-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",
|
||||
@@ -1051,7 +1051,7 @@ testRun(void)
|
||||
verifyProcess(cfgOptionBool(cfgOptVerbose)),
|
||||
"stanza: db\n"
|
||||
"status: error\n"
|
||||
" archiveId: 9.5-1, total WAL checked: 0, total valid WAL: 0\n"
|
||||
" archiveId: 9.6-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");
|
||||
@@ -1267,7 +1267,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.5-1' is empty\n"
|
||||
"P00 DETAIL: archive path '9.6-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"
|
||||
@@ -2295,7 +2295,7 @@ testRun(void)
|
||||
hrnBackupPqScriptP(PG_VERSION_11, BACKUP_EPOCH);
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D944C000000000, lsn = 5d944c0/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105D944BF000000FF\n"
|
||||
"P00 DETAIL: store zero-length file " TEST_PATH "/pg1/postgresql.auto.conf\n"
|
||||
@@ -2303,7 +2303,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/base/1/44 (bundle 1/10, 16KB, 5.71%) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/base/1/2 (bundle 1/68, 256KB, 97.14%) checksum [SHA1]\n"
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/544, 8KB, 100.00%) checksum [SHA1]\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D944C000000000, lsn = 5d944c0/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105D944C000000000:0000000105D944C000000000\n"
|
||||
@@ -2333,7 +2333,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(hrnCmdBackup(), "backup");
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: last backup label = 20191002-070640F, version = " PROJECT_VERSION "\n"
|
||||
"P00 INFO: execute non-exclusive backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: execute backup start: backup begins after the next regular checkpoint completes\n"
|
||||
"P00 INFO: backup start archive = 0000000105D95D3000000000, lsn = 5d95d30/0\n"
|
||||
"P00 INFO: check archive for prior segment 0000000105D95D2F000000FF\n"
|
||||
"P00 DETAIL: store zero-length file " TEST_PATH "/pg1/postgresql.auto.conf\n"
|
||||
@@ -2341,7 +2341,7 @@ testRun(void)
|
||||
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (bundle 1/237, 8KB, 100.00%) checksum [SHA1]\n"
|
||||
"P00 DETAIL: reference pg_data/PG_VERSION to 20191002-070640F\n"
|
||||
"P00 DETAIL: reference pg_data/base/1/44 to 20191002-070640F\n"
|
||||
"P00 INFO: execute non-exclusive backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: execute backup stop and wait for all WAL segments to archive\n"
|
||||
"P00 INFO: backup stop archive = 0000000105D95D3000000000, lsn = 5d95d30/800000\n"
|
||||
"P00 DETAIL: wrote 'backup_label' file returned from backup stop function\n"
|
||||
"P00 INFO: check archive for segment(s) 0000000105D95D3000000000:0000000105D95D3000000000\n"
|
||||
|
||||
@@ -104,8 +104,14 @@ testRun(void)
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 1, "/repo1");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptRepoRetentionFull, 1, "1");
|
||||
hrnCfgArgKeyRawZ(argList, cfgOptPgPath, 1, "/pg1");
|
||||
hrnCfgArgRawBool(argList, cfgOptStopAuto, true);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: option 'stop-auto' is deprecated\n"
|
||||
" HINT: all supported versions use non-exclusive backup.\n"
|
||||
" HINT: stop using this option to avoid an error when it is removed.");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("local default repo paths for cifs repo type must be different");
|
||||
|
||||
|
||||
+61
-141
@@ -80,12 +80,12 @@ testRun(void)
|
||||
|
||||
// Set script
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='testdb' port=5432", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='testdb' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1),
|
||||
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='testdb' port=5432", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='testdb' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(1, "2/3"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(1, "xlog", "000000030000000200000003"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(1, "wal", "000000030000000200000003"),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
// Create server
|
||||
@@ -119,7 +119,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create control file
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_15);
|
||||
|
||||
// Create client
|
||||
ProtocolClient *client = NULL;
|
||||
@@ -193,14 +193,14 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create control file
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95, .checkpoint = pgLsnFromStr(STRDEF("1/1")));
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_18, .checkpoint = pgLsnFromStr(STRDEF("1/1")));
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error when unable to select any pg_settings");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='backupdb' port=5432"),
|
||||
HRN_PQ_SCRIPT_CONNECT(1, "dbname='backupdb' port=5432"),
|
||||
HRN_PQ_SCRIPT_SET_SEARCH_PATH(1),
|
||||
HRN_PQ_SCRIPT_SET_CLIENT_ENCODING(1),
|
||||
|
||||
@@ -247,13 +247,13 @@ testRun(void)
|
||||
" HINT: is the pg_read_all_settings role assigned for PostgreSQL >= 10?");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.5 start/stop backup");
|
||||
TEST_TITLE("PostgreSQL 9.6 start/stop backup");
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95, .checkpoint = pgLsnFromStr(STRDEF("2/3")));
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_96, .checkpoint = pgLsnFromStr(STRDEF("3/3")));
|
||||
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='backupdb' port=5432", PG_VERSION_96, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
DbGetResult db = {0};
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
@@ -262,24 +262,33 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_TIME_QUERY(1, 1000));
|
||||
TEST_RESULT_UINT(dbTimeMSec(db.primary), 1000, "check time");
|
||||
|
||||
// Start backup errors on advisory lock
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_ADVISORY_LOCK(1, false));
|
||||
// Start backup with timeline error
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000020000000300000002"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "3/3", "000000020000000300000003"));
|
||||
|
||||
TEST_ERROR(
|
||||
dbBackupStart(db.primary, false, false, false), LockAcquireError,
|
||||
"unable to acquire pgBackRest advisory lock\n"
|
||||
"HINT: is another pgBackRest backup already running on this cluster?");
|
||||
dbBackupStart(db.primary, false, true), DbMismatchError, "WAL timeline 2 does not match pg_control timeline 1");
|
||||
|
||||
// Start backup with checkpoint error
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000010000000400000003"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "4/4", "000000010000000400000004"));
|
||||
|
||||
TEST_ERROR(
|
||||
dbBackupStart(db.primary, false, true), DbMismatchError,
|
||||
"current checkpoint '3/3' is less than backup start '4/4'");
|
||||
|
||||
// Start backup
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_ADVISORY_LOCK(1, true),
|
||||
HRN_PQ_SCRIPT_IS_IN_BACKUP(1, false),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_LE_95(1, false, "2/3", "000000010000000200000003"));
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000010000000300000002"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "3/3", "000000010000000300000003"));
|
||||
|
||||
DbBackupStartResult backupStartResult = {0};
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true, false), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "2/3", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentName, "000000010000000200000003", "check wal segment name");
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "3/3", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentName, "000000010000000300000003", "check wal segment name");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentCheck, "000000010000000300000002", "check wal segment check");
|
||||
|
||||
// Get database list
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_DATABASE_LIST_1(1, "test1"));
|
||||
@@ -289,97 +298,10 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_TABLESPACE_LIST_0(1));
|
||||
TEST_RESULT_STR_Z(hrnPackToStr(dbTablespaceList(db.primary)), "", "check tablespace list");
|
||||
|
||||
// Stop backup
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_STOP_BACKUP_LE_95(1, "2/4", "000000010000000200000004"));
|
||||
|
||||
DbBackupStopResult backupStopResult = {.lsn = NULL};
|
||||
TEST_ASSIGN(backupStopResult, dbBackupStop(db.primary), "stop backup");
|
||||
TEST_RESULT_STR_Z(backupStopResult.lsn, "2/4", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStopResult.walSegmentName, "000000010000000200000004", "check wal segment name");
|
||||
TEST_RESULT_STR_Z(backupStopResult.backupLabel, NULL, "check backup label is not set");
|
||||
TEST_RESULT_STR_Z(backupStopResult.tablespaceMap, NULL, "check tablespace map is not set");
|
||||
|
||||
// Close primary
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_CLOSE(1));
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.5 start/stop backup where backup is in progress");
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95, .checkpoint = pgLsnFromStr(STRDEF("2/5")));
|
||||
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
|
||||
// Start backup when backup is in progress
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_ADVISORY_LOCK(1, true),
|
||||
HRN_PQ_SCRIPT_IS_IN_BACKUP(1, true),
|
||||
|
||||
// Stop old backup
|
||||
HRN_PQ_SCRIPT_STOP_BACKUP_LE_95(1, "1/1", "000000010000000100000001"),
|
||||
|
||||
// Start backup
|
||||
HRN_PQ_SCRIPT_START_BACKUP_LE_95(1, true, "2/5", "000000010000000200000005"));
|
||||
|
||||
TEST_RESULT_STR_Z(dbBackupStart(db.primary, true, true, false).lsn, "2/5", "start backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: the cluster is already in backup mode but no pgBackRest backup process is running."
|
||||
" pg_stop_backup() will be called so a new backup can be started.");
|
||||
|
||||
// Stop backup
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_STOP_BACKUP_LE_95(1, "2/6", "000000010000000200000006"));
|
||||
TEST_RESULT_STR_Z(dbBackupStop(db.primary).lsn, "2/6", "stop backup");
|
||||
|
||||
// Close primary
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_CLOSE(1));
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.6 start/stop backup");
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_96, .checkpoint = pgLsnFromStr(STRDEF("3/3")));
|
||||
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='backupdb' port=5432", PG_VERSION_96, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
|
||||
// Start backup with timeline error
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000020000000300000002"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "3/3", "000000020000000300000003"));
|
||||
|
||||
TEST_ERROR(
|
||||
dbBackupStart(db.primary, false, true, true), DbMismatchError, "WAL timeline 2 does not match pg_control timeline 1");
|
||||
|
||||
// Start backup with checkpoint error
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000010000000400000003"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "4/4", "000000010000000400000004"));
|
||||
|
||||
TEST_ERROR(
|
||||
dbBackupStart(db.primary, false, true, true), DbMismatchError,
|
||||
"current checkpoint '3/3' is less than backup start '4/4'");
|
||||
|
||||
// Start backup
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_LE_96(1, "000000010000000300000002"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_96(1, false, "3/3", "000000010000000300000003"));
|
||||
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true, true), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "3/3", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentName, "000000010000000300000003", "check wal segment name");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentCheck, "000000010000000300000002", "check wal segment check");
|
||||
|
||||
// Stop backup
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_STOP_BACKUP_96(1, "3/4", "000000010000000300000004", false));
|
||||
|
||||
DbBackupStopResult backupStopResult = {.lsn = NULL};
|
||||
TEST_ASSIGN(backupStopResult, dbBackupStop(db.primary), "stop backup");
|
||||
TEST_RESULT_STR_Z(backupStopResult.lsn, "3/4", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStopResult.walSegmentName, "000000010000000300000004", "check wal segment name");
|
||||
@@ -391,7 +313,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.5 start backup from standby");
|
||||
TEST_TITLE("PostgreSQL 12 start backup from standby");
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
@@ -402,25 +324,24 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create control file
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95, .timeline = 5, .checkpoint = pgLsnFromStr(STRDEF("5/4")));
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_95, .timeline = 5, .checkpoint = pgLsnFromStr(STRDEF("5/4")));
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_12, .timeline = 5, .checkpoint = pgLsnFromStr(STRDEF("5/4")));
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_12, .timeline = 5, .checkpoint = pgLsnFromStr(STRDEF("5/4")));
|
||||
|
||||
// Connect to primary and standby
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(2, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH "/pg2", true, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(2, "dbname='postgres' port=5433", PG_VERSION_12, TEST_PATH "/pg2", true, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(false, true, CFGOPTVAL_BACKUP_STANDBY_Y), "get primary and standby");
|
||||
|
||||
// Start backup
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_ADVISORY_LOCK(1, true),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_LE_95(1, false, "5/4", "000000050000000500000004"));
|
||||
HRN_PQ_SCRIPT_START_BACKUP_GE_10(1, true, "5/4", "000000050000000500000004"));
|
||||
|
||||
TEST_RESULT_STR_Z(dbBackupStart(db.primary, false, false, false).lsn, "5/4", "start backup");
|
||||
TEST_RESULT_STR_Z(dbBackupStart(db.primary, true, false).lsn, "5/4", "start backup");
|
||||
|
||||
// Wait for standby to sync
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_REPLAY_WAIT_LE_95(2, "5/4"));
|
||||
HRN_PQ_SCRIPT_SET(HRN_PQ_SCRIPT_REPLAY_WAIT_GE_10(2, "5/4"));
|
||||
|
||||
TEST_RESULT_VOID(dbReplayWait(db.standby, STRDEF("5/4"), dbPgControl(db.primary).timeline, 1000), "sync standby");
|
||||
|
||||
@@ -468,8 +389,8 @@ testRun(void)
|
||||
|
||||
// Connect to primary and standby
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(2, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH "/pg2", true, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(2, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH "/pg2", true, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(false, true, CFGOPTVAL_BACKUP_STANDBY_Y), "get primary and standby");
|
||||
|
||||
@@ -485,7 +406,7 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(1, "5/5"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(1, "wal", "000000050000000500000005"));
|
||||
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, false, true), "start backup");
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "5/5", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentName, "000000050000000500000005", "check wal segment name");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentCheck, "000000050000000500000005", "check wal segment check");
|
||||
@@ -595,7 +516,7 @@ testRun(void)
|
||||
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_14, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_14, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
|
||||
@@ -604,7 +525,7 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_GE_10(1, "000000050000000500000004"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_GE_10(1, false, "5/5", "000000050000000500000005"));
|
||||
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, false, true), "start backup");
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true), "start backup");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 WARN: start-fast is disabled and db-timeout (299s) is smaller than the PostgreSQL checkpoint_timeout (300s) -"
|
||||
@@ -627,7 +548,7 @@ testRun(void)
|
||||
|
||||
// Connect to primary
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg1", false, NULL, NULL));
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary");
|
||||
|
||||
@@ -636,7 +557,7 @@ testRun(void)
|
||||
HRN_PQ_SCRIPT_CURRENT_WAL_GE_10(1, "000000060000000600000005"),
|
||||
HRN_PQ_SCRIPT_START_BACKUP_GE_15(1, false, "6/6", "000000060000000600000006"));
|
||||
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, false, true), "start backup");
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, true), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "6/6", "check lsn");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentName, "000000060000000600000006", "check wal segment name");
|
||||
TEST_RESULT_STR_Z(backupStartResult.walSegmentCheck, "000000060000000600000005", "check wal segment check");
|
||||
@@ -669,7 +590,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create control file
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_18);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error connecting to primary");
|
||||
@@ -692,7 +613,7 @@ testRun(void)
|
||||
TEST_TITLE("only available cluster is a standby");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_95, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_18, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ERROR(
|
||||
@@ -704,8 +625,7 @@ testRun(void)
|
||||
TEST_TITLE("standby cluster required but not found");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(
|
||||
1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_95, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_18, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ERROR(
|
||||
@@ -715,8 +635,8 @@ testRun(void)
|
||||
TEST_TITLE("primary cluster found");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(
|
||||
1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(
|
||||
1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
|
||||
TEST_ASSIGN(result, dbGet(true, true, CFGOPTVAL_BACKUP_STANDBY_N), "get primary only");
|
||||
@@ -725,7 +645,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_95, "version set");
|
||||
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_18, "version set");
|
||||
TEST_RESULT_STR_Z(dbPgDataPath(result.primary), TEST_PATH "/pg1", "path set");
|
||||
|
||||
TEST_RESULT_VOID(dbFree(result.primary), "free primary");
|
||||
@@ -742,11 +662,11 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
// Create control file
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_95);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_18);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_93(8, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_18, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(1),
|
||||
HRN_PQ_SCRIPT_CLOSE(8));
|
||||
@@ -757,8 +677,8 @@ testRun(void)
|
||||
TEST_TITLE("two standbys found but no primary");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_18, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_18, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -772,8 +692,8 @@ testRun(void)
|
||||
TEST_TITLE("two standbys and primary not required");
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CLOSE(8),
|
||||
HRN_PQ_SCRIPT_CLOSE(1));
|
||||
@@ -804,7 +724,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
|
||||
// pg4 error
|
||||
{.session = 4, .function = HRN_PQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
|
||||
@@ -812,7 +732,7 @@ testRun(void)
|
||||
{.session = 4, .function = HRN_PQ_ERRORMESSAGE, .resultZ = "error"},
|
||||
{.session = 4, .function = HRN_PQ_FINISH},
|
||||
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(8, "dbname='postgres' port=5434", PG_VERSION_12, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(8, "dbname='postgres' port=5434", PG_VERSION_12, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRN_PQ_SCRIPT_CREATE_RESTORE_POINT(8, "2/3"),
|
||||
HRN_PQ_SCRIPT_WAL_SWITCH(8, "wal", "000000010000000200000003"),
|
||||
@@ -851,7 +771,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
HRN_PQ_SCRIPT_SET(
|
||||
HRN_PQ_SCRIPT_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRN_PQ_SCRIPT_OPEN(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// pg4 error
|
||||
{.session = 4, .function = HRN_PQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
|
||||
|
||||
@@ -28,10 +28,10 @@ testRun(void)
|
||||
"[db]\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=6569239123849665679\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.6\"}\n");
|
||||
|
||||
InfoArchive *info = NULL;
|
||||
|
||||
@@ -43,7 +43,7 @@ testRun(void)
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
TEST_RESULT_STR_Z(infoArchiveId(info), "9.5-1", "archiveId set");
|
||||
TEST_RESULT_STR_Z(infoArchiveId(info), "9.6-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_95, 6569239123849665679, NULL), "infoArchiveNew() - no sub cipher");
|
||||
TEST_RESULT_STR_Z(infoArchiveId(info), "9.5-1", "archiveId set");
|
||||
info, infoArchiveNew(PG_VERSION_96, 6569239123849665679, NULL), "infoArchiveNew() - no sub cipher");
|
||||
TEST_RESULT_STR_Z(infoArchiveId(info), "9.6-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_95, 6569239123849665679), "add another infoPg");
|
||||
TEST_RESULT_VOID(infoArchivePgSet(info, PG_VERSION_96, 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_95, "version set");
|
||||
TEST_RESULT_INT(infoPgData.version, PG_VERSION_96, "version set");
|
||||
TEST_RESULT_UINT(infoPgData.systemId, 6569239123849665679, "systemId set");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -127,12 +127,12 @@ testRun(void)
|
||||
TEST_RESULT_STR_Z(infoArchiveIdHistoryMatch(info, 2, 90600, 6625592122879095702), "9.6-1", "partial match found");
|
||||
|
||||
TEST_ERROR(
|
||||
infoArchiveIdHistoryMatch(info, 2, 90500, 6625592122879095799), ArchiveMismatchError,
|
||||
"unable to retrieve the archive id for database version '9.5' and system-id '6625592122879095799'");
|
||||
infoArchiveIdHistoryMatch(info, 2, 90600, 6625592122879095799), ArchiveMismatchError,
|
||||
"unable to retrieve the archive id for database version '9.6' and system-id '6625592122879095799'");
|
||||
|
||||
TEST_ERROR(
|
||||
infoArchiveIdHistoryMatch(info, 2, 90500, 6626363367545678089), ArchiveMismatchError,
|
||||
"unable to retrieve the archive id for database version '9.5' and system-id '6626363367545678089'");
|
||||
infoArchiveIdHistoryMatch(info, 2, 90600, 6626363367545678089), ArchiveMismatchError,
|
||||
"unable to retrieve the archive id for database version '9.6' and system-id '6626363367545678089'");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
||||
@@ -28,18 +28,18 @@ testRun(void)
|
||||
// File with section to ignore
|
||||
const Buffer *contentLoad = harnessInfoChecksumZ(
|
||||
"[db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=6569239123849665679\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[ignore-section]\n"
|
||||
"key1=\"value1\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.6\"}\n");
|
||||
|
||||
InfoBackup *infoBackup = NULL;
|
||||
|
||||
@@ -63,7 +63,7 @@ testRun(void)
|
||||
Buffer *contentCompare = bufNew(0);
|
||||
|
||||
TEST_ASSIGN(
|
||||
infoBackup, infoBackupNew(PG_VERSION_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95), NULL),
|
||||
infoBackup, infoBackupNew(PG_VERSION_96, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_96), 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_95, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_95)),
|
||||
infoBackupPgSet(infoBackup, PG_VERSION_96, 6569239123849665679, hrnPgCatalogVersion(PG_VERSION_96)),
|
||||
"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_95, "version set");
|
||||
TEST_RESULT_INT(infoPgData.version, PG_VERSION_96, "version set");
|
||||
TEST_RESULT_UINT(infoPgData.systemId, 6569239123849665679, "systemId set");
|
||||
TEST_RESULT_UINT(infoPgData.catalogVersion, 201510051, "catalogVersion set");
|
||||
TEST_RESULT_UINT(infoPgData.catalogVersion, 201608131, "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=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=6569239123849665679\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.6\"}\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=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=6569239123849665679\n" \
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
|
||||
#define TEST_MANIFEST_FILE_DEFAULT \
|
||||
"\n" \
|
||||
@@ -942,15 +942,15 @@ testRun(void)
|
||||
"\"option-online\":true}\n"
|
||||
"\n"
|
||||
"[db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=6569239123849665679\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.5\"}\n");
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":960,\"db-system-id\":6569239123849665679"
|
||||
",\"db-version\":\"9.6\"}\n");
|
||||
|
||||
InfoBackup *infoBackup;
|
||||
StringList *dependencyList;
|
||||
|
||||
@@ -50,26 +50,26 @@ testRun(void)
|
||||
TEST_ASSIGN(
|
||||
infoPg,
|
||||
infoPgSet(
|
||||
infoPgNew(infoPgArchive, NULL), infoPgArchive, PG_VERSION_95, 6569239123849665679,
|
||||
hrnPgCatalogVersion(PG_VERSION_95)),
|
||||
infoPgNew(infoPgArchive, NULL), infoPgArchive, PG_VERSION_18, 6569239123849665679,
|
||||
hrnPgCatalogVersion(PG_VERSION_18)),
|
||||
"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_95, " version set");
|
||||
TEST_RESULT_UINT(pgData.version, PG_VERSION_18, " version set");
|
||||
TEST_RESULT_UINT(pgData.catalogVersion, 0, " catalog version not set for archive");
|
||||
|
||||
TEST_ASSIGN(
|
||||
infoPg, infoPgSet(infoPg, infoPgArchive, PG_VERSION_95, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_95)),
|
||||
infoPg, infoPgSet(infoPg, infoPgArchive, PG_VERSION_18, 6569239123849665999, hrnPgCatalogVersion(PG_VERSION_18)),
|
||||
"infoPgSet - infoPgArchive second db");
|
||||
TEST_RESULT_INT(infoPgDataTotal(infoPg), 2, " 2 history");
|
||||
TEST_RESULT_INT(infoPgDataCurrentId(infoPg), 0, " 0 historyCurrent");
|
||||
pgData = infoPgData(infoPg, infoPgDataCurrentId(infoPg));
|
||||
TEST_RESULT_INT(pgData.id, 2, " current id updated");
|
||||
TEST_RESULT_UINT(pgData.systemId, 6569239123849665999, " system-id updated");
|
||||
TEST_RESULT_UINT(pgData.version, PG_VERSION_95, " version updated");
|
||||
TEST_RESULT_UINT(pgData.version, PG_VERSION_18, " version updated");
|
||||
TEST_RESULT_UINT(pgData.catalogVersion, 0, " catalog version not set for archive");
|
||||
TEST_RESULT_STR(infoCipherPass(infoPgInfo(infoPg)), NULL, " cipherPass not set");
|
||||
|
||||
@@ -77,16 +77,16 @@ testRun(void)
|
||||
TEST_ASSIGN(
|
||||
infoPg,
|
||||
infoPgSet(
|
||||
infoPgNew(infoPgBackup, STRDEF("123xyz")), infoPgBackup, PG_VERSION_95, 6569239123849665679,
|
||||
hrnPgCatalogVersion(PG_VERSION_95)),
|
||||
infoPgNew(infoPgBackup, STRDEF("123xyz")), infoPgBackup, PG_VERSION_18, 6569239123849665679,
|
||||
hrnPgCatalogVersion(PG_VERSION_18)),
|
||||
"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_95, " version set");
|
||||
TEST_RESULT_UINT(pgData.catalogVersion, 201510051, " catalog version updated");
|
||||
TEST_RESULT_UINT(pgData.version, PG_VERSION_18, " version set");
|
||||
TEST_RESULT_UINT(pgData.catalogVersion, 202506291, " 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.5\"\n"
|
||||
"db-version=\"18\"\n"
|
||||
"\n"
|
||||
"[db:backup]\n"
|
||||
"key=\"value\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":6569239123849665679,\"db-version\":\"9.5\"}\n"
|
||||
"1={\"db-id\":6569239123849665679,\"db-version\":\"18\"}\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_95, " version set");
|
||||
TEST_RESULT_UINT(pgData.version, PG_VERSION_18, " 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.5-1", " check pg archive id");
|
||||
TEST_RESULT_STR_Z(infoPgArchiveId(infoPg, 0), "18-1", " check pg archive id");
|
||||
TEST_RESULT_STR(infoPgCipherPass(infoPg), NULL, " no cipher passphrase");
|
||||
|
||||
Buffer *contentSave = bufNew(0);
|
||||
@@ -144,19 +144,19 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
#define CONTENT_DB \
|
||||
"[db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=202506291\n" \
|
||||
"db-control-version=1800\n" \
|
||||
"db-id=2\n" \
|
||||
"db-system-id=6365925855999999999\n" \
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"18\"\n"
|
||||
|
||||
#define CONTENT_DB_HISTORY \
|
||||
"\n" \
|
||||
"[db:history]\n" \
|
||||
"1={\"db-catalog-version\":20081101,\"db-control-version\":730,\"db-system-id\":6569239123849665679," \
|
||||
"\"db-version\":\"7.3\"}\n" \
|
||||
"2={\"db-catalog-version\":201510051,\"db-control-version\":942,\"db-system-id\":6365925855999999999," \
|
||||
"\"db-version\":\"9.5\"}\n"
|
||||
"2={\"db-catalog-version\":202506291,\"db-control-version\":1800,\"db-system-id\":6365925855999999999," \
|
||||
"\"db-version\":\"18\"}\n"
|
||||
|
||||
contentLoad = harnessInfoChecksumZ(
|
||||
CONTENT_DB
|
||||
@@ -174,7 +174,7 @@ testRun(void)
|
||||
|
||||
pgData = infoPgDataCurrent(infoPg);
|
||||
TEST_RESULT_INT(pgData.id, 2, " id set");
|
||||
TEST_RESULT_INT(pgData.version, PG_VERSION_95, " version set");
|
||||
TEST_RESULT_INT(pgData.version, PG_VERSION_18, " version set");
|
||||
TEST_RESULT_UINT(pgData.systemId, 6365925855999999999, " system-id set");
|
||||
|
||||
pgData = infoPgData(infoPg, 1);
|
||||
|
||||
@@ -70,11 +70,11 @@ testRun(void)
|
||||
#define TEST_MANIFEST_DB_94 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=0\n" \
|
||||
"db-system-id=0\n" \
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\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.5");
|
||||
TEST_TITLE("manifest with all features - 9.6");
|
||||
|
||||
// Version
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.5\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.6\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.5_201510051/1", .mode = 0700);
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.6_201608131/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.5_201510051/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.6_201608131/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.5_201510051/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.6_201608131/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_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, exclusionList,
|
||||
storagePg, PG_VERSION_96, hrnPgCatalogVersion(PG_VERSION_96), 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_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL,
|
||||
storagePg, PG_VERSION_96, hrnPgCatalogVersion(PG_VERSION_96), 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.5_201510051/1/16384={\"size\":8,\"timestamp\":1565282115}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131/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.5_201510051={}\n"
|
||||
"pg_tblspc/1/PG_9.5_201510051/1={}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131={}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131/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.5_201510051", .recurse = true);
|
||||
HRN_STORAGE_PATH_REMOVE(storageTest,"ts/1/PG_9.6_201608131", .recurse = true);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("manifest with all features - 9.5, online");
|
||||
TEST_TITLE("manifest with all features - 9.6, 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.5
|
||||
// Files to conditionally ignore before 9.6
|
||||
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_95, hrnPgCatalogVersion(PG_VERSION_95), 0, true, false, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_96, hrnPgCatalogVersion(PG_VERSION_96), 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.5, checksum-page");
|
||||
TEST_TITLE("manifest with all features - 9.6, checksum-page");
|
||||
|
||||
// Version
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.5\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.6\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.5_201510051/1", .mode = 0700);
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.6_201608131/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.5_201510051/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
storagePgWrite, "pg_tblspc/1/PG_9.6_201608131/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storagePgWrite, "pg_tblspc/1/PG_9.5_201510051/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
|
||||
storagePgWrite, "pg_tblspc/1/PG_9.6_201608131/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.5_201510051/1/" PG_FILE_PGVERSION, .modeFile = 0600, .timeModified = 1565282120);
|
||||
storagePgWrite, "pg_tblspc/1/PG_9.6_201608131/1/" PG_FILE_PGVERSION, .modeFile = 0600, .timeModified = 1565282120);
|
||||
|
||||
// Tablespace 2
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "ts/2/PG_9.5_201510051/1", .mode = 0700);
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "ts/2/PG_9.6_201608131/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.5_201510051/1/16385", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
storagePgWrite, "pg_tblspc/2/PG_9.6_201608131/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_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, true, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_96, hrnPgCatalogVersion(PG_VERSION_96), 0, false, true, false, false, NULL, NULL, NULL),
|
||||
"build manifest");
|
||||
|
||||
contentSave = bufNew(0);
|
||||
@@ -564,7 +564,6 @@ testRun(void)
|
||||
"\n"
|
||||
"[target:file]\n"
|
||||
"pg_data/PG_VERSION={\"size\":4,\"timestamp\":1565282100}\n"
|
||||
"pg_data/backup_label={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/base/1/555_init={\"checksum-page\":true,\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_init.1={\"checksum-page\":true,\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_vm.1_vm={\"checksum-page\":true,\"size\":0,\"timestamp\":1565282114}\n"
|
||||
@@ -580,9 +579,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.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"
|
||||
"pg_tblspc/1/PG_9.6_201608131/1/16384={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131/1/PG_VERSION={\"size\":0,\"timestamp\":1565282120}\n"
|
||||
"pg_tblspc/2/PG_9.6_201608131/1/16385={\"checksum-page\":true,\"size\":8,\"timestamp\":1565282115}\n"
|
||||
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_FALSE
|
||||
"\n"
|
||||
"[target:link]\n"
|
||||
@@ -613,11 +612,11 @@ testRun(void)
|
||||
"pg_data/pg_xlog={}\n"
|
||||
"pg_tblspc={}\n"
|
||||
"pg_tblspc/1={}\n"
|
||||
"pg_tblspc/1/PG_9.5_201510051={}\n"
|
||||
"pg_tblspc/1/PG_9.5_201510051/1={}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131={}\n"
|
||||
"pg_tblspc/1/PG_9.6_201608131/1={}\n"
|
||||
"pg_tblspc/2={}\n"
|
||||
"pg_tblspc/2/PG_9.5_201510051={}\n"
|
||||
"pg_tblspc/2/PG_9.5_201510051/1={}\n"
|
||||
"pg_tblspc/2/PG_9.6_201608131={}\n"
|
||||
"pg_tblspc/2/PG_9.6_201608131/1={}\n"
|
||||
TEST_MANIFEST_PATH_DEFAULT)),
|
||||
"check manifest");
|
||||
|
||||
@@ -852,7 +851,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_14, hrnPgCatalogVersion(PG_VERSION_14), 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");
|
||||
@@ -864,7 +863,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_15, hrnPgCatalogVersion(PG_VERSION_15), 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");
|
||||
@@ -876,7 +875,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_16, hrnPgCatalogVersion(PG_VERSION_16), 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);
|
||||
@@ -888,7 +887,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, true, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_17, hrnPgCatalogVersion(PG_VERSION_17), 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");
|
||||
@@ -904,7 +903,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_95, hrnPgCatalogVersion(PG_VERSION_95), 0, false, false, false, false, NULL, NULL, NULL),
|
||||
storagePg, PG_VERSION_18, hrnPgCatalogVersion(PG_VERSION_18), 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
|
||||
@@ -1418,11 +1417,11 @@ testRun(void)
|
||||
"backup-type=\"full\"\n"
|
||||
"\n"
|
||||
"[backup:db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=1000000000000000094\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[backup:option]\n"
|
||||
"option-archive-check=true\n"
|
||||
@@ -1506,11 +1505,11 @@ testRun(void)
|
||||
"backup-type=\"full\"\n" \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=1000000000000000094\n" \
|
||||
"db-version=\"9.5\"\n" \
|
||||
"db-version=\"9.6\"\n" \
|
||||
"\n" \
|
||||
"[backup:option]\n" \
|
||||
"option-archive-check=true\n" \
|
||||
@@ -1630,11 +1629,11 @@ testRun(void)
|
||||
"backup-type=\"full\"\n"
|
||||
"\n"
|
||||
"[backup:db]\n"
|
||||
"db-catalog-version=201510051\n"
|
||||
"db-control-version=942\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=960\n"
|
||||
"db-id=2\n"
|
||||
"db-system-id=2000000000000000094\n"
|
||||
"db-version=\"9.5\"\n"
|
||||
"db-version=\"9.6\"\n"
|
||||
"\n"
|
||||
"[backup:option]\n"
|
||||
"option-archive-check=false\n"
|
||||
@@ -1978,11 +1977,11 @@ testRun(void)
|
||||
"ignore-key=\"ignore-value\"\n" \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201510051\n" \
|
||||
"db-control-version=942\n" \
|
||||
"db-catalog-version=201608131\n" \
|
||||
"db-control-version=960\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=1000000000000000094\n" \
|
||||
"db-version=\"9.5\"\n" \
|
||||
"db-version=\"9.6\"\n" \
|
||||
"ignore-key=\"ignore-value\"\n" \
|
||||
"\n" \
|
||||
"[backup:option]\n" \
|
||||
|
||||
@@ -19,7 +19,6 @@ Test definition
|
||||
static HrnHostTestDefine testMatrix[] =
|
||||
{
|
||||
// {uncrustify_off - struct alignment}
|
||||
{.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 = "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},
|
||||
@@ -259,18 +258,10 @@ testRun(void)
|
||||
// Create a database that can be excluded from restores
|
||||
HRN_HOST_SQL_EXEC(pg1, "create database exclude_me with tablespace ts1");
|
||||
|
||||
// Check that backup fails for <= 9.5 when another backup is already running
|
||||
if (hrnHostPgVersion() <= PG_VERSION_95)
|
||||
{
|
||||
HRN_HOST_SQL_EXEC(pg1, "perform pg_start_backup('test backup that will be restarted', true)");
|
||||
TEST_HOST_BR(repo, CFGCMD_BACKUP, .resultExpect = errorTypeCode(&DbQueryError));
|
||||
}
|
||||
|
||||
// Backup from pg1 to show that backups can be done from the primary when a repo host exists, that a primary backup
|
||||
// works after a standby backup, and that disabling bundling and block incremental works. Include stop auto here so
|
||||
// backups for <= 9.5 will stop the prior backup
|
||||
// works after a standby backup, and that disabling bundling and block incremental works.
|
||||
HRN_HOST_SQL_EXEC(pg1, "update status set message = '" TEST_STATUS_INCR "'");
|
||||
TEST_HOST_BR(pg1, CFGCMD_BACKUP, .option = "--type=incr --delta --stop-auto");
|
||||
TEST_HOST_BR(pg1, CFGCMD_BACKUP, .option = "--type=incr --delta");
|
||||
|
||||
// Check that expire works remotely (increase full retention to make it a noop)
|
||||
TEST_HOST_BR(pg1, CFGCMD_EXPIRE, .option = "--repo1-retention-full=99");
|
||||
|
||||
@@ -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_95), 942, "9.5 control version");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_96), 960, "9.6 control version");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_11), 1100, "11 control version");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_17), 1700, "17 control version");
|
||||
}
|
||||
@@ -147,7 +147,7 @@ testRun(void)
|
||||
"wal segment size is 2147483648 but must be a power of two between 1048576 and 1073741824 inclusive");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_95, .pageSize = 64 * 1024);
|
||||
HRN_PG_CONTROL_PUT(storageTest, PG_VERSION_96, .pageSize = 64 * 1024);
|
||||
|
||||
TEST_ERROR(
|
||||
pgControlFromFile(storageTest, NULL), FormatError,
|
||||
@@ -162,19 +162,6 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check all valid page sizes");
|
||||
|
||||
HRN_PG_CONTROL_PUT(
|
||||
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_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");
|
||||
TEST_RESULT_UINT(info.pageChecksumVersion, 0, "check page checksum");
|
||||
|
||||
HRN_PG_CONTROL_PUT(
|
||||
storageTest, PG_VERSION_96, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_96),
|
||||
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88, .pageSize = pgPageSize1, .pageChecksumVersion = 1);
|
||||
@@ -212,6 +199,18 @@ testRun(void)
|
||||
TEST_RESULT_UINT(info.timeline, 88, "check timeline");
|
||||
TEST_RESULT_UINT(info.pageSize, pgPageSize4, "check page size");
|
||||
|
||||
HRN_PG_CONTROL_PUT(
|
||||
storageTest, PG_VERSION_15, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_15),
|
||||
.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_15, "check version");
|
||||
TEST_RESULT_UINT(info.catalogVersion, 202209061, "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");
|
||||
|
||||
HRN_PG_CONTROL_PUT(
|
||||
storageTest, PG_VERSION_16, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_16),
|
||||
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88, .pageSize = pgPageSize16);
|
||||
@@ -291,15 +290,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_95, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
|
||||
crcOffset = pgInterfaceVersion(PG_VERSION_95)->controlCrcOffset() + sizeof(uint32_t) * 2;
|
||||
0, 0xFADEFADE, (PgControl){.version = PG_VERSION_18, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
|
||||
crcOffset = pgInterfaceVersion(PG_VERSION_18)->controlCrcOffset() + sizeof(uint32_t) * 2;
|
||||
*((uint32_t *)(bufPtr(control) + crcOffset)) = crc32cOne(bufPtrConst(control), crcOffset);
|
||||
|
||||
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
|
||||
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_18_Z));
|
||||
TEST_RESULT_UINT(info.checkpoint, 777, "check checkpoint");
|
||||
|
||||
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_95_Z)), "invalidate checkpoint");
|
||||
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
|
||||
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_18_Z)), "invalidate checkpoint");
|
||||
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_18_Z));
|
||||
TEST_RESULT_UINT(info.checkpoint, 0xDEAD, "check invalid checkpoint");
|
||||
}
|
||||
|
||||
@@ -345,7 +344,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_95, 201510051), "PG_9.5_201510051", "check 9.5 tablespace id");
|
||||
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_96, 888888888), "PG_9.6_888888888", "check 9.6 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 +481,12 @@ testRun(void)
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
memset(bufPtr(result), 0, bufSize(result));
|
||||
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_95, .systemId = 0xEAEAEAEA, .size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT);
|
||||
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_96, .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.5");
|
||||
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, NULL), "get wal info v9.6");
|
||||
TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_95, " check version");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_96, " check version");
|
||||
TEST_RESULT_UINT(info.size, HRN_PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user