You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-30 19:23:04 +03:00
Remove support for PostgreSQL 9.0/9.1/9.2.
Our new policy is to support ten versions of PostgreSQL, the five supported releases and the last five EOL releases. As of PostgreSQL 15, that means 9.0/9.1/9.2 are no longer supported by pgBackRest. Remove all logic associated with 9.0/9.1/9.2 and update the tests. Document the new support policy. Update InfoPg to read/write control versions for the history in backup.info, since we can no longer rely on the mappings being available. In theory this could have been an issue after removing 8.3/8.4 if anybody was using a version that old.
This commit is contained in:
@ -508,8 +508,8 @@ A PostgreSQL libpq shim is provided to simulate interactions with PostgreSQL. Be
|
||||
// Set up two standbys but no primary
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
|
||||
// Close the "inner" session first (8) then the outer (1)
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
|
@ -86,9 +86,9 @@ pgBackRest repositories can be located in S3, Azure, and GCS compatible object s
|
||||
|
||||
pgBackRest can encrypt the repository to secure backups wherever they are stored.
|
||||
|
||||
### Compatibility with PostgreSQL >= 9.0
|
||||
### Compatibility with ten versions of PostgreSQL
|
||||
|
||||
pgBackRest includes support for versions down to 9.0, since older versions of PostgreSQL are still regularly utilized.
|
||||
pgBackRest includes support for ten versions of PostgreSQL, the five supported versions and the last five EOL versions. This allows ample time to upgrade to a supported version.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
@ -579,8 +579,8 @@ HRN_FORK_END();
|
||||
// Set up two standbys but no primary
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
|
||||
// Close the "inner" session first (8) then the outer (1)
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
|
@ -162,9 +162,9 @@
|
||||
|
||||
<!-- =================================================================================================================== -->
|
||||
<section id="postgres-compatibility">
|
||||
<title>Compatibility with <postgres/> >= 9.0</title>
|
||||
<title>Compatibility with ten versions of <postgres/></title>
|
||||
|
||||
<p><backrest/> includes support for versions down to 9.0, since older versions of PostgreSQL are still regularly utilized.</p>
|
||||
<p><backrest/> includes support for ten versions of <postgres/>, the five supported versions and the last five EOL versions. This allows ample time to upgrade to a supported version.</p>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -15,6 +15,20 @@
|
||||
|
||||
<release-list>
|
||||
<release date="XXXX-XX-XX" version="2.44dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-improvement-list>
|
||||
<release-item>
|
||||
<github-pull-request id="1941"/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-reviewer id="stefan.fercot"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Remove support for <proper>PostgreSQL</proper> <id>9.0</id>/<id>9.1</id>/<id>9.2</id>.</p>
|
||||
</release-item>
|
||||
</release-improvement-list>
|
||||
</release-core-list>
|
||||
</release>
|
||||
|
||||
<release date="2022-11-28" version="2.43" title="Bug Fix">
|
||||
|
@ -1394,7 +1394,7 @@
|
||||
<text>
|
||||
<p>Moves a tablespace to a new location during the restore. This is useful when tablespace locations are not the same on a replica, or an upgraded system has different mount points.</p>
|
||||
|
||||
<p>Since <postgres/> 9.2 tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the <setting>data_directory</setting> is not recommended and may cause problems. For more information on moving tablespaces http://www.databasesoup.com/2013/11/moving-tablespaces.html is a good resource.</p>
|
||||
<p>Tablespace locations are not stored in pg_tablespace so moving tablespaces can be done with impunity. However, moving a tablespace to the <setting>data_directory</setting> is not recommended and may cause problems. For more information on moving tablespaces http://www.databasesoup.com/2013/11/moving-tablespaces.html is a good resource.</p>
|
||||
</text>
|
||||
|
||||
<example>ts_01=/db/ts_01</example>
|
||||
@ -1908,7 +1908,7 @@
|
||||
<text>
|
||||
<p>The <cmd>check</cmd> command validates that <backrest/> and the <pg-setting>archive_command</pg-setting> setting are configured correctly for archiving and backups for the specified stanza. It will attempt to check all repositories and databases that are configured for the host on which the command is run. It detects misconfigurations, particularly in archiving, that result in incomplete backups because required WAL segments did not reach the archive. The command can be run on the <postgres/> or repository host. The command may also be run on the standby host, however, since <code>pg_switch_xlog()</code>/<code>pg_switch_wal()</code> cannot be performed on the standby, the command will only test the repository configuration.</p>
|
||||
|
||||
<p>Note that <code>pg_create_restore_point('pgBackRest Archive Check')</code> and <code>pg_switch_xlog()</code>/<code>pg_switch_wal()</code> are called to force <postgres/> to archive a WAL segment. Restore points are only supported in <postgres/> >= 9.1 so for older versions the <cmd>check</cmd> command may fail if there has been no write activity since the last log rotation, therefore it is recommended that activity be generated by the user if there have been no writes since the last WAL switch before running the <cmd>check</cmd> command.</p>
|
||||
<p>Note that <code>pg_create_restore_point('pgBackRest Archive Check')</code> and <code>pg_switch_xlog()</code>/<code>pg_switch_wal()</code> are called to force <postgres/> to archive a WAL segment.</p>
|
||||
|
||||
<!-- Note, linking to the User Guide is limited since it can cause a cyclical reference -->
|
||||
</text>
|
||||
@ -2160,8 +2160,8 @@
|
||||
<p>The following actions are supported:</p>
|
||||
|
||||
<list>
|
||||
<list-item><id>pause</id> - pause when recovery target is reached. (<postgres/> >= 9.1)</list-item>
|
||||
<list-item><id>promote</id> - promote and switch timeline when recovery target is reached. (<postgres/> >= 9.1)</list-item>
|
||||
<list-item><id>pause</id> - pause when recovery target is reached.</list-item>
|
||||
<list-item><id>promote</id> - promote and switch timeline when recovery target is reached.</list-item>
|
||||
<list-item><id>shutdown</id> - shutdown server when recovery target is reached. (<postgres/> >= 9.5)</list-item>
|
||||
</list>
|
||||
</text>
|
||||
|
@ -5,9 +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.0
|
||||
- 9.1
|
||||
- 9.2
|
||||
- 9.3
|
||||
- 9.4
|
||||
- 9.5
|
||||
|
@ -510,13 +510,6 @@ walSegmentNext(const String *walSegment, size_t walSegmentSize, unsigned int pgV
|
||||
major++;
|
||||
minor = 0;
|
||||
}
|
||||
|
||||
// Special hack for PostgreSQL < 9.3 which skipped minor FF
|
||||
if (minor == 0xFF && pgVersion < PG_VERSION_93)
|
||||
{
|
||||
major++;
|
||||
minor = 0;
|
||||
}
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
|
@ -175,19 +175,9 @@ backupInit(const InfoBackup *infoBackup)
|
||||
BackupData *result = memNew(sizeof(BackupData));
|
||||
*result = (BackupData){0};
|
||||
|
||||
// Check that the PostgreSQL version supports backup from standby. The check is done using the stanza info because pg_control
|
||||
// cannot be loaded until a primary is found -- which will also lead to an error if the version does not support standby. If the
|
||||
// pg_control version does not match the stanza version then there will be an error further down.
|
||||
// Don't allow backup from standby when offline
|
||||
InfoPgData infoPg = infoPgDataCurrent(infoBackupPg(infoBackup));
|
||||
|
||||
if (cfgOptionBool(cfgOptOnline) && cfgOptionBool(cfgOptBackupStandby) && infoPg.version < PG_VERSION_BACKUP_STANDBY)
|
||||
{
|
||||
THROW_FMT(
|
||||
ConfigError, "option '" CFGOPT_BACKUP_STANDBY "' not valid for " PG_NAME " < %s",
|
||||
strZ(pgVersionToStr(PG_VERSION_BACKUP_STANDBY)));
|
||||
}
|
||||
|
||||
// Don't allow backup from standby when offline
|
||||
if (!cfgOptionBool(cfgOptOnline) && cfgOptionBool(cfgOptBackupStandby))
|
||||
{
|
||||
LOG_WARN(
|
||||
@ -241,13 +231,6 @@ backupInit(const InfoBackup *infoBackup)
|
||||
strZ(pgVersionToStr(infoPg.version)), infoPg.systemId);
|
||||
}
|
||||
|
||||
// Only allow stop auto in PostgreSQL >= 9.3
|
||||
if (cfgOptionBool(cfgOptStopAuto) && result->version < PG_VERSION_93)
|
||||
{
|
||||
LOG_WARN(CFGOPT_STOP_AUTO " option is only available in " PG_NAME " >= " PG_VERSION_93_STR);
|
||||
cfgOptionSet(cfgOptStopAuto, cfgSourceParam, BOOL_FALSE_VAR);
|
||||
}
|
||||
|
||||
// If checksum page is not explicitly set then automatically enable it when checksums are available
|
||||
if (!cfgOptionTest(cfgOptChecksumPage))
|
||||
{
|
||||
@ -2037,7 +2020,7 @@ backupArchiveCheckCopy(const BackupData *const backupData, Manifest *const manif
|
||||
|
||||
// Loop through all the segments in the lsn range
|
||||
StringList *walSegmentList = pgLsnRangeToWalSegmentList(
|
||||
manifestData(manifest)->pgVersion, backupData->timeline, lsnStart, lsnStop, backupData->walSegmentSize);
|
||||
backupData->timeline, lsnStart, lsnStop, backupData->walSegmentSize);
|
||||
|
||||
for (unsigned int walSegmentIdx = 0; walSegmentIdx < strLstSize(walSegmentList); walSegmentIdx++)
|
||||
{
|
||||
|
@ -525,10 +525,6 @@ restoreManifestMap(Manifest *manifest)
|
||||
THROW_FMT(TablespaceMapError, "unable to remap invalid tablespace '%s'", strZ(tablespace));
|
||||
}
|
||||
}
|
||||
|
||||
// Issue a warning message when remapping tablespaces in PostgreSQL < 9.2
|
||||
if (manifestData(manifest)->pgVersion <= PG_VERSION_92)
|
||||
LOG_WARN("update pg_tablespace.spclocation with new tablespace locations for PostgreSQL <= " PG_VERSION_92_STR);
|
||||
}
|
||||
|
||||
// Remap links
|
||||
@ -1630,8 +1626,8 @@ restoreRecoveryOption(unsigned int pgVersion)
|
||||
{
|
||||
kvPut(result, VARSTRZ(RECOVERY_TARGET_ACTION), VARSTR(strIdToStr(targetAction)));
|
||||
}
|
||||
// Write pause_at_recovery_target on supported PostgreSQL versions
|
||||
else if (pgVersion >= PG_VERSION_RECOVERY_TARGET_PAUSE)
|
||||
// Else write pause_at_recovery_target on supported PostgreSQL versions
|
||||
else
|
||||
{
|
||||
// Shutdown action is not supported with pause_at_recovery_target setting
|
||||
if (targetAction == CFGOPTVAL_TARGET_ACTION_SHUTDOWN)
|
||||
@ -1644,13 +1640,6 @@ restoreRecoveryOption(unsigned int pgVersion)
|
||||
|
||||
kvPut(result, VARSTRZ(PAUSE_AT_RECOVERY_TARGET), VARSTR(FALSE_STR));
|
||||
}
|
||||
// Else error on unsupported version
|
||||
else
|
||||
{
|
||||
THROW_FMT(
|
||||
OptionInvalidError, CFGOPT_TARGET_ACTION " option is only available in PostgreSQL >= %s",
|
||||
strZ(pgVersionToStr(PG_VERSION_RECOVERY_TARGET_PAUSE)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,19 +565,6 @@ verifyCreateArchiveIdRange(VerifyArchiveResult *archiveIdResult, StringList *wal
|
||||
{
|
||||
String *walSegment = strSubN(strLstGet(walFileList, walFileIdx), 0, WAL_SEGMENT_NAME_SIZE);
|
||||
|
||||
// If walSegment found ends in FF for PG versions 9.2 or less then skip it but log error because it should not exist and
|
||||
// PostgreSQL will ignore it
|
||||
if (archiveIdResult->pgWalInfo.version <= PG_VERSION_92 && strEndsWithZ(walSegment, "FF"))
|
||||
{
|
||||
LOG_INFO_FMT("invalid WAL '%s' for '%s' exists, skipping", strZ(walSegment), strZ(archiveIdResult->archiveId));
|
||||
|
||||
(*jobErrorTotal)++;
|
||||
|
||||
// Remove the file from the original list so no attempt is made to verify it
|
||||
strLstRemoveIdx(walFileList, walFileIdx);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The lists are sorted so look ahead to see if this is a duplicate of the next one in the list
|
||||
if (walFileIdx + 1 < strLstSize(walFileList))
|
||||
{
|
||||
|
21
src/db/db.c
21
src/db/db.c
@ -208,12 +208,7 @@ dbIsInRecovery(Db *const this)
|
||||
|
||||
ASSERT(this != NULL);
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (dbPgVersion(this) >= PG_VERSION_HOT_STANDBY)
|
||||
result = pckReadBoolP(dbQueryColumn(this, STRDEF("select pg_catalog.pg_is_in_recovery()")));
|
||||
|
||||
FUNCTION_LOG_RETURN(BOOL, result);
|
||||
FUNCTION_LOG_RETURN(BOOL, pckReadBoolP(dbQueryColumn(this, STRDEF("select pg_catalog.pg_is_in_recovery()"))));
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************/
|
||||
@ -383,8 +378,6 @@ dbBackupStart(Db *const this, const bool startFast, const bool stopAuto, const b
|
||||
// If stop-auto is enabled check for a running backup
|
||||
if (stopAuto)
|
||||
{
|
||||
CHECK(AssertError, dbPgVersion(this) >= PG_VERSION_93, "feature not supported in PostgreSQL < " PG_VERSION_93_STR);
|
||||
|
||||
// Feature is not needed for PostgreSQL >= 9.6 since backups are run in non-exclusive mode
|
||||
if (dbPgVersion(this) < PG_VERSION_96)
|
||||
{
|
||||
@ -443,15 +436,9 @@ dbBackupStart(Db *const this, const bool startFast, const bool stopAuto, const b
|
||||
|
||||
if (archiveCheck && strEq(walSegmentCheck, walSegmentName))
|
||||
{
|
||||
// If the version supports restore points then force a WAL switch
|
||||
if (dbPgVersion(this) >= PG_VERSION_RESTORE_POINT)
|
||||
{
|
||||
// Force a WAL switch
|
||||
dbWalSwitch(this);
|
||||
}
|
||||
// Else disable the check. All WAL will still be checked at the end of the backup.
|
||||
else
|
||||
walSegmentCheck = NULL;
|
||||
}
|
||||
|
||||
// Check that the WAL timeline matches what is in pg_control
|
||||
if (pgTimelineFromWalSegment(walSegmentName) != dbPgControl(this).timeline)
|
||||
@ -826,9 +813,7 @@ dbWalSwitch(Db *this)
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Create a restore point to ensure current WAL will be archived. For versions < 9.1 activity will need to be generated by
|
||||
// the user if there have been no writes since the last WAL switch.
|
||||
if (dbPgVersion(this) >= PG_VERSION_RESTORE_POINT)
|
||||
// Create a restore point to ensure current WAL will be archived
|
||||
dbQueryColumn(this, STRDEF("select pg_catalog.pg_create_restore_point('" PROJECT_NAME " Archive Check')::text"));
|
||||
|
||||
// Request a WAL segment switch
|
||||
|
@ -129,7 +129,10 @@ infoPgLoadCallback(void *const data, const String *const section, const String *
|
||||
|
||||
// Catalog version
|
||||
if (loadData->infoPg->type == infoPgBackup)
|
||||
{
|
||||
infoPgData.catalogVersion = jsonReadUInt(jsonReadKeyRequireZ(json, INFO_KEY_DB_CATALOG_VERSION));
|
||||
infoPgData.controlVersion = jsonReadUInt(jsonReadKeyRequireZ(json, INFO_KEY_DB_CONTROL_VERSION));
|
||||
}
|
||||
|
||||
// System id
|
||||
infoPgData.systemId = jsonReadUInt64(
|
||||
@ -247,11 +250,15 @@ infoPgSet(
|
||||
|
||||
// This is different in archive.info due to a typo that can't be fixed without a format version bump
|
||||
.systemId = pgSystemId,
|
||||
|
||||
// Catalog version is only required for backup info to preserve the repo format
|
||||
.catalogVersion = this->type == infoPgBackup ? pgCatalogVersion : 0,
|
||||
};
|
||||
|
||||
// Catalog/control version required for backup info to preserve the repo format
|
||||
if (this->type == infoPgBackup)
|
||||
{
|
||||
infoPgData.catalogVersion = pgCatalogVersion;
|
||||
infoPgData.controlVersion = pgControlVersion(pgVersion);
|
||||
}
|
||||
|
||||
// Add the pg data to the history list
|
||||
infoPgAdd(this, &infoPgData);
|
||||
}
|
||||
@ -318,7 +325,7 @@ infoPgSaveCallback(void *const data, const String *const sectionNext, InfoSave *
|
||||
if (saveData->infoPg->type == infoPgBackup)
|
||||
{
|
||||
jsonWriteUInt(jsonWriteKeyZ(json, INFO_KEY_DB_CATALOG_VERSION), pgData.catalogVersion);
|
||||
jsonWriteUInt(jsonWriteKeyZ(json, INFO_KEY_DB_CONTROL_VERSION), pgControlVersion(pgData.version));
|
||||
jsonWriteUInt(jsonWriteKeyZ(json, INFO_KEY_DB_CONTROL_VERSION), pgData.controlVersion);
|
||||
}
|
||||
|
||||
if (saveData->infoPg->type == infoPgArchive)
|
||||
|
@ -30,6 +30,9 @@ typedef struct InfoPgData
|
||||
uint64_t systemId;
|
||||
unsigned int catalogVersion;
|
||||
unsigned int version;
|
||||
|
||||
// Control version is required to maintain the file format for older versions of pgBackRest but should not be used elsewhere
|
||||
unsigned int controlVersion;
|
||||
} InfoPgData;
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -804,11 +804,11 @@ manifestBuildInfo(
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
|
||||
// Skip pg_serial/* since these files are reset
|
||||
if (strEqZ(info->name, PG_PATH_PGSERIAL) && pgVersion >= PG_VERSION_91)
|
||||
if (strEqZ(info->name, PG_PATH_PGSERIAL))
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
|
||||
// Skip pg_snapshots/* since these files cannot be reused on recovery
|
||||
if (strEqZ(info->name, PG_PATH_PGSNAPSHOTS) && pgVersion >= PG_VERSION_92)
|
||||
if (strEqZ(info->name, PG_PATH_PGSNAPSHOTS))
|
||||
FUNCTION_TEST_RETURN_VOID();
|
||||
|
||||
// Skip temporary statistics in pg_stat_tmp even when stats_temp_directory is set because PGSS_TEXT_FILE is always
|
||||
@ -1141,7 +1141,6 @@ manifestNewBuild(
|
||||
|
||||
ASSERT(storagePg != NULL);
|
||||
ASSERT(pgVersion != 0);
|
||||
ASSERT(!checksumPage || pgVersion >= PG_VERSION_93);
|
||||
|
||||
Manifest *this = NULL;
|
||||
|
||||
@ -1272,8 +1271,6 @@ manifestNewBuild(
|
||||
// to check for _init files which will sort after the vast majority of the relation files. We could check storage for
|
||||
// each _init file but that would be expensive.
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
if (pgVersion >= PG_VERSION_91)
|
||||
{
|
||||
RegExp *relationExp = regExpNew(strNewFmt("^" DB_PATH_EXP "/" RELATION_EXP "$", strZ(buildData.tablespaceId)));
|
||||
unsigned int fileIdx = 0;
|
||||
char lastRelationFileId[21] = ""; // Large enough for a 64-bit unsigned integer
|
||||
@ -1341,7 +1338,6 @@ manifestNewBuild(
|
||||
ASSERT(memContextSize(memContextCurrent()) - sizeBegin < 256);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
}
|
||||
OBJ_NEW_END();
|
||||
|
@ -442,30 +442,23 @@ pgTimelineFromWalSegment(const String *const walSegment)
|
||||
/**********************************************************************************************************************************/
|
||||
StringList *
|
||||
pgLsnRangeToWalSegmentList(
|
||||
const unsigned int pgVersion, const uint32_t timeline, const uint64_t lsnStart, const uint64_t lsnStop,
|
||||
const unsigned int walSegmentSize)
|
||||
const uint32_t timeline, const uint64_t lsnStart, const uint64_t lsnStop, const unsigned int walSegmentSize)
|
||||
{
|
||||
FUNCTION_TEST_BEGIN();
|
||||
FUNCTION_TEST_PARAM(UINT, pgVersion);
|
||||
FUNCTION_TEST_PARAM(UINT, timeline);
|
||||
FUNCTION_TEST_PARAM(UINT64, lsnStart);
|
||||
FUNCTION_TEST_PARAM(UINT64, lsnStop);
|
||||
FUNCTION_TEST_PARAM(UINT, walSegmentSize);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
ASSERT(pgVersion != 0);
|
||||
ASSERT(timeline != 0);
|
||||
ASSERT(lsnStart <= lsnStop);
|
||||
ASSERT(walSegmentSize != 0);
|
||||
ASSERT(pgVersion > PG_VERSION_92 || walSegmentSize == PG_WAL_SEGMENT_SIZE_DEFAULT);
|
||||
|
||||
StringList *const result = strLstNew();
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Skip the FF segment when PostgreSQL <= 9.2 (in this case segment size should always be 16MB)
|
||||
const bool skipFF = pgVersion <= PG_VERSION_92;
|
||||
|
||||
// Calculate the start and stop segments
|
||||
unsigned int startMajor = (unsigned int)(lsnStart >> 32);
|
||||
unsigned int startMinor = (unsigned int)(lsnStart & 0xFFFFFFFF) / walSegmentSize;
|
||||
@ -482,7 +475,7 @@ pgLsnRangeToWalSegmentList(
|
||||
{
|
||||
startMinor++;
|
||||
|
||||
if ((skipFF && startMinor == 0xFF) || (!skipFF && startMinor > minorPerMajor))
|
||||
if (startMinor > minorPerMajor)
|
||||
{
|
||||
startMajor++;
|
||||
startMinor = 0;
|
||||
|
@ -143,7 +143,7 @@ String *pgVersionToStr(unsigned int version);
|
||||
PgWal pgWalFromFile(const String *walFile, const Storage *storage);
|
||||
PgWal pgWalFromBuffer(const Buffer *walBuffer);
|
||||
|
||||
// Get the tablespace identifier used to distinguish versions in a tablespace directory, e.g. PG_9.0_201008051
|
||||
// Get the tablespace identifier used to distinguish versions in a tablespace directory, e.g. PG_15_202209061
|
||||
String *pgTablespaceId(unsigned int pgVersion, unsigned int pgCatalogVersion);
|
||||
|
||||
// Convert a string to an lsn and vice versa
|
||||
@ -158,8 +158,7 @@ uint64_t pgLsnFromWalSegment(const String *walSegment, unsigned int walSegmentSi
|
||||
uint32_t pgTimelineFromWalSegment(const String *walSegment);
|
||||
|
||||
// Convert a timeline and lsn range to a list of wal segments
|
||||
StringList *pgLsnRangeToWalSegmentList(
|
||||
unsigned int pgVersion, uint32_t timeline, uint64_t lsnStart, uint64_t lsnStop, unsigned int walSegmentSize);
|
||||
StringList *pgLsnRangeToWalSegmentList(uint32_t timeline, uint64_t lsnStart, uint64_t lsnStop, unsigned int walSegmentSize);
|
||||
|
||||
// Get name used for lsn in functions (this was changed in PostgreSQL 10 for consistency since lots of names were changing)
|
||||
const String *pgLsnName(unsigned int pgVersion);
|
||||
|
@ -16,7 +16,7 @@ alpha/beta/rc period without needing to be updated, unless of course the actual
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#ifdef CATALOG_VERSION_NO_MAX
|
||||
|
||||
@ -75,28 +75,6 @@ Read the version specific pg_control into a general data structure
|
||||
}; \
|
||||
}
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
#define PG_INTERFACE_CONTROL(version) \
|
||||
static PgControl \
|
||||
pgInterfaceControl##version(const unsigned char *controlFile) \
|
||||
{ \
|
||||
ASSERT(controlFile != NULL); \
|
||||
ASSERT(pgInterfaceControlIs##version(controlFile)); \
|
||||
\
|
||||
return (PgControl) \
|
||||
{ \
|
||||
.systemId = ((ControlFileData *)controlFile)->system_identifier, \
|
||||
.catalogVersion = ((ControlFileData *)controlFile)->catalog_version_no, \
|
||||
.checkpoint = \
|
||||
(uint64_t)((ControlFileData *)controlFile)->checkPoint.xlogid << 32 | \
|
||||
((ControlFileData *)controlFile)->checkPoint.xrecoff, \
|
||||
.timeline = ((ControlFileData *)controlFile)->checkPointCopy.ThisTimeLineID, \
|
||||
.pageSize = ((ControlFileData *)controlFile)->blcksz, \
|
||||
.walSegmentSize = ((ControlFileData *)controlFile)->xlog_seg_size, \
|
||||
}; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -104,7 +82,7 @@ Get the control version
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#define PG_INTERFACE_CONTROL_VERSION(version) \
|
||||
static uint32_t \
|
||||
@ -120,7 +98,7 @@ Determine if the supplied WAL is for this version of PostgreSQL
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#define PG_INTERFACE_WAL_IS(version) \
|
||||
static bool \
|
||||
@ -138,7 +116,7 @@ Read the version specific WAL header into a general data structure
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#define PG_INTERFACE_WAL(version) \
|
||||
static PgWal \
|
||||
|
@ -31,7 +31,7 @@ Types from src/include/c.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
typedef int64_t int64;
|
||||
|
||||
@ -41,7 +41,7 @@ typedef int64_t int64;
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/* MultiXactId must be equivalent to TransactionId, to fit in t_xmax */
|
||||
typedef TransactionId MultiXactId;
|
||||
@ -52,7 +52,7 @@ typedef TransactionId MultiXactId;
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
typedef uint32 MultiXactOffset;
|
||||
|
||||
@ -66,7 +66,7 @@ Types from src/include/pgtime.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
* The API of this library is generally similar to the corresponding
|
||||
@ -85,7 +85,7 @@ Types from src/include/postgres_ext.h
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
* Object ID is a fundamental type in Postgres.
|
||||
@ -106,7 +106,7 @@ Types from src/include/port/pg_crc32.h
|
||||
|
||||
typedef uint32 pg_crc32c;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
typedef uint32 pg_crc32;
|
||||
|
||||
@ -128,36 +128,13 @@ Types from src/include/access/xlogdefs.h
|
||||
*/
|
||||
typedef uint64 XLogRecPtr;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/*
|
||||
* Pointer to a location in the XLOG. These pointers are 64 bits wide,
|
||||
* because we don't want them ever to overflow.
|
||||
*
|
||||
* NOTE: xrecoff == 0 is used to indicate an invalid pointer. This is OK
|
||||
* because we use page headers in the XLOG, so no XLOG record can start
|
||||
* right at the beginning of a file.
|
||||
*
|
||||
* NOTE: the "log file number" is somewhat misnamed, since the actual files
|
||||
* making up the XLOG are much smaller than 4Gb. Each actual file is an
|
||||
* XLogSegSize-byte "segment" of a logical log file having the indicated
|
||||
* xlogid. The log file number and segment number together identify a
|
||||
* physical XLOG file. Segment number and offset within the physical file
|
||||
* are computed from xrecoff div and mod XLogSegSize.
|
||||
*/
|
||||
typedef struct XLogRecPtr
|
||||
{
|
||||
uint32 xlogid; /* log file #, 0 based */
|
||||
uint32 xrecoff; /* byte offset of location in log file */
|
||||
} XLogRecPtr;
|
||||
|
||||
#endif
|
||||
|
||||
// TimeLineID type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
* TimeLineID (TLI) - identifies different database histories to prevent
|
||||
@ -310,45 +287,6 @@ Types from src/include/catalog/catversion.h
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 201306121
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_92
|
||||
|
||||
/*
|
||||
* 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 201204301
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_91
|
||||
|
||||
/*
|
||||
* 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 201105231
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/*
|
||||
* 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 201008051
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -416,16 +354,6 @@ Types from src/include/catalog/pg_control.h
|
||||
/* Version identifier for this pg_control format */
|
||||
#define PG_CONTROL_VERSION 937
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_92
|
||||
|
||||
/* Version identifier for this pg_control format */
|
||||
#define PG_CONTROL_VERSION 922
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/* Version identifier for this pg_control format */
|
||||
#define PG_CONTROL_VERSION 903
|
||||
|
||||
#endif
|
||||
|
||||
// MOCK_AUTH_NONCE_LEN define
|
||||
@ -632,74 +560,13 @@ typedef struct CheckPoint
|
||||
TransactionId oldestActiveXid;
|
||||
} CheckPoint;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_92
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
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 */
|
||||
pg_time_t time; /* time stamp of checkpoint */
|
||||
|
||||
/*
|
||||
* Oldest XID still running. This is only needed to initialize hot standby
|
||||
* mode from an online checkpoint, so we only bother calculating this for
|
||||
* online checkpoints and only when wal_level is hot_standby. Otherwise
|
||||
* it's set to InvalidTransactionId.
|
||||
*/
|
||||
TransactionId oldestActiveXid;
|
||||
} CheckPoint;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
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 */
|
||||
pg_time_t time; /* time stamp of checkpoint */
|
||||
|
||||
/*
|
||||
* Oldest XID still running. This is only needed to initialize hot standby
|
||||
* mode from an online checkpoint, so we only bother calculating this for
|
||||
* online checkpoints and only when wal_level is hot_standby. Otherwise
|
||||
* it's set to InvalidTransactionId.
|
||||
*/
|
||||
TransactionId oldestActiveXid;
|
||||
} CheckPoint;
|
||||
|
||||
#endif
|
||||
|
||||
// DBState enum
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_91
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
* System status indicator. Note this is stored in pg_control; if you change
|
||||
@ -716,19 +583,6 @@ typedef enum DBState
|
||||
DB_IN_PRODUCTION
|
||||
} DBState;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/* System status indicator */
|
||||
typedef enum DBState
|
||||
{
|
||||
DB_STARTUP = 0,
|
||||
DB_SHUTDOWNED,
|
||||
DB_SHUTDOWNING,
|
||||
DB_IN_CRASH_RECOVERY,
|
||||
DB_IN_ARCHIVE_RECOVERY,
|
||||
DB_IN_PRODUCTION
|
||||
} DBState;
|
||||
|
||||
#endif
|
||||
|
||||
// ControlFileData type
|
||||
@ -1843,252 +1697,6 @@ typedef struct ControlFileData
|
||||
pg_crc32 crc;
|
||||
} ControlFileData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_92
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* 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;
|
||||
XLogRecPtr backupStartPoint;
|
||||
XLogRecPtr backupEndPoint;
|
||||
bool backupEndRequired;
|
||||
|
||||
/*
|
||||
* Parameter settings that determine if the WAL can be used for archival
|
||||
* or hot standby.
|
||||
*/
|
||||
int wal_level;
|
||||
int MaxConnections;
|
||||
int max_prepared_xacts;
|
||||
int max_locks_per_xact;
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/* 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? */
|
||||
|
||||
/* CRC of all above ... MUST BE LAST! */
|
||||
pg_crc32 crc;
|
||||
} ControlFileData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
XLogRecPtr minRecoveryPoint;
|
||||
XLogRecPtr backupStartPoint;
|
||||
|
||||
/*
|
||||
* Parameter settings that determine if the WAL can be used for archival
|
||||
* or hot standby.
|
||||
*/
|
||||
int wal_level;
|
||||
int MaxConnections;
|
||||
int max_prepared_xacts;
|
||||
int max_locks_per_xact;
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/* 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? */
|
||||
|
||||
/* CRC of all above ... MUST BE LAST! */
|
||||
pg_crc32 crc;
|
||||
} ControlFileData;
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -2139,18 +1747,6 @@ Types from src/include/access/xlog_internal.h
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD075 /* can be used as WAL version indicator */
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_92
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD071 /* can be used as WAL version indicator */
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_91
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD066 /* can be used as WAL version indicator */
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
#define XLOG_PAGE_MAGIC 0xD064 /* can be used as WAL version indicator */
|
||||
|
||||
#endif
|
||||
|
||||
// XLogPageHeaderData type
|
||||
@ -2202,26 +1798,13 @@ typedef struct XLogPageHeaderData
|
||||
uint32 xlp_rem_len; /* total len of remaining data for record */
|
||||
} XLogPageHeaderData;
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
/*
|
||||
* Each page of XLOG file has a header like this:
|
||||
*/
|
||||
typedef struct XLogPageHeaderData
|
||||
{
|
||||
uint16 xlp_magic; /* magic value for correctness checks */
|
||||
uint16 xlp_info; /* flag bits, see below */
|
||||
TimeLineID xlp_tli; /* TimeLineID of first record on page */
|
||||
XLogRecPtr xlp_pageaddr; /* XLOG address of this page */
|
||||
} XLogPageHeaderData;
|
||||
|
||||
#endif
|
||||
|
||||
// XLogLongPageHeaderData type
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/*
|
||||
* When the XLP_LONG_HEADER flag is set, we store additional fields in the
|
||||
@ -2242,7 +1825,7 @@ typedef struct XLogLongPageHeaderData
|
||||
// ---------------------------------------------------------------------------------------------------------------------------------
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
/* This flag indicates a "long" page header */
|
||||
#define XLP_LONG_HEADER 0x0002
|
||||
|
@ -12,9 +12,6 @@ PostgreSQL name
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL version constants
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_VERSION_90 90000
|
||||
#define PG_VERSION_91 90100
|
||||
#define PG_VERSION_92 90200
|
||||
#define PG_VERSION_93 90300
|
||||
#define PG_VERSION_94 90400
|
||||
#define PG_VERSION_95 90500
|
||||
@ -31,18 +28,6 @@ PostgreSQL version constants
|
||||
/***********************************************************************************************************************************
|
||||
Version where various PostgreSQL capabilities were introduced
|
||||
***********************************************************************************************************************************/
|
||||
// pg_is_in_recovery() supported
|
||||
#define PG_VERSION_HOT_STANDBY PG_VERSION_91
|
||||
|
||||
// pg_create_restore_point() supported
|
||||
#define PG_VERSION_RESTORE_POINT PG_VERSION_91
|
||||
|
||||
// pause_at_recovery_target is supported
|
||||
#define PG_VERSION_RECOVERY_TARGET_PAUSE PG_VERSION_91
|
||||
|
||||
// Backup from standby is supported
|
||||
#define PG_VERSION_BACKUP_STANDBY PG_VERSION_92
|
||||
|
||||
// tablespace_map is created during backup
|
||||
#define PG_VERSION_TABLESPACE_MAP PG_VERSION_95
|
||||
|
||||
@ -61,9 +46,6 @@ Version where various PostgreSQL capabilities were introduced
|
||||
/***********************************************************************************************************************************
|
||||
PostgreSQL version string constants for use in error messages
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_VERSION_90_STR "9.0"
|
||||
#define PG_VERSION_91_STR "9.1"
|
||||
#define PG_VERSION_92_STR "9.2"
|
||||
#define PG_VERSION_93_STR "9.3"
|
||||
#define PG_VERSION_94_STR "9.4"
|
||||
#define PG_VERSION_95_STR "9.5"
|
||||
|
@ -2087,18 +2087,6 @@ test/src/common/harnessPostgres.h:
|
||||
class: test/harness
|
||||
type: c/h
|
||||
|
||||
test/src/common/harnessPostgres/harness090.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
||||
test/src/common/harnessPostgres/harness091.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
||||
test/src/common/harnessPostgres/harness092.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
||||
test/src/common/harnessPostgres/harness093.c:
|
||||
class: test/harness
|
||||
type: c
|
||||
|
@ -12,13 +12,13 @@
|
||||
# - docker login -u pgbackrest
|
||||
# - VM=XXX;DATE=YYYYMMDDX;BASE=pgbackrest/test:${VM?}-base;docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
|
||||
# **********************************************************************************************************************************
|
||||
20221016A:
|
||||
20221220A:
|
||||
x86_64:
|
||||
u22: eacdfcf2c094e2dadb02fb0828516e14a96facd0
|
||||
u18: 4ab629c57c4be9d5e0c3b6a23d878ea01b6c70f9
|
||||
u20: 2db467d873c0aff06335592c8a22b8441b5c6440
|
||||
u22: 165882634c773173470021ce992a53258a84bbbf
|
||||
|
||||
20220726A:
|
||||
x86_64:
|
||||
f36: 099b329ca7988b05f2cb8ef759e146ea9faab108
|
||||
rh7: 6072f05804b369681efad5cebe01704cb9d2a81a
|
||||
u18: 7cf94d338a8d399f15eb551977a00a7db8e5b879
|
||||
u20: f5b22e94c4bac5589e92977a3edd52507f8fa150
|
||||
|
@ -15,12 +15,6 @@ use pgBackRestDoc::Common::Log;
|
||||
####################################################################################################################################
|
||||
# PostgreSQL version numbers
|
||||
####################################################################################################################################
|
||||
use constant PG_VERSION_90 => '9.0';
|
||||
push @EXPORT, qw(PG_VERSION_90);
|
||||
use constant PG_VERSION_91 => '9.1';
|
||||
push @EXPORT, qw(PG_VERSION_91);
|
||||
use constant PG_VERSION_92 => '9.2';
|
||||
push @EXPORT, qw(PG_VERSION_92);
|
||||
use constant PG_VERSION_93 => '9.3';
|
||||
push @EXPORT, qw(PG_VERSION_93);
|
||||
use constant PG_VERSION_94 => '9.4';
|
||||
@ -42,11 +36,6 @@ use constant PG_VERSION_14 => '14';
|
||||
use constant PG_VERSION_15 => '15';
|
||||
push @EXPORT, qw(PG_VERSION_15);
|
||||
|
||||
use constant PG_VERSION_HOT_STANDBY => PG_VERSION_91;
|
||||
push @EXPORT, qw(PG_VERSION_HOT_STANDBY);
|
||||
use constant PG_VERSION_BACKUP_STANDBY => PG_VERSION_92;
|
||||
push @EXPORT, qw(PG_VERSION_BACKUP_STANDBY);
|
||||
|
||||
####################################################################################################################################
|
||||
# versionSupport
|
||||
#
|
||||
@ -57,9 +46,8 @@ sub versionSupport
|
||||
# Assign function parameters, defaults, and log debug info
|
||||
my ($strOperation) = logDebugParam(__PACKAGE__ . '->versionSupport');
|
||||
|
||||
my @strySupportVersion = (PG_VERSION_90, PG_VERSION_91, PG_VERSION_92, PG_VERSION_93, PG_VERSION_94, PG_VERSION_95,
|
||||
PG_VERSION_96, PG_VERSION_10, PG_VERSION_11, PG_VERSION_12, PG_VERSION_13, PG_VERSION_14,
|
||||
PG_VERSION_15);
|
||||
my @strySupportVersion = (PG_VERSION_93, PG_VERSION_94, PG_VERSION_95, PG_VERSION_96, PG_VERSION_10, PG_VERSION_11,
|
||||
PG_VERSION_12, PG_VERSION_13, PG_VERSION_14, PG_VERSION_15);
|
||||
|
||||
# Return from function and log return values if any
|
||||
return logDebugReturn
|
||||
|
@ -196,9 +196,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
@ -207,9 +204,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB_TEST =>
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
],
|
||||
@ -229,9 +223,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
@ -266,9 +257,6 @@ my $oyVm =
|
||||
|
||||
&VM_DB =>
|
||||
[
|
||||
PG_VERSION_90,
|
||||
PG_VERSION_91,
|
||||
PG_VERSION_92,
|
||||
PG_VERSION_93,
|
||||
PG_VERSION_94,
|
||||
PG_VERSION_95,
|
||||
|
@ -77,12 +77,6 @@ sub new
|
||||
my $oPgControlVersionHash =
|
||||
{
|
||||
# iControlVersion => {iCatalogVersion => strDbVersion}
|
||||
903 =>
|
||||
{
|
||||
201008051 => PG_VERSION_90,
|
||||
201105231 => PG_VERSION_91,
|
||||
},
|
||||
922 => {201204301 => PG_VERSION_92},
|
||||
937 => {201306121 => PG_VERSION_93},
|
||||
942 =>
|
||||
{
|
||||
@ -538,9 +532,8 @@ sub archiveCreate
|
||||
|
||||
my $oStanza = $self->{oStanzaHash}{$strStanza};
|
||||
my $iArchiveIdx = 0;
|
||||
my $bSkipFF = $$oStanza{strDbVersion} <= PG_VERSION_92;
|
||||
|
||||
my $strArchive = defined($$oStanza{strArchiveLast}) ? $self->archiveNext($$oStanza{strArchiveLast}, $bSkipFF) :
|
||||
my $strArchive = defined($$oStanza{strArchiveLast}) ? $self->archiveNext($$oStanza{strArchiveLast}, false) :
|
||||
'000000010000000000000000';
|
||||
|
||||
# Get passphrase (returns undefined if repo not encrypted) to access the archive files
|
||||
@ -560,7 +553,7 @@ sub archiveCreate
|
||||
|
||||
if ($iArchiveIdx < $iArchiveTotal)
|
||||
{
|
||||
$strArchive = $self->archiveNext($strArchive, $bSkipFF);
|
||||
$strArchive = $self->archiveNext($strArchive, false);
|
||||
}
|
||||
}
|
||||
while ($iArchiveIdx < $iArchiveTotal);
|
||||
|
@ -350,15 +350,13 @@ sub clusterCreate
|
||||
# Set defaults
|
||||
my $strWalPath = defined($$hParam{strWalPath}) ? $$hParam{strWalPath} : $self->dbPath() . '/pg_' . $self->walId();
|
||||
|
||||
# Don't link WAL directory for versions < 9.2 because some recovery scenarios won't work
|
||||
$self->executeSimple(
|
||||
$self->pgBinPath() . '/initdb ' .
|
||||
($self->pgVersion() >= PG_VERSION_93 ? ' -k' : '') .
|
||||
($self->pgVersion() >= PG_VERSION_92 ? ' --' . $self->walId() . "dir=${strWalPath}" : '') .
|
||||
($self->pgVersion() >= PG_VERSION_11 ? ' --wal-segsize=1' : '') .
|
||||
' --pgdata=' . $self->dbBasePath() . ' --auth=trust');
|
||||
' --' . $self->walId() . "dir=${strWalPath}" . ' --pgdata=' . $self->dbBasePath() . ' --auth=trust');
|
||||
|
||||
if (!$self->standby() && $self->pgVersion() >= PG_VERSION_HOT_STANDBY)
|
||||
if (!$self->standby())
|
||||
{
|
||||
$self->executeSimple(
|
||||
"echo 'host replication replicator db-standby trust' >> " . $self->dbBasePath() . '/pg_hba.conf');
|
||||
@ -368,7 +366,7 @@ sub clusterCreate
|
||||
{bHotStandby => $$hParam{bHotStandby}, bArchive => $$hParam{bArchive}, bArchiveAlways => $$hParam{bArchiveAlways},
|
||||
bArchiveInvalid => $$hParam{bArchiveInvalid}});
|
||||
|
||||
if (!$self->standby() && $self->pgVersion() >= PG_VERSION_HOT_STANDBY)
|
||||
if (!$self->standby())
|
||||
{
|
||||
$self->sqlExecute("create user replicator replication", {bCommit =>true});
|
||||
}
|
||||
@ -442,7 +440,7 @@ sub clusterStart
|
||||
}
|
||||
|
||||
$strCommand .=
|
||||
($self->pgVersion() >= PG_VERSION_HOT_STANDBY ? ' -c max_wal_senders=3' : '') .
|
||||
' -c max_wal_senders=3' .
|
||||
' -c listen_addresses=\'*\'' .
|
||||
' -c log_directory=\'' . $self->pgLogPath() . "'" .
|
||||
' -c log_filename=\'' . basename($self->pgLogFile()) . "'" .
|
||||
|
@ -241,9 +241,6 @@ sub dbCatalogVersion
|
||||
|
||||
my $hCatalogVersion =
|
||||
{
|
||||
&PG_VERSION_90 => 201008051,
|
||||
&PG_VERSION_91 => 201105231,
|
||||
&PG_VERSION_92 => 201204301,
|
||||
&PG_VERSION_93 => 201306121,
|
||||
&PG_VERSION_94 => 201409291,
|
||||
&PG_VERSION_95 => 201510051,
|
||||
@ -285,9 +282,6 @@ sub dbControlVersion
|
||||
|
||||
my $hControlVersion =
|
||||
{
|
||||
&PG_VERSION_90 => 903,
|
||||
&PG_VERSION_91 => 903,
|
||||
&PG_VERSION_92 => 922,
|
||||
&PG_VERSION_93 => 937,
|
||||
&PG_VERSION_94 => 942,
|
||||
&PG_VERSION_95 => 942,
|
||||
@ -336,9 +330,6 @@ sub controlGenerateContent
|
||||
{
|
||||
32 =>
|
||||
{
|
||||
'9.0' => 140 - length($tControlContent),
|
||||
'9.1' => 140 - length($tControlContent),
|
||||
'9.2' => 156 - length($tControlContent),
|
||||
'9.3' => 180 - length($tControlContent),
|
||||
'9.4' => 188 - length($tControlContent),
|
||||
'9.5' => 200 - length($tControlContent),
|
||||
@ -351,9 +342,6 @@ sub controlGenerateContent
|
||||
|
||||
64 =>
|
||||
{
|
||||
'9.0' => 152 - length($tControlContent),
|
||||
'9.1' => 152 - length($tControlContent),
|
||||
'9.2' => 168 - length($tControlContent),
|
||||
'9.3' => 192 - length($tControlContent),
|
||||
'9.4' => 200 - length($tControlContent),
|
||||
'9.5' => 216 - length($tControlContent),
|
||||
@ -442,9 +430,6 @@ sub walGenerateContent
|
||||
# Get WAL magic for the PG version
|
||||
my $hWalMagic =
|
||||
{
|
||||
&PG_VERSION_90 => hex('0xD064'),
|
||||
&PG_VERSION_91 => hex('0xD066'),
|
||||
&PG_VERSION_92 => hex('0xD071'),
|
||||
&PG_VERSION_93 => hex('0xD075'),
|
||||
&PG_VERSION_94 => hex('0xD07E'),
|
||||
&PG_VERSION_95 => hex('0xD087'),
|
||||
|
@ -874,10 +874,10 @@ sub build
|
||||
next if $strFile =~ ('^' . MANIFEST_PATH_PGREPLSLOT . '\/') && $self->dbVersion() >= PG_VERSION_94;
|
||||
|
||||
# Skip pg_serial/* since these files are reset
|
||||
next if $strFile =~ ('^' . MANIFEST_PATH_PGSERIAL . '\/') && $self->dbVersion() >= PG_VERSION_91;
|
||||
next if $strFile =~ ('^' . MANIFEST_PATH_PGSERIAL . '\/');
|
||||
|
||||
# Skip pg_snapshots/* since these files cannot be reused on recovery
|
||||
next if $strFile =~ ('^' . MANIFEST_PATH_PGSNAPSHOTS . '\/') && $self->dbVersion() >= PG_VERSION_92;
|
||||
next if $strFile =~ ('^' . MANIFEST_PATH_PGSNAPSHOTS . '\/');
|
||||
|
||||
# Skip temporary statistics in pg_stat_tmp even when stats_temp_directory is set because PGSS_TEXT_FILE is always created
|
||||
# there.
|
||||
@ -928,9 +928,7 @@ sub build
|
||||
next;
|
||||
}
|
||||
|
||||
# If version is greater than 9.1 then check for unlogged tables to skip
|
||||
if ($self->dbVersion() >= PG_VERSION_91)
|
||||
{
|
||||
# Check for unlogged tables to skip
|
||||
# Exclude all forks for unlogged tables except the init fork (numbers underscore init and optional dot segment)
|
||||
if ($strBaseName =~ '^[0-9]+(|\_(fsm|vm)){0,1}(\.[0-9]+){0,1}$')
|
||||
{
|
||||
@ -948,7 +946,6 @@ sub build
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Exclude files requested by the user
|
||||
if (defined($rhExclude))
|
||||
|
@ -68,7 +68,7 @@ sub run
|
||||
my $oExpireTest = new pgBackRestTest::Env::ExpireEnvTest(
|
||||
$oHostBackup, $self->backrestExe(), storageRepo(), $oHostDbPrimary->dbPath(), $self);
|
||||
|
||||
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_92);
|
||||
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_96);
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strDescription = 'Nothing to expire';
|
||||
@ -160,7 +160,7 @@ sub run
|
||||
my $oExpireTest = new pgBackRestTest::Env::ExpireEnvTest(
|
||||
$oHostBackup, $self->backrestExe(), storageRepo(), $oHostDbPrimary->dbPath(), $self);
|
||||
|
||||
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_92);
|
||||
$oExpireTest->stanzaCreate($self->stanza(), PG_VERSION_96);
|
||||
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strDescription = 'Create backups in current db version';
|
||||
|
@ -52,14 +52,11 @@ sub run
|
||||
|
||||
foreach my $rhRun
|
||||
(
|
||||
{pg => '9.0', dst => 'db-primary', tls => 0, stg => GCS, enc => 1, cmp => BZ2, rt => 2, bnd => 1},
|
||||
{pg => '9.1', dst => 'db-standby', tls => 1, stg => GCS, enc => 0, cmp => GZ, rt => 1, bnd => 0},
|
||||
{pg => '9.2', dst => 'db-standby', tls => 0, stg => POSIX, enc => 1, cmp => NONE, rt => 1, bnd => 1},
|
||||
{pg => '9.3', dst => 'backup', tls => 0, stg => AZURE, enc => 0, cmp => NONE, rt => 2, bnd => 0},
|
||||
{pg => '9.4', dst => 'db-standby', tls => 0, stg => POSIX, enc => 1, cmp => LZ4, rt => 1, bnd => 1},
|
||||
{pg => '9.5', dst => 'backup', tls => 1, stg => S3, enc => 0, cmp => BZ2, rt => 1, bnd => 0},
|
||||
{pg => '9.6', dst => 'backup', tls => 0, stg => POSIX, enc => 0, cmp => NONE, rt => 2, bnd => 1},
|
||||
{pg => '10', dst => 'db-standby', tls => 1, stg => S3, enc => 1, cmp => GZ, rt => 2, bnd => 0},
|
||||
{pg => '10', dst => 'db-standby', tls => 1, stg => GCS, enc => 1, cmp => GZ, rt => 2, bnd => 0},
|
||||
{pg => '11', dst => 'backup', tls => 1, stg => AZURE, enc => 0, cmp => ZST, rt => 2, bnd => 1},
|
||||
{pg => '12', dst => 'backup', tls => 0, stg => S3, enc => 1, cmp => LZ4, rt => 1, bnd => 0},
|
||||
{pg => '13', dst => 'db-standby', tls => 1, stg => GCS, enc => 0, cmp => ZST, rt => 1, bnd => 1},
|
||||
@ -72,7 +69,6 @@ sub run
|
||||
|
||||
# Get run parameters
|
||||
my $bHostBackup = $rhRun->{dst} eq HOST_BACKUP ? true : false;
|
||||
my $bHostStandby = $self->pgVersion() >= PG_VERSION_HOT_STANDBY ? true : false;
|
||||
my $bTls = $rhRun->{tls};
|
||||
my $strBackupDestination = $rhRun->{dst};
|
||||
my $strStorage = $rhRun->{stg};
|
||||
@ -86,13 +82,13 @@ sub run
|
||||
|
||||
# Increment the run, log, and decide whether this unit test should be run
|
||||
next if !$self->begin(
|
||||
"bkp ${bHostBackup}, sby ${bHostStandby}, tls ${bTls}, dst ${strBackupDestination}, cmp ${strCompressType}" .
|
||||
", storage ${strStorage}, enc ${bRepoEncrypt}");
|
||||
"bkp ${bHostBackup}, tls ${bTls}, dst ${strBackupDestination}, cmp ${strCompressType}, storage ${strStorage}" .
|
||||
", enc ${bRepoEncrypt}");
|
||||
|
||||
# Create hosts, file object, and config
|
||||
my ($oHostDbPrimary, $oHostDbStandby, $oHostBackup) = $self->setup(
|
||||
false,
|
||||
{bHostBackup => $bHostBackup, bStandby => $bHostStandby, bTls => $bTls, strBackupDestination => $strBackupDestination,
|
||||
{bHostBackup => $bHostBackup, bStandby => true, bTls => $bTls, strBackupDestination => $strBackupDestination,
|
||||
strCompressType => $strCompressType, bArchiveAsync => false, strStorage => $strStorage,
|
||||
bRepoEncrypt => $bRepoEncrypt, iRepoTotal => $iRepoTotal, bBundle => $bBundle});
|
||||
|
||||
@ -254,15 +250,10 @@ sub run
|
||||
|
||||
# Setup replica
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if ($bHostStandby)
|
||||
{
|
||||
my %oRemapHash;
|
||||
$oRemapHash{&MANIFEST_TARGET_PGDATA} = $oHostDbStandby->dbBasePath();
|
||||
|
||||
if ($oHostDbStandby->pgVersion() >= PG_VERSION_92)
|
||||
{
|
||||
$oHostDbStandby->linkRemap($oManifest->walPath(), $oHostDbStandby->dbPath() . '/' . $oManifest->walPath());
|
||||
}
|
||||
|
||||
$oHostDbStandby->restore(
|
||||
'restore backup on replica', 'latest',
|
||||
@ -283,11 +274,11 @@ sub run
|
||||
# Update message for standby
|
||||
$oHostDbPrimary->sqlExecute("update test set message = '$strStandbyMessage'");
|
||||
|
||||
if ($oHostDbStandby->pgVersion() >= PG_VERSION_BACKUP_STANDBY && !$bTls)
|
||||
if (!$bTls)
|
||||
{
|
||||
# If there is only a primary and a replica and the replica is the backup destination, then if pg2-host and
|
||||
# pg256-host are BOGUS, confirm failure to reach the primary
|
||||
if (!$bHostBackup && $bHostStandby && $strBackupDestination eq HOST_DB_STANDBY)
|
||||
if (!$bHostBackup && $strBackupDestination eq HOST_DB_STANDBY)
|
||||
{
|
||||
my $strStandbyBackup = $oHostBackup->backup(
|
||||
CFGOPTVAL_BACKUP_TYPE_FULL, 'backup from standby, failure to reach primary',
|
||||
@ -303,14 +294,9 @@ sub run
|
||||
|
||||
my $strStandbyBackup = $oHostBackup->backup(
|
||||
CFGOPTVAL_BACKUP_TYPE_FULL, 'backup from standby',
|
||||
{bStandby => true,
|
||||
iExpectedExitStatus => $oHostDbStandby->pgVersion() >= PG_VERSION_BACKUP_STANDBY ? undef : ERROR_CONFIG,
|
||||
strOptionalParam => '--repo1-retention-full=1'});
|
||||
{bStandby => true, iExpectedExitStatus => undef, strOptionalParam => '--repo1-retention-full=1'});
|
||||
|
||||
if ($oHostDbStandby->pgVersion() >= PG_VERSION_BACKUP_STANDBY)
|
||||
{
|
||||
$strFullBackup = $strStandbyBackup;
|
||||
}
|
||||
|
||||
# ??? Removed temporarily until manifest build can be brought back into the check command
|
||||
# # Create a directory in pg_data location that is only readable by root to ensure manifest->build is called by check
|
||||
@ -340,7 +326,6 @@ sub run
|
||||
|
||||
# Shutdown the standby before creating tablespaces (this will error since paths are different)
|
||||
$oHostDbStandby->clusterStop({bIgnoreLogError => true});
|
||||
}
|
||||
|
||||
my $strAdhocBackup;
|
||||
|
||||
@ -483,10 +468,7 @@ sub run
|
||||
$oHostDbPrimary->sqlExecute("update test set message = '$strNameMessage'", {bCommit => true});
|
||||
$oHostDbPrimary->sqlWalRotate();
|
||||
|
||||
if ($oHostDbPrimary->pgVersion() >= PG_VERSION_91)
|
||||
{
|
||||
$oHostDbPrimary->sqlExecute("select pg_create_restore_point('${strNameTarget}')");
|
||||
}
|
||||
|
||||
&log(INFO, " name target is ${strNameTarget}");
|
||||
|
||||
@ -618,8 +600,7 @@ sub run
|
||||
undef, $strFullBackup, {bForce => true, strType => CFGOPTVAL_RESTORE_TYPE_IMMEDIATE, strTargetAction => 'promote'});
|
||||
|
||||
$oHostDbPrimary->clusterStart();
|
||||
$oHostDbPrimary->sqlSelectOneTest(
|
||||
'select message from test', ($bHostStandby ? $strStandbyMessage : $strFullMessage));
|
||||
$oHostDbPrimary->sqlSelectOneTest('select message from test', ($strStandbyMessage));
|
||||
}
|
||||
|
||||
# Restore (restore type = xid, inclusive)
|
||||
@ -635,8 +616,7 @@ sub run
|
||||
|
||||
$oHostDbPrimary->restore(
|
||||
undef, $strIncrBackup,
|
||||
{bForce => true, strType => CFGOPTVAL_RESTORE_TYPE_XID, strTarget => $strXidTarget,
|
||||
strTargetAction => $oHostDbPrimary->pgVersion() >= PG_VERSION_91 ? 'promote' : undef,
|
||||
{bForce => true, strType => CFGOPTVAL_RESTORE_TYPE_XID, strTarget => $strXidTarget, strTargetAction => 'promote',
|
||||
strTargetTimeline => $oHostDbPrimary->pgVersion() >= PG_VERSION_12 ? 'current' : undef,
|
||||
strOptionalParam => '--tablespace-map-all=../../tablespace', bTablespace => false,
|
||||
iRepo => $iRepoTotal});
|
||||
@ -687,8 +667,7 @@ sub run
|
||||
|
||||
$oHostDbPrimary->restore(
|
||||
undef, 'latest',
|
||||
{bDelta => true, strType => CFGOPTVAL_RESTORE_TYPE_TIME, strTarget => $strTimeTarget,
|
||||
strTargetAction => $oHostDbPrimary->pgVersion() >= PG_VERSION_91 ? 'promote' : undef,
|
||||
{bDelta => true, strType => CFGOPTVAL_RESTORE_TYPE_TIME, strTarget => $strTimeTarget, strTargetAction => 'promote',
|
||||
strTargetTimeline => $oHostDbPrimary->pgVersion() >= PG_VERSION_12 ? 'current' : undef,
|
||||
strBackupExpected => $strFullBackup});
|
||||
|
||||
@ -704,7 +683,7 @@ sub run
|
||||
$oHostDbPrimary->restore(
|
||||
undef, $strIncrBackup,
|
||||
{bDelta => true, strType => CFGOPTVAL_RESTORE_TYPE_XID, strTarget => $strXidTarget, bTargetExclusive => true,
|
||||
strTargetAction => $oHostDbPrimary->pgVersion() >= PG_VERSION_91 ? 'promote' : undef,
|
||||
strTargetAction => 'promote',
|
||||
strTargetTimeline => $oHostDbPrimary->pgVersion() >= PG_VERSION_12 ? 'current' : undef,
|
||||
iRepo => $iRepoTotal});
|
||||
|
||||
@ -713,8 +692,6 @@ sub run
|
||||
|
||||
# Restore (restore type = name)
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if ($oHostDbPrimary->pgVersion() >= PG_VERSION_91)
|
||||
{
|
||||
&log(INFO, ' testing recovery type = ' . CFGOPTVAL_RESTORE_TYPE_NAME);
|
||||
|
||||
$oHostDbPrimary->clusterStop();
|
||||
@ -727,7 +704,6 @@ sub run
|
||||
|
||||
$oHostDbPrimary->clusterStart();
|
||||
$oHostDbPrimary->sqlSelectOneTest('select message from test', $strNameMessage);
|
||||
}
|
||||
|
||||
# Restore (restore type = default, timeline = created by type = xid, inclusive recovery)
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
@ -745,11 +721,9 @@ sub run
|
||||
$oHostDbPrimary->clusterStart({bHotStandby => true});
|
||||
$oHostDbPrimary->sqlSelectOneTest('select message from test', $strTimelineMessage, {iTimeout => 120});
|
||||
|
||||
# Stop clusters to catch any errors in the postgres log. Stopping the cluster has started consistently running out of memory
|
||||
# on PostgreSQL 9.1. This seems to have happened after pulling in new packages at some point so it might be build related.
|
||||
# Stopping the cluster is not critical for 9.1 so skip it.
|
||||
# Stop clusters to catch any errors in the postgres log
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostDbPrimary->clusterStop({bStop => $oHostDbPrimary->pgVersion() != PG_VERSION_91});
|
||||
$oHostDbPrimary->clusterStop();
|
||||
|
||||
# Stanza-delete --force without access to pgbackrest on database host. This test is not version specific so is run on only
|
||||
# one version.
|
||||
|
@ -11,18 +11,6 @@ Harness for PostgreSQL Interface
|
||||
/***********************************************************************************************************************************
|
||||
Interface definition
|
||||
***********************************************************************************************************************************/
|
||||
uint32_t hrnPgInterfaceCatalogVersion090(void);
|
||||
void hrnPgInterfaceControl090(PgControl pgControl, unsigned char *buffer);
|
||||
void hrnPgInterfaceWal090(PgWal pgWal, unsigned char *buffer);
|
||||
|
||||
uint32_t hrnPgInterfaceCatalogVersion091(void);
|
||||
void hrnPgInterfaceControl091(PgControl pgControl, unsigned char *buffer);
|
||||
void hrnPgInterfaceWal091(PgWal pgWal, unsigned char *buffer);
|
||||
|
||||
uint32_t hrnPgInterfaceCatalogVersion092(void);
|
||||
void hrnPgInterfaceControl092(PgControl pgControl, unsigned char *buffer);
|
||||
void hrnPgInterfaceWal092(PgWal pgWal, unsigned char *buffer);
|
||||
|
||||
uint32_t hrnPgInterfaceCatalogVersion093(void);
|
||||
void hrnPgInterfaceControl093(PgControl pgControl, unsigned char *buffer);
|
||||
void hrnPgInterfaceWal093(PgWal pgWal, unsigned char *buffer);
|
||||
@ -150,26 +138,6 @@ static const HrnPgInterface hrnPgInterface[] =
|
||||
.control = hrnPgInterfaceControl093,
|
||||
.wal = hrnPgInterfaceWal093,
|
||||
},
|
||||
{
|
||||
.version = PG_VERSION_92,
|
||||
|
||||
.catalogVersion = hrnPgInterfaceCatalogVersion092,
|
||||
.control = hrnPgInterfaceControl092,
|
||||
.wal = hrnPgInterfaceWal092,
|
||||
},
|
||||
{
|
||||
.version = PG_VERSION_91,
|
||||
.catalogVersion = hrnPgInterfaceCatalogVersion091,
|
||||
.control = hrnPgInterfaceControl091,
|
||||
.wal = hrnPgInterfaceWal091,
|
||||
},
|
||||
{
|
||||
.version = PG_VERSION_90,
|
||||
|
||||
.catalogVersion = hrnPgInterfaceCatalogVersion090,
|
||||
.control = hrnPgInterfaceControl090,
|
||||
.wal = hrnPgInterfaceWal090,
|
||||
},
|
||||
};
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -17,12 +17,6 @@ Control file size used to create pg_control
|
||||
/***********************************************************************************************************************************
|
||||
System id constants by version
|
||||
***********************************************************************************************************************************/
|
||||
#define HRN_PG_SYSTEMID_90 (10000000000000000000ULL + (uint64_t)PG_VERSION_90)
|
||||
#define HRN_PG_SYSTEMID_90_Z "10000000000000090000"
|
||||
#define HRN_PG_SYSTEMID_91 (10000000000000000000ULL + (uint64_t)PG_VERSION_91)
|
||||
#define HRN_PG_SYSTEMID_91_Z "10000000000000090100"
|
||||
#define HRN_PG_SYSTEMID_92 (10000000000000000000ULL + (uint64_t)PG_VERSION_92)
|
||||
#define HRN_PG_SYSTEMID_92_Z "10000000000000090200"
|
||||
#define HRN_PG_SYSTEMID_93 (10000000000000000000ULL + (uint64_t)PG_VERSION_93)
|
||||
#define HRN_PG_SYSTEMID_93_Z "10000000000000090300"
|
||||
#define HRN_PG_SYSTEMID_94 (10000000000000000000ULL + (uint64_t)PG_VERSION_94)
|
||||
@ -43,6 +37,8 @@ System id constants by version
|
||||
#define HRN_PG_SYSTEMID_13_Z "10000000000000130000"
|
||||
#define HRN_PG_SYSTEMID_14 (10000000000000000000ULL + (uint64_t)PG_VERSION_14)
|
||||
#define HRN_PG_SYSTEMID_14_Z "10000000000000140000"
|
||||
#define HRN_PG_SYSTEMID_15 (10000000000000000000ULL + (uint64_t)PG_VERSION_15)
|
||||
#define HRN_PG_SYSTEMID_15_Z "10000000000000150000"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Put a control file to storage
|
||||
|
@ -1,10 +0,0 @@
|
||||
/***********************************************************************************************************************************
|
||||
Harness for PostgreSQL Interface (see PG_VERSION for version)
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#define PG_VERSION PG_VERSION_90
|
||||
|
||||
#include "common/harnessPostgres/harnessVersion.intern.h"
|
||||
|
||||
HRN_PG_INTERFACE(090);
|
@ -1,10 +0,0 @@
|
||||
/***********************************************************************************************************************************
|
||||
Harness for PostgreSQL Interface (see PG_VERSION for version)
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#define PG_VERSION PG_VERSION_91
|
||||
|
||||
#include "common/harnessPostgres/harnessVersion.intern.h"
|
||||
|
||||
HRN_PG_INTERFACE(091);
|
@ -1,10 +0,0 @@
|
||||
/***********************************************************************************************************************************
|
||||
Harness for PostgreSQL Interface (see PG_VERSION for version)
|
||||
***********************************************************************************************************************************/
|
||||
#include "build.auto.h"
|
||||
|
||||
#define PG_VERSION PG_VERSION_92
|
||||
|
||||
#include "common/harnessPostgres/harnessVersion.intern.h"
|
||||
|
||||
HRN_PG_INTERFACE(092);
|
@ -16,7 +16,7 @@ Get the catalog version
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#define HRN_PG_INTERFACE_CATALOG_VERSION(version) \
|
||||
uint32_t \
|
||||
@ -56,34 +56,6 @@ Create a pg_control file
|
||||
}; \
|
||||
}
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
|
||||
#define HRN_PG_INTERFACE_CONTROL_TEST(version) \
|
||||
void \
|
||||
hrnPgInterfaceControl##version(PgControl pgControl, unsigned char *buffer) \
|
||||
{ \
|
||||
ASSERT(buffer != NULL); \
|
||||
ASSERT(!pgControl.pageChecksum); \
|
||||
\
|
||||
*(ControlFileData *)buffer = (ControlFileData) \
|
||||
{ \
|
||||
.system_identifier = pgControl.systemId, \
|
||||
.pg_control_version = PG_CONTROL_VERSION, \
|
||||
.catalog_version_no = pgControl.catalogVersion, \
|
||||
.checkPoint = \
|
||||
{ \
|
||||
.xlogid = (uint32_t)(pgControl.checkpoint >> 32), \
|
||||
.xrecoff = (uint32_t)(pgControl.checkpoint & 0xFFFFFFFF), \
|
||||
}, \
|
||||
.checkPointCopy = \
|
||||
{ \
|
||||
.ThisTimeLineID = pgControl.timeline, \
|
||||
}, \
|
||||
.blcksz = pgControl.pageSize, \
|
||||
.xlog_seg_size = pgControl.walSegmentSize, \
|
||||
}; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -91,7 +63,7 @@ Create a WAL file
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_90
|
||||
#elif PG_VERSION >= PG_VERSION_93
|
||||
|
||||
#define HRN_PG_INTERFACE_WAL_TEST(version) \
|
||||
void \
|
||||
|
@ -569,14 +569,7 @@ Macros for defining groups of functions that implement various queries and comma
|
||||
/***********************************************************************************************************************************
|
||||
Macros to simplify dbOpen() for specific database versions
|
||||
***********************************************************************************************************************************/
|
||||
#define HRNPQ_MACRO_OPEN_LE_91(sessionParam, connectParam, pgVersion, pgPathParam, archiveMode, archiveCommand) \
|
||||
HRNPQ_MACRO_OPEN(sessionParam, connectParam), \
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(sessionParam), \
|
||||
HRNPQ_MACRO_SET_CLIENT_ENCODING(sessionParam), \
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(sessionParam, pgVersion, pgPathParam, archiveMode, archiveCommand), \
|
||||
HRNPQ_MACRO_SET_APPLICATION_NAME(sessionParam)
|
||||
|
||||
#define HRNPQ_MACRO_OPEN_GE_92(sessionParam, connectParam, pgVersion, pgPathParam, standbyParam, archiveMode, archiveCommand) \
|
||||
#define HRNPQ_MACRO_OPEN_GE_93(sessionParam, connectParam, pgVersion, pgPathParam, standbyParam, archiveMode, archiveCommand) \
|
||||
HRNPQ_MACRO_OPEN(sessionParam, connectParam), \
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(sessionParam), \
|
||||
HRNPQ_MACRO_SET_CLIENT_ENCODING(sessionParam), \
|
||||
|
@ -76,7 +76,7 @@ testRun(void)
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageTest, "src/build/postgres/postgres.yaml",
|
||||
"version:\n"
|
||||
" - 9.0\n"
|
||||
" - 9.6\n"
|
||||
" - 11:\n"
|
||||
" release: false\n");
|
||||
|
||||
@ -127,20 +127,20 @@ testRun(void)
|
||||
"#undef PG_INTERFACE_CONTROL\n"
|
||||
"\n"
|
||||
COMMENT_BLOCK_BEGIN "\n"
|
||||
"PostgreSQL 9.0 interface\n"
|
||||
"PostgreSQL 9.6 interface\n"
|
||||
COMMENT_BLOCK_END "\n"
|
||||
"#define PG_VERSION PG_VERSION_90\n"
|
||||
"#define PG_VERSION PG_VERSION_96\n"
|
||||
"\n"
|
||||
"#define enum1 enum1_90\n"
|
||||
"#define enum2 enum2_90\n"
|
||||
"#define enum_type enum_type_90\n"
|
||||
"#define int64 int64_90\n"
|
||||
"#define struct_type struct_type_90\n"
|
||||
"#define enum1 enum1_96\n"
|
||||
"#define enum2 enum2_96\n"
|
||||
"#define enum_type enum_type_96\n"
|
||||
"#define int64 int64_96\n"
|
||||
"#define struct_type struct_type_96\n"
|
||||
"\n"
|
||||
"#include \"postgres/interface/version.intern.h\"\n"
|
||||
"\n"
|
||||
"PG_INTERFACE_CONTROL_IS(90);\n"
|
||||
"PG_INTERFACE_CONTROL(90);\n"
|
||||
"PG_INTERFACE_CONTROL_IS(96);\n"
|
||||
"PG_INTERFACE_CONTROL(96);\n"
|
||||
"\n"
|
||||
"#undef enum1\n"
|
||||
"#undef enum2\n"
|
||||
@ -168,10 +168,10 @@ testRun(void)
|
||||
" .control = pgInterfaceControl11,\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" .version = PG_VERSION_90,\n"
|
||||
" .version = PG_VERSION_96,\n"
|
||||
"\n"
|
||||
" .controlIs = pgInterfaceControlIs90,\n"
|
||||
" .control = pgInterfaceControl90,\n"
|
||||
" .controlIs = pgInterfaceControlIs96,\n"
|
||||
" .control = pgInterfaceControl96,\n"
|
||||
" },\n"
|
||||
"};\n");
|
||||
}
|
||||
|
@ -315,9 +315,6 @@ testRun(void)
|
||||
TEST_RESULT_STR_Z(
|
||||
walSegmentNext(STRDEF("0000009900000001000000FF"), 16 * 1024 * 1024, PG_VERSION_93), "000000990000000200000000",
|
||||
"get next overflow >= 9.3");
|
||||
TEST_RESULT_STR_Z(
|
||||
walSegmentNext(STRDEF("0000000100000001000000FE"), 16 * 1024 * 1024, PG_VERSION_92), "000000010000000200000000",
|
||||
"get next overflow < 9.3");
|
||||
TEST_RESULT_STR_Z(
|
||||
walSegmentNext(STRDEF("000000010000000100000003"), 1024 * 1024 * 1024, PG_VERSION_11), "000000010000000200000000",
|
||||
"get next overflow >= 11/1GB");
|
||||
@ -333,16 +330,12 @@ testRun(void)
|
||||
TEST_TITLE("single segment");
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walSegmentRange(STRDEF("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "000000010000000100000000\n",
|
||||
walSegmentRange(STRDEF("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_93, 1), "000000010000000100000000\n",
|
||||
"get single");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check range by version");
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4),
|
||||
"0000000100000001000000FD\n0000000100000001000000FE\n000000010000000200000000\n000000010000000200000001\n",
|
||||
"get range < 9.3");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walSegmentRange(STRDEF("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4),
|
||||
"0000000100000001000000FD\n0000000100000001000000FE\n0000000100000001000000FF\n000000010000000200000000\n",
|
||||
|
@ -36,7 +36,7 @@ testRun(void)
|
||||
TEST_TITLE("path missing");
|
||||
|
||||
TEST_ERROR(
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
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_92),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
"000000010000000100000001\n000000010000000100000002\n", "queue size smaller than min");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
@ -54,27 +54,15 @@ testRun(void)
|
||||
queueSize = (16 * 1024 * 1024) * 3;
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||
queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_95),
|
||||
"000000010000000100000001\n000000010000000100000002\n000000010000000100000003\n", "empty queue");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("pg version earlier than 9.3");
|
||||
TEST_TITLE("ok/junk status files");
|
||||
|
||||
Buffer *walSegmentBuffer = bufNew(walSegmentSize);
|
||||
memset(bufPtr(walSegmentBuffer), 0, walSegmentSize);
|
||||
|
||||
HRN_STORAGE_PUT(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/0000000100000001000000FE", walSegmentBuffer);
|
||||
HRN_STORAGE_PUT(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN "/0000000100000001000000FF", walSegmentBuffer);
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
queueNeed(STRDEF("0000000100000001000000FE"), false, queueSize, walSegmentSize, PG_VERSION_92),
|
||||
"000000010000000200000000\n000000010000000200000001\n", "queue has wal < 9.3");
|
||||
|
||||
TEST_STORAGE_LIST(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE_IN, "0000000100000001000000FE\n", .comment = "check queue");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("pg >= 9.3 and ok/junk status files");
|
||||
|
||||
walSegmentSize = 1024 * 1024;
|
||||
queueSize = walSegmentSize * 5;
|
||||
|
||||
|
@ -364,8 +364,7 @@ testBackupPqScript(unsigned int pgVersion, time_t backupTimeStart, TestBackupPqS
|
||||
InfoArchive *infoArchive = infoArchiveLoadFile(storageRepo(), INFO_ARCHIVE_PATH_FILE_STR, cipherTypeNone, NULL);
|
||||
const String *archiveId = infoArchiveId(infoArchive);
|
||||
StringList *walSegmentList = pgLsnRangeToWalSegmentList(
|
||||
pgControl.version, param.timeline, lsnStart - pgControl.walSegmentSize,
|
||||
param.noWal ? lsnStart - pgControl.walSegmentSize : lsnStop,
|
||||
param.timeline, lsnStart - pgControl.walSegmentSize, param.noWal ? lsnStart - pgControl.walSegmentSize : lsnStop,
|
||||
pgControl.walSegmentSize);
|
||||
|
||||
Buffer *walBuffer = bufNew((size_t)pgControl.walSegmentSize);
|
||||
@ -400,7 +399,7 @@ testBackupPqScript(unsigned int pgVersion, time_t backupTimeStart, TestBackupPqS
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_95, pg1Path, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, pg1Path, false, NULL, NULL),
|
||||
|
||||
// Get start time
|
||||
HRNPQ_MACRO_TIME_QUERY(1, (int64_t)backupTimeStart * 1000),
|
||||
@ -434,7 +433,7 @@ testBackupPqScript(unsigned int pgVersion, time_t backupTimeStart, TestBackupPqS
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_95, pg1Path, false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, pg1Path, false, NULL, NULL),
|
||||
|
||||
// Get start time
|
||||
HRNPQ_MACRO_TIME_QUERY(1, (int64_t)backupTimeStart * 1000),
|
||||
@ -1493,28 +1492,13 @@ testRun(void)
|
||||
// Set log level to detail
|
||||
harnessLogLevelSet(logLevelDetail);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error when backup from standby is not supported");
|
||||
|
||||
StringList *argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg1");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||
hrnCfgArgRawBool(argList, cfgOptBackupStandby, true);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
TEST_ERROR(
|
||||
backupInit(infoBackupNew(PG_VERSION_91, HRN_PG_SYSTEMID_91, hrnPgCatalogVersion(PG_VERSION_91), NULL)),
|
||||
ConfigError, "option 'backup-standby' not valid for PostgreSQL < 9.2");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("warn and reset when backup from standby used in offline mode");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_96);
|
||||
|
||||
argList = strLstNew();
|
||||
StringList *argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg1");
|
||||
@ -1524,7 +1508,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
backupInit(infoBackupNew(PG_VERSION_92, HRN_PG_SYSTEMID_92, hrnPgCatalogVersion(PG_VERSION_92), NULL)),
|
||||
backupInit(infoBackupNew(PG_VERSION_96, HRN_PG_SYSTEMID_96, hrnPgCatalogVersion(PG_VERSION_96), NULL)),
|
||||
"backup init");
|
||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptBackupStandby), false, "check backup-standby");
|
||||
|
||||
@ -1558,28 +1542,6 @@ testRun(void)
|
||||
" " HRN_PG_SYSTEMID_11_Z "\n"
|
||||
"HINT: is this the correct stanza?");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("reset stop-auto when PostgreSQL < 9.3");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_90);
|
||||
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
hrnCfgArgRawZ(argList, cfgOptPgPath, TEST_PATH "/pg1");
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoRetentionFull, "1");
|
||||
hrnCfgArgRawBool(argList, cfgOptOnline, false);
|
||||
hrnCfgArgRawBool(argList, cfgOptStopAuto, true);
|
||||
HRN_CFG_LOAD(cfgCmdBackup, argList);
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
backupInit(infoBackupNew(PG_VERSION_90, HRN_PG_SYSTEMID_90, hrnPgCatalogVersion(PG_VERSION_90), NULL)),
|
||||
"backup init");
|
||||
TEST_RESULT_BOOL(cfgOptionBool(cfgOptStopAuto), false, "check stop-auto");
|
||||
|
||||
TEST_RESULT_LOG("P00 WARN: stop-auto option is only available in PostgreSQL >= 9.3");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("reset checksum-page when the cluster does not have checksums enabled");
|
||||
|
||||
@ -1608,7 +1570,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -1639,7 +1601,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -1656,7 +1618,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -1698,7 +1660,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// Advance the time slowly to force retries
|
||||
HRNPQ_MACRO_TIME_QUERY(1, 1575392588998),
|
||||
@ -1964,7 +1926,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_90);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_93);
|
||||
|
||||
cmdStanzaCreate();
|
||||
TEST_RESULT_LOG("P00 INFO: stanza-create for stanza 'test1' on repo1");
|
||||
@ -2016,8 +1978,8 @@ testRun(void)
|
||||
"P00 INFO: new backup label = [FULL-1]\n"
|
||||
"P00 INFO: full backup size = 8KB, file total = 2",
|
||||
TEST_64BIT() ?
|
||||
(TEST_BIG_ENDIAN() ? "ec84602c8b4f62bd0ef10bd3dfcb04c3b3ce4a35" : "b7ec43e4646f5d06c95881df0c572630a1221377") :
|
||||
"f21ff9abdcd1ec2f600d4ee8e5792c9b61eb2e37");
|
||||
(TEST_BIG_ENDIAN() ? "542c539fabf827717812b872913d593766848434" : "cc603d502a8ecede30fa96b0b0dc35014950aba2") :
|
||||
"aca8af76589171a70c901e13080e359efedd7a08");
|
||||
|
||||
// Make pg no longer appear to be running
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), PG_FILE_POSTMTRPID, .errorOnMissing = true);
|
||||
|
@ -56,11 +56,11 @@ testRun(void)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("standby only, repo local - fail to find primary database");
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_96);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -80,13 +80,13 @@ testRun(void)
|
||||
hrnCfgArgRawZ(argList, cfgOptArchiveTimeout, ".5");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_96);
|
||||
|
||||
// Two standbys found but no primary
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(8, "dbname='postgres' port=5433", PG_VERSION_93, "/pgdata", true, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -109,7 +109,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, "/pgdata", true, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -117,7 +117,7 @@ testRun(void)
|
||||
// Only confirming we get passed the check for repoIsLocal || more than one pg-path configured
|
||||
TEST_ERROR(
|
||||
cmdCheck(), DbMismatchError,
|
||||
"version '9.2' and path '/pgdata' queried from cluster do not match version '9.2' and '" TEST_PATH "/pg' read from"
|
||||
"version '9.6' and path '/pgdata' queried from cluster do not match version '9.6' 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.");
|
||||
|
||||
@ -135,7 +135,7 @@ testRun(void)
|
||||
// Primary database connection ok
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -167,13 +167,13 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
// Create pg_control for standby
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_15);
|
||||
|
||||
// Standby database path doesn't match pg_control
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH, true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH, true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -183,7 +183,7 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(
|
||||
cmdCheck(), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_92_STR
|
||||
"version '" PG_VERSION_15_STR "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_15_STR
|
||||
"' 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.");
|
||||
|
||||
@ -191,36 +191,36 @@ testRun(void)
|
||||
TEST_TITLE("standby and primary database - error on primary but standby check ok");
|
||||
|
||||
// Create pg_control for primary
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_15);
|
||||
|
||||
// Create info files
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_ARCHIVE_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_92_Z "\n"
|
||||
"db-version=\"9.2\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_15_Z "\n"
|
||||
"db-version=\"15\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_92_Z ",\"db-version\":\"9.2\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_15_Z ",\"db-version\":\"15\"}\n");
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(0), INFO_BACKUP_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=920\n"
|
||||
"db-catalog-version=202209061\n"
|
||||
"db-control-version=1300\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_92_Z "\n"
|
||||
"db-version=\"9.2\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_15_Z "\n"
|
||||
"db-version=\"15\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":920,\"db-system-id\":" HRN_PG_SYSTEMID_92_Z ","
|
||||
"\"db-version\":\"9.2\"}\n");
|
||||
"1={\"db-catalog-version\":202209061,\"db-control-version\":1300,\"db-system-id\":" HRN_PG_SYSTEMID_15_Z ","
|
||||
"\"db-version\":\"15\"}\n");
|
||||
|
||||
// Single repo config - error when checking archive mode setting on database
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", false, "off", NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, "off", NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
@ -244,8 +244,8 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_15, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -285,30 +285,30 @@ testRun(void)
|
||||
storageRepoIdxWrite(1), INFO_ARCHIVE_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_92_Z "\n"
|
||||
"db-version=\"9.2\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_15_Z "\n"
|
||||
"db-version=\"15\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_92_Z ",\"db-version\":\"9.2\"}\n");
|
||||
"1={\"db-id\":" HRN_PG_SYSTEMID_15_Z ",\"db-version\":\"15\"}\n");
|
||||
HRN_INFO_PUT(
|
||||
storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE,
|
||||
"[db]\n"
|
||||
"db-catalog-version=201608131\n"
|
||||
"db-control-version=920\n"
|
||||
"db-catalog-version=202209061\n"
|
||||
"db-control-version=1300\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_92_Z "\n"
|
||||
"db-version=\"9.2\"\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_15_Z "\n"
|
||||
"db-version=\"15\"\n"
|
||||
"\n"
|
||||
"[db:history]\n"
|
||||
"1={\"db-catalog-version\":201608131,\"db-control-version\":920,\"db-system-id\":" HRN_PG_SYSTEMID_92_Z ","
|
||||
"\"db-version\":\"9.2\"}\n");
|
||||
"1={\"db-catalog-version\":202209061,\"db-control-version\":1300,\"db-system-id\":" HRN_PG_SYSTEMID_15_Z ","
|
||||
"\"db-version\":\"15\"}\n");
|
||||
|
||||
// Error when WAL segment not found
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "wal", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -335,18 +335,18 @@ testRun(void)
|
||||
// WAL segment switch is performed once for all repos
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(1, "1/1"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "wal", "000000010000000100000001"),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
HRN_STORAGE_PUT(
|
||||
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/9.2-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE "/15-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
buffer);
|
||||
HRN_STORAGE_PUT(
|
||||
storageRepoIdxWrite(1), STORAGE_REPO_ARCHIVE "/9.2-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
storageRepoIdxWrite(1), STORAGE_REPO_ARCHIVE "/15-1/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
buffer);
|
||||
|
||||
TEST_RESULT_VOID(cmdCheck(), "check primary, WAL archived");
|
||||
@ -354,10 +354,10 @@ testRun(void)
|
||||
"P00 INFO: check repo1 configuration (primary)\n"
|
||||
"P00 INFO: check repo2 configuration (primary)\n"
|
||||
"P00 INFO: check repo1 archive for WAL (primary)\n"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo/archive/test1/9.2-1/"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo/archive/test1/15-1/"
|
||||
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo1\n"
|
||||
"P00 INFO: check repo2 archive for WAL (primary)\n"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo2/archive/test1/9.2-1/"
|
||||
"P00 INFO: WAL segment 000000010000000100000001 successfully archived to '" TEST_PATH "/repo2/archive/test1/15-1/"
|
||||
"0000000100000001/000000010000000100000001-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' on repo2");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -397,15 +397,15 @@ testRun(void)
|
||||
hrnCfgArgRawZ(argList, cfgOptRepoPath, TEST_PATH "/repo");
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_11);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_11);
|
||||
|
||||
DbGetResult db = {0};
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, "/badpath", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_11, "/badpath", true, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
@ -414,14 +414,14 @@ testRun(void)
|
||||
|
||||
TEST_ASSIGN(db, dbGet(false, false, false), "get primary and standby");
|
||||
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config");
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_11, db.primaryIdx, db.primary, false), "valid db config");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("checkDbConfig() version mismatch");
|
||||
|
||||
TEST_ERROR(
|
||||
checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
|
||||
"version '" PG_VERSION_11_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
|
||||
PG_VERSION_94_STR "' 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.");
|
||||
|
||||
@ -429,8 +429,8 @@ testRun(void)
|
||||
TEST_TITLE("checkDbConfig() path mismatch");
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
checkDbConfig(PG_VERSION_92, db.standbyIdx, db.standby, true), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_92_STR "' and"
|
||||
checkDbConfig(PG_VERSION_11, db.standbyIdx, db.standby, true), DbMismatchError,
|
||||
"version '" PG_VERSION_11_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_11_STR "' and"
|
||||
" '" TEST_PATH "/pg8' read from '" TEST_PATH "/pg8/global/pg_control'\n"
|
||||
"HINT: the pg8-path and pg8-port settings likely reference different clusters.",
|
||||
strZ(dbPgDataPath(db.standby)));
|
||||
@ -441,7 +441,7 @@ testRun(void)
|
||||
hrnCfgArgRawBool(argList, cfgOptArchiveCheck, false);
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config --no-archive-check");
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_11, db.primaryIdx, db.primary, false), "valid db config --no-archive-check");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("checkDbConfig() archive-check not valid for command");
|
||||
@ -455,7 +455,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
TEST_RESULT_VOID(
|
||||
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "valid db config, archive-check not valid for command");
|
||||
checkDbConfig(PG_VERSION_11, db.primaryIdx, db.primary, false), "valid db config, archive-check not valid for command");
|
||||
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
TEST_RESULT_VOID(dbFree(db.standby), "free standby");
|
||||
@ -471,14 +471,14 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, "always", NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, "always", NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
TEST_ASSIGN(db, dbGet(true, true, false), "get primary");
|
||||
TEST_ERROR(
|
||||
checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), FeatureNotSupportedError,
|
||||
checkDbConfig(PG_VERSION_11, db.primaryIdx, db.primary, false), FeatureNotSupportedError,
|
||||
"archive_mode=always not supported");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -486,7 +486,7 @@ testRun(void)
|
||||
|
||||
hrnCfgArgRawBool(argList, cfgOptArchiveModeCheck, false);
|
||||
HRN_CFG_LOAD(cfgCmdCheck, argList);
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_92, db.primaryIdx, db.primary, false), "check");
|
||||
TEST_RESULT_VOID(checkDbConfig(PG_VERSION_11, db.primaryIdx, db.primary, false), "check");
|
||||
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
}
|
||||
|
@ -708,9 +708,7 @@ testRun(void)
|
||||
"P00 INFO: map tablespace 'pg_tblspc/1' to '/all/1'\n"
|
||||
"P00 INFO: map tablespace 'pg_tblspc/2' to '/2-3'");
|
||||
|
||||
// Remap all tablespaces with tablespace-map-all and update version to 9.2 to test warning
|
||||
manifest->pub.data.pgVersion = PG_VERSION_92;
|
||||
|
||||
// Remap all tablespaces with tablespace-map-all
|
||||
argList = strLstNew();
|
||||
hrnCfgArgRawZ(argList, cfgOptStanza, "test1");
|
||||
hrnCfgArgRaw(argList, cfgOptRepoPath, repoPath);
|
||||
@ -728,8 +726,7 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: map tablespace 'pg_tblspc/1' to '/all2/1'\n"
|
||||
"P00 INFO: map tablespace 'pg_tblspc/2' to '/all2/ts2'\n"
|
||||
"P00 WARN: update pg_tablespace.spclocation with new tablespace locations for PostgreSQL <= 9.2");
|
||||
"P00 INFO: map tablespace 'pg_tblspc/2' to '/all2/ts2'");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error on invalid link");
|
||||
@ -1263,8 +1260,8 @@ testRun(void)
|
||||
OBJ_NEW_BEGIN(Manifest, .childQty = MEM_CONTEXT_QTY_MAX)
|
||||
{
|
||||
manifest = manifestNewInternal();
|
||||
manifest->pub.data.pgVersion = PG_VERSION_90;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_90);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_94;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_94);
|
||||
|
||||
manifestTargetAdd(manifest, &(ManifestTarget){.name = MANIFEST_TARGET_PGDATA_STR, .path = STRDEF("/pg")});
|
||||
manifestFileAdd(manifest, &(ManifestFile){.name = STRDEF(MANIFEST_TARGET_PGDATA "/" PG_FILE_PGVERSION)});
|
||||
@ -1417,7 +1414,7 @@ testRun(void)
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
TEST_RESULT_STR_Z(
|
||||
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.0_201008051/32768/)",
|
||||
restoreSelectiveExpression(manifest), "(^pg_data/base/32768/)|(^pg_tblspc/16387/PG_9.4_201409291/32768/)",
|
||||
"check expression");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@ -1727,10 +1724,6 @@ testRun(void)
|
||||
"pause_at_recovery_target = 'false'\n",
|
||||
"check recovery options");
|
||||
|
||||
TEST_ERROR(
|
||||
restoreRecoveryConf(PG_VERSION_90, restoreLabel), OptionInvalidError,
|
||||
"target-action option is only available in PostgreSQL >= 9.1");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("recovery type = standby");
|
||||
|
||||
@ -2012,8 +2005,8 @@ testRun(void)
|
||||
manifest = manifestNewInternal();
|
||||
manifest->pub.info = infoNew(NULL);
|
||||
manifest->pub.data.backupLabel = strNewZ(TEST_LABEL);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_90;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_90);
|
||||
manifest->pub.data.pgVersion = PG_VERSION_94;
|
||||
manifest->pub.data.pgCatalogVersion = hrnPgCatalogVersion(PG_VERSION_94);
|
||||
manifest->pub.data.backupType = backupTypeFull;
|
||||
manifest->pub.data.backupTimestampCopyStart = 1482182861; // So file timestamps should be less than this
|
||||
|
||||
@ -2035,12 +2028,12 @@ testRun(void)
|
||||
&(ManifestFile){
|
||||
.name = STRDEF(TEST_PGDATA PG_FILE_PGVERSION), .size = 4, .timestamp = 1482182860,
|
||||
.mode = 0600, .group = groupName(), .user = userName(),
|
||||
.checksumSha1 = "b74d60e763728399bcd3fb63f7dd1f97b46c6b44"});
|
||||
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_90_STR "\n");
|
||||
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"});
|
||||
HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_STR "\n");
|
||||
|
||||
// Store the file also to the encrypted repo
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_90_STR "\n",
|
||||
storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_STR "\n",
|
||||
.cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS_ARCHIVE);
|
||||
|
||||
// pg_tblspc
|
||||
@ -2100,7 +2093,7 @@ 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 b74d60e763728399bcd3fb63f7dd1f97b46c6b44"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (4B, 100.00%%) checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"
|
||||
"\n"
|
||||
"P00 INFO: write " TEST_PATH "/pg/recovery.conf\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg'\n"
|
||||
@ -2216,7 +2209,7 @@ testRun(void)
|
||||
.name = STRDEF(MANIFEST_TARGET_PGTBLSPC "/1"), .mode = 0700, .group = groupName(), .user = userName()});
|
||||
manifestPathAdd(
|
||||
manifest, &(ManifestPath){
|
||||
.name = STRDEF(MANIFEST_TARGET_PGTBLSPC "/1/PG_9.0_201008051"), .mode = 0700, .group = groupName(),
|
||||
.name = STRDEF(MANIFEST_TARGET_PGTBLSPC "/1/PG_9.4_201409291"), .mode = 0700, .group = groupName(),
|
||||
.user = userName()});
|
||||
manifestLinkAdd(
|
||||
manifest, &(ManifestLink){
|
||||
@ -2235,10 +2228,10 @@ testRun(void)
|
||||
&(ManifestFile){
|
||||
.name = STRDEF(MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION), .size = 4,
|
||||
.timestamp = 1482182860, .mode = 0600, .group = groupName(), .user = userName(),
|
||||
.checksumSha1 = "b74d60e763728399bcd3fb63f7dd1f97b46c6b44"});
|
||||
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"});
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/" MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION,
|
||||
PG_VERSION_90_STR "\n");
|
||||
PG_VERSION_94_STR "\n");
|
||||
|
||||
// Always sort
|
||||
lstSort(manifest->pub.targetList, sortOrderAsc);
|
||||
@ -2263,7 +2256,7 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: repo1: restore backup set 20161219-212741F\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.0_201008051' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.4_201409291' exists\n"
|
||||
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/pg'\n"
|
||||
"P00 DETAIL: update mode for '" TEST_PATH "/pg' to 0700\n"
|
||||
"P00 DETAIL: remove invalid file '" TEST_PATH "/pg/bogus-file'\n"
|
||||
@ -2276,17 +2269,18 @@ testRun(void)
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/postgresql.conf (10B, 73.53%) checksum"
|
||||
" 1a49a3c2240449fee1422e4afcf44d5b96378511\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION - exists and matches size 4 and modification time 1482182860"
|
||||
" (4B, 85.29%) checksum b74d60e763728399bcd3fb63f7dd1f97b46c6b44\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, 88.24%) checksum c032adc1ff629c9b66f22749ad667e6beadf144b\n"
|
||||
" (4B, 85.29%) checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, 88.24%) checksum"
|
||||
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/tablespace_map (0B, 88.24%)\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, 100.00%)"
|
||||
" checksum b74d60e763728399bcd3fb63f7dd1f97b46c6b44\n"
|
||||
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\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.0_201008051'\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.4_201409291'\n"
|
||||
"P00 WARN: backup does not contain 'global/pg_control' -- cluster will not start\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/global'\n"
|
||||
"P00 INFO: restore size = 34B, file total = 6");
|
||||
@ -2309,7 +2303,7 @@ testRun(void)
|
||||
".> {d=" TEST_PATH "/ts/1}\n"
|
||||
"16384/\n"
|
||||
"16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_9.0_201008051/\n",
|
||||
"PG_9.4_201409291/\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
|
||||
@ -2340,25 +2334,25 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: repo1: restore backup set 20161219-212741F\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/pg' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.0_201008051' exists\n"
|
||||
"P00 DETAIL: check '" TEST_PATH "/ts/1/PG_9.4_201409291' exists\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.0_201008051'\n"
|
||||
"P00 INFO: remove invalid files/links/paths from '" TEST_PATH "/ts/1/PG_9.4_201409291'\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 b74d60e763728399bcd3fb63f7dd1f97b46c6b44\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/PG_VERSION (4B, [PCT]) checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/size-mismatch (1B, [PCT]) checksum"
|
||||
" c032adc1ff629c9b66f22749ad667e6beadf144b\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/tablespace_map (0B, [PCT])\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/pg_tblspc/1/16384/PG_VERSION (4B, [PCT])"
|
||||
" checksum b74d60e763728399bcd3fb63f7dd1f97b46c6b44\n"
|
||||
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\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.0_201008051'\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/pg_tblspc/1/PG_9.4_201409291'\n"
|
||||
"P00 WARN: backup does not contain 'global/pg_control' -- cluster will not start\n"
|
||||
"P00 DETAIL: sync path '" TEST_PATH "/pg/global'\n"
|
||||
"P00 INFO: restore size = [SIZE], file total = 6");
|
||||
@ -2381,14 +2375,14 @@ testRun(void)
|
||||
".> {d=" TEST_PATH "/ts/1}\n"
|
||||
"16384/\n"
|
||||
"16384/PG_VERSION {s=4, t=1482182860}\n"
|
||||
"PG_9.0_201008051/\n",
|
||||
"PG_9.4_201409291/\n",
|
||||
.level = storageInfoLevelBasic, .includeDot = true);
|
||||
|
||||
// PG_VERSION was restored by the force option
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_90_STR "\n", .comment = "check PG_VERSION was restored");
|
||||
TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_94_STR "\n", .comment = "check PG_VERSION was restored");
|
||||
|
||||
// Remove tablespace
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.0_201008051", .recurse = true);
|
||||
HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.4_201409291", .recurse = true);
|
||||
|
||||
// Remove files
|
||||
HRN_STORAGE_REMOVE(storagePgWrite(), "postgresql.conf");
|
||||
@ -2482,7 +2476,7 @@ testRun(void)
|
||||
&(ManifestFile){
|
||||
.name = STRDEF(TEST_PGDATA PG_FILE_PGVERSION), .size = 4, .sizeRepo = 4, .timestamp = 1482182860,
|
||||
.mode = 0600, .group = groupName(), .user = userName(), .bundleId = 1, .bundleOffset = 0,
|
||||
.reference = NULL, .checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"});
|
||||
.reference = NULL, .checksumSha1 = "2fafe15172578a19dbc196723bca6a4a8ad70da8"});
|
||||
manifestFileAdd(
|
||||
manifest,
|
||||
&(ManifestFile){
|
||||
@ -2510,7 +2504,7 @@ testRun(void)
|
||||
.reference = NULL, .checksumSha1 = "d7dacae2c968388960bf8970080a980ed5c5dcb7"});
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/bundle/1",
|
||||
PG_VERSION_94_STR "\n" PG_VERSION_94_STR "\nyyyxxxxxAzzA");
|
||||
PG_VERSION_96_STR "\n" PG_VERSION_96_STR "\nyyyxxxxxAzzA");
|
||||
|
||||
// base directory
|
||||
manifestPathAdd(
|
||||
@ -2530,7 +2524,7 @@ testRun(void)
|
||||
&(ManifestFile){
|
||||
.name = STRDEF(TEST_PGDATA "base/1/" PG_FILE_PGVERSION), .size = 4, .sizeRepo = 4, .timestamp = 1482182860,
|
||||
.mode = 0600, .group = groupName(), .user = userName(), .bundleId = 1, .bundleOffset = 4,
|
||||
.checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"});
|
||||
.checksumSha1 = "2fafe15172578a19dbc196723bca6a4a8ad70da8"});
|
||||
|
||||
// base/1/2
|
||||
fileBuffer = bufNew(8192);
|
||||
@ -2800,9 +2794,9 @@ testRun(void)
|
||||
"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"
|
||||
" 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
" 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION (bundle 1/4, 4B, [PCT]) checksum"
|
||||
" 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
" 2fafe15172578a19dbc196723bca6a4a8ad70da8\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"
|
||||
@ -2988,9 +2982,9 @@ testRun(void)
|
||||
"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 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
" checksum 2fafe15172578a19dbc196723bca6a4a8ad70da8\n"
|
||||
"P01 DETAIL: restore file " TEST_PATH "/pg/base/1/PG_VERSION - exists and matches backup (bundle 1/4, 4B, [PCT])"
|
||||
" checksum 8dbabb96e032b8d9f1993c0e4b9141e71ade01a1\n"
|
||||
" checksum 2fafe15172578a19dbc196723bca6a4a8ad70da8\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"
|
||||
|
@ -526,11 +526,11 @@ testRun(void)
|
||||
TEST_TITLE("pgControl and database match");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_93);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
@ -551,7 +551,7 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaUpgrade, argList);
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_93, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
@ -564,36 +564,36 @@ testRun(void)
|
||||
TEST_TITLE("pg_control and version mismatch");
|
||||
|
||||
// Create pg_control with different version
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_91);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_10);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_11, TEST_PATH "/pg", false, NULL, NULL),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
TEST_ERROR(
|
||||
pgValidate(), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
|
||||
PG_VERSION_91_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||
"version '" PG_VERSION_11_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '"
|
||||
PG_VERSION_10_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n"
|
||||
"HINT: the pg1-path and pg1-port settings likely reference different clusters.");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("pg_control and path mismatch");
|
||||
|
||||
// Create pg_control
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_15);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg2", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_15, TEST_PATH "/pg2", false, NULL, NULL),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
TEST_ERROR(
|
||||
pgValidate(), DbMismatchError,
|
||||
"version '" PG_VERSION_92_STR "' and path '" TEST_PATH "/pg2' queried from cluster do not match version '"
|
||||
PG_VERSION_92_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
|
||||
"version '" PG_VERSION_15_STR "' and path '" TEST_PATH "/pg2' queried from cluster do not match version '"
|
||||
PG_VERSION_15_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL
|
||||
"'\nHINT: the pg1-path and pg1-port settings likely reference different clusters.");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -609,23 +609,23 @@ testRun(void)
|
||||
HRN_CFG_LOAD(cfgCmdStanzaCreate, argList);
|
||||
|
||||
// Create pg_control for primary
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_92);
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(1), PG_VERSION_13);
|
||||
|
||||
// Create pg_control for standby
|
||||
HRN_PG_CONTROL_PUT(storagePgIdxWrite(0), PG_VERSION_94);
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(2, "dbname='postgres' port=5434", PG_VERSION_92, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_13, TEST_PATH "/pg", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(2, "dbname='postgres' port=5434", PG_VERSION_13, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
PgControl pgControl = {0};
|
||||
TEST_ASSIGN(pgControl, pgValidate(), "validate primary on pg2");
|
||||
TEST_RESULT_UINT(pgControl.version, PG_VERSION_92, "version set");
|
||||
TEST_RESULT_UINT(pgControl.systemId, HRN_PG_SYSTEMID_92, "systemId set");
|
||||
TEST_RESULT_UINT(pgControl.catalogVersion, 201204301, "catalogVersion set");
|
||||
TEST_RESULT_UINT(pgControl.version, PG_VERSION_13, "version set");
|
||||
TEST_RESULT_UINT(pgControl.systemId, HRN_PG_SYSTEMID_13, "systemId set");
|
||||
TEST_RESULT_UINT(pgControl.catalogVersion, 202007201, "catalogVersion set");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -128,15 +128,6 @@ testRun(void)
|
||||
"backup-timestamp-stop=0\n" \
|
||||
"backup-type=\"full\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_92 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201204301\n" \
|
||||
"db-control-version=922\n" \
|
||||
"db-id=1\n" \
|
||||
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n" \
|
||||
"db-version=\"9.2\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_94 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
@ -238,7 +229,13 @@ testRun(void)
|
||||
HRN_INFO_PUT(
|
||||
storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_BACKUP_LABEL_FULL "/" BACKUP_MANIFEST_FILE,
|
||||
TEST_MANIFEST_HEADER
|
||||
TEST_MANIFEST_DB_92
|
||||
"\n"
|
||||
"[backup:db]\n"
|
||||
"db-catalog-version=201306121\n"
|
||||
"db-control-version=937\n"
|
||||
"db-id=1\n"
|
||||
"db-system-id=" HRN_PG_SYSTEMID_94_Z "\n"
|
||||
"db-version=\"9.3\"\n"
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
TEST_MANIFEST_TARGET
|
||||
TEST_MANIFEST_DB
|
||||
@ -259,7 +256,7 @@ 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.2, system-id "
|
||||
"P00 INFO: '20181119-152138F' may not be recoverable - PG data (id 1, version 9.3, system-id "
|
||||
HRN_PG_SYSTEMID_94_Z ") is not in the backup.info history, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
@ -436,7 +433,7 @@ testRun(void)
|
||||
TEST_RESULT_LOG("P00 INFO: duplicate WAL '000000020000000200000000' for '9.4-1' exists, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("FF Wal not skipped > 9.2, duplicates at beginning and end of list are removed");
|
||||
TEST_TITLE("duplicates at beginning and end of list are removed");
|
||||
|
||||
errTotal = 0;
|
||||
strLstAddZ(walFileList, "000000020000000100000000-daa497dba64008db824607940609ba1cd7c6c501.gz");
|
||||
@ -462,96 +459,6 @@ testRun(void)
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: duplicate WAL '000000020000000100000000' for '9.4-1' exists, skipping\n"
|
||||
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.4-1' exists, skipping");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("FF Wal skipped <= 9.2, duplicates in middle of list removed");
|
||||
|
||||
// Clear the range lists and rerun the test with PG_VERSION_92 to ensure FF is reported as an error
|
||||
lstClear(archiveIdResult->walRangeList);
|
||||
errTotal = 0;
|
||||
archiveIdResult->archiveId = strNewZ("9.2-1");
|
||||
archiveIdResult->pgWalInfo.version = PG_VERSION_92;
|
||||
|
||||
strLstAddZ(walFileList, "000000020000000200000001");
|
||||
strLstAddZ(walFileList, "000000020000000200000001");
|
||||
strLstAddZ(walFileList, "000000020000000200000002");
|
||||
|
||||
TEST_RESULT_VOID(verifyCreateArchiveIdRange(archiveIdResult, walFileList, &errTotal), "create archiveId WAL range");
|
||||
TEST_RESULT_UINT(errTotal, 2, "error reported");
|
||||
TEST_RESULT_UINT(lstSize(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList), 2, "multiple ranges");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 0),
|
||||
"get range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "0000000200000001000000FD", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000000", "stop range");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 1),
|
||||
"get second range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "000000020000000200000002", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000002", "stop range");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
"P00 INFO: invalid WAL '0000000200000001000000FF' for '9.2-1' exists, skipping\n"
|
||||
"P00 INFO: duplicate WAL '000000020000000200000001' for '9.2-1' exists, skipping");
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
walFileList,
|
||||
"0000000200000001000000FD-daa497dba64008db824607940609ba1cd7c6c501.gz\n"
|
||||
"0000000200000001000000FE-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz\n"
|
||||
"000000020000000200000000\n000000020000000200000002\n",
|
||||
"skipped files removed");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("Rerun <= 9.2, missing FF not a gap");
|
||||
|
||||
// Clear the range lists, rerun the PG_VERSION_92 test to ensure the missing FF is not considered a gap
|
||||
lstClear(archiveIdResult->walRangeList);
|
||||
errTotal = 0;
|
||||
|
||||
TEST_RESULT_VOID(verifyCreateArchiveIdRange(archiveIdResult, walFileList, &errTotal), "create archiveId WAL range");
|
||||
TEST_RESULT_UINT(errTotal, 0, "error reported");
|
||||
TEST_RESULT_UINT(lstSize(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList), 2, "multiple ranges");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 0),
|
||||
"get range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "0000000200000001000000FD", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000000", "stop range");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 1),
|
||||
"get second range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "000000020000000200000002", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000002", "stop range");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("version > 9.2, missing FF is a gap");
|
||||
|
||||
// Clear the range lists and update the version > 9.2 so missing FF is considered a gap in the WAL ranges
|
||||
lstClear(archiveIdResult->walRangeList);
|
||||
errTotal = 0;
|
||||
archiveIdResult->archiveId = strNewZ("9.6-1");
|
||||
archiveIdResult->pgWalInfo.version = PG_VERSION_96;
|
||||
|
||||
strLstAddZ(walFileList, "000000020000000200000003-123456");
|
||||
strLstAddZ(walFileList, "000000020000000200000004-123456");
|
||||
|
||||
TEST_RESULT_VOID(verifyCreateArchiveIdRange(archiveIdResult, walFileList, &errTotal), "create archiveId WAL range");
|
||||
TEST_RESULT_UINT(errTotal, 0, "no errors");
|
||||
TEST_RESULT_UINT(lstSize(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList), 3, "multiple ranges");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 0),
|
||||
"get first range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "0000000200000001000000FD", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "0000000200000001000000FE", "stop range");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 1),
|
||||
"get second range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "000000020000000200000000", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000000", "stop range");
|
||||
TEST_ASSIGN(
|
||||
walRangeResult, (VerifyWalRange *)lstGet(((VerifyArchiveResult *)lstGet(archiveIdResultList, 0))->walRangeList, 2),
|
||||
"get third range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->start, "000000020000000200000002", "start range");
|
||||
TEST_RESULT_STR_Z(walRangeResult->stop, "000000020000000200000004", "stop range");
|
||||
}
|
||||
|
||||
// *****************************************************************************************************************************
|
||||
|
@ -82,15 +82,18 @@ testRun(void)
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='testdb' port=5432"),
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(1),
|
||||
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_90, TEST_PATH "/pg", NULL, NULL),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_93, TEST_PATH "/pg", NULL, NULL),
|
||||
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
|
||||
HRNPQ_MACRO_IS_STANDBY_QUERY(1, false),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
|
||||
HRNPQ_MACRO_OPEN(1, "dbname='testdb' port=5432"),
|
||||
HRNPQ_MACRO_SET_SEARCH_PATH(1),
|
||||
HRNPQ_MACRO_SET_CLIENT_ENCODING(1),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_90, TEST_PATH "/pg", NULL, NULL),
|
||||
HRNPQ_MACRO_VALIDATE_QUERY(1, PG_VERSION_93, TEST_PATH "/pg", NULL, NULL),
|
||||
HRNPQ_MACRO_SET_APPLICATION_NAME(1),
|
||||
HRNPQ_MACRO_IS_STANDBY_QUERY(1, false),
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(1, "2/3"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(1, "xlog", "000000030000000200000003"),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
|
||||
@ -261,42 +264,6 @@ testRun(void)
|
||||
" HINT: is the backup running as the postgres user?\n"
|
||||
" HINT: is the pg_read_all_settings role assigned for PostgreSQL >= 10?");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.0 start backup with no WAL switch");
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_LE_91(1, "dbname='backupdb' port=5432", PG_VERSION_90, TEST_PATH "/pg1", NULL, NULL),
|
||||
|
||||
// Get advisory lock
|
||||
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
|
||||
|
||||
// Start backup with no wal switch
|
||||
HRNPQ_MACRO_CURRENT_WAL_LE_96(1, "000000010000000100000001"),
|
||||
HRNPQ_MACRO_START_BACKUP_LE_95(1, false, "1/1", "000000010000000100000001"),
|
||||
|
||||
// Close primary
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
DbGetResult db = {0};
|
||||
TEST_ASSIGN(db, dbGet(true, true, false), "get primary");
|
||||
|
||||
TEST_RESULT_UINT(dbDbTimeout(db.primary), 888000, "check timeout");
|
||||
TEST_RESULT_UINT(dbPgControl(db.primary).timeline, 1, "check timeline");
|
||||
|
||||
DbBackupStartResult backupStartResult = {0};
|
||||
TEST_ASSIGN(backupStartResult, dbBackupStart(db.primary, false, false, true), "start backup");
|
||||
TEST_RESULT_STR_Z(backupStartResult.lsn, "1/1", "start backup");
|
||||
TEST_RESULT_PTR(backupStartResult.walSegmentCheck, NULL, "WAL segment check");
|
||||
|
||||
TEST_RESULT_VOID(dbPing(db.primary, false), "ping cluster");
|
||||
|
||||
TEST_RESULT_VOID(dbFree(db.primary), "free primary");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PostgreSQL 9.5 start/stop backup");
|
||||
|
||||
@ -305,7 +272,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// Get start time
|
||||
HRNPQ_MACRO_TIME_QUERY(1, 1000),
|
||||
@ -329,6 +296,7 @@ testRun(void)
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
|
||||
DbGetResult db = {0};
|
||||
TEST_ASSIGN(db, dbGet(true, true, false), "get primary");
|
||||
|
||||
TEST_RESULT_UINT(dbTimeMSec(db.primary), 1000, "check time");
|
||||
@ -338,6 +306,7 @@ testRun(void)
|
||||
"unable to acquire pgBackRest advisory lock\n"
|
||||
"HINT: is another pgBackRest backup already running on this cluster?");
|
||||
|
||||
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");
|
||||
@ -362,7 +331,7 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='backupdb' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// Start backup when backup is in progress
|
||||
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
|
||||
@ -468,10 +437,10 @@ testRun(void)
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
// Connect to primary
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
|
||||
// Connect to standby
|
||||
HRNPQ_MACRO_OPEN_GE_92(2, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH "/pg2", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(2, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH "/pg2", true, NULL, NULL),
|
||||
|
||||
// Start backup
|
||||
HRNPQ_MACRO_ADVISORY_LOCK(1, true),
|
||||
@ -809,7 +778,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_90, TEST_PATH "/pg1", NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432 user='bob'", PG_VERSION_93, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_DONE()
|
||||
});
|
||||
@ -820,7 +789,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_90, "version set");
|
||||
TEST_RESULT_INT(dbPgVersion(result.primary), PG_VERSION_93, "version set");
|
||||
TEST_RESULT_STR_Z(dbPgDataPath(result.primary), TEST_PATH "/pg1", "path set");
|
||||
|
||||
TEST_RESULT_VOID(dbFree(result.primary), "free primary");
|
||||
@ -841,8 +810,8 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_LE_91(1, "dbname='postgres' port=5432", PG_VERSION_90, TEST_PATH "/pg1", NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_LE_91(8, "dbname='postgres' port=5433", PG_VERSION_90, TEST_PATH "/pg8", NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(1, "dbname='postgres' port=5432", PG_VERSION_95, TEST_PATH "/pg1", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_93(8, "dbname='postgres' port=5433", PG_VERSION_95, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
@ -857,8 +826,8 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_96, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_96, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -876,8 +845,8 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5433", PG_VERSION_92, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_10, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5433", PG_VERSION_10, TEST_PATH "/pg8", true, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
@ -912,7 +881,7 @@ testRun(void)
|
||||
|
||||
harnessPqScriptSet((HarnessPq [])
|
||||
{
|
||||
HRNPQ_MACRO_OPEN_GE_92(1, "dbname='postgres' port=5432", PG_VERSION_92, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(1, "dbname='postgres' port=5432", PG_VERSION_12, TEST_PATH "/pg1", true, NULL, NULL),
|
||||
|
||||
// pg4 error
|
||||
{.session = 4, .function = HRNPQ_CONNECTDB, .param = "[\"dbname='postgres' port=5433\"]"},
|
||||
@ -920,10 +889,10 @@ testRun(void)
|
||||
{.session = 4, .function = HRNPQ_ERRORMESSAGE, .resultZ = "error"},
|
||||
{.session = 4, .function = HRNPQ_FINISH},
|
||||
|
||||
HRNPQ_MACRO_OPEN_GE_92(8, "dbname='postgres' port=5434", PG_VERSION_92, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
HRNPQ_MACRO_OPEN_GE_96(8, "dbname='postgres' port=5434", PG_VERSION_12, TEST_PATH "/pg8", false, NULL, NULL),
|
||||
|
||||
HRNPQ_MACRO_CREATE_RESTORE_POINT(8, "2/3"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(8, "xlog", "000000010000000200000003"),
|
||||
HRNPQ_MACRO_WAL_SWITCH(8, "wal", "000000010000000200000003"),
|
||||
|
||||
HRNPQ_MACRO_CLOSE(8),
|
||||
HRNPQ_MACRO_CLOSE(1),
|
||||
|
@ -153,8 +153,8 @@ testRun(void)
|
||||
#define CONTENT_DB_HISTORY \
|
||||
"\n" \
|
||||
"[db:history]\n" \
|
||||
"1={\"db-catalog-version\":201409291,\"db-control-version\":942,\"db-system-id\":6569239123849665679," \
|
||||
"\"db-version\":\"9.4\"}\n" \
|
||||
"1={\"db-catalog-version\":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"
|
||||
|
||||
@ -179,7 +179,9 @@ testRun(void)
|
||||
|
||||
pgData = infoPgData(infoPg, 1);
|
||||
TEST_RESULT_INT(pgData.id, 1, " id set");
|
||||
TEST_RESULT_INT(pgData.version, PG_VERSION_94, " version set");
|
||||
TEST_RESULT_INT(pgData.version, 70300, " version set");
|
||||
TEST_RESULT_INT(pgData.controlVersion, 730, " control version set");
|
||||
TEST_RESULT_INT(pgData.catalogVersion, 20081101, " catalog version set");
|
||||
TEST_RESULT_UINT(pgData.systemId, 6569239123849665679, " system-id set");
|
||||
|
||||
contentSave = bufNew(0);
|
||||
|
@ -65,32 +65,14 @@ testRun(void)
|
||||
"backup-timestamp-stop=0\n" \
|
||||
"backup-type=\"full\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_90 \
|
||||
#define TEST_MANIFEST_DB_93 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201008051\n" \
|
||||
"db-control-version=903\n" \
|
||||
"db-catalog-version=201306121\n" \
|
||||
"db-control-version=937\n" \
|
||||
"db-id=0\n" \
|
||||
"db-system-id=0\n" \
|
||||
"db-version=\"9.0\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_91 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201105231\n" \
|
||||
"db-control-version=903\n" \
|
||||
"db-id=0\n" \
|
||||
"db-system-id=0\n" \
|
||||
"db-version=\"9.1\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_92 \
|
||||
"\n" \
|
||||
"[backup:db]\n" \
|
||||
"db-catalog-version=201204301\n" \
|
||||
"db-control-version=922\n" \
|
||||
"db-id=0\n" \
|
||||
"db-system-id=0\n" \
|
||||
"db-version=\"9.2\"\n"
|
||||
"db-version=\"9.3\"\n"
|
||||
|
||||
#define TEST_MANIFEST_DB_94 \
|
||||
"\n" \
|
||||
@ -187,10 +169,10 @@ testRun(void)
|
||||
Storage *storagePgWrite = storagePosixNewP(STRDEF(TEST_PATH "/pg"), .write = true);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("manifest with all features - 9.0");
|
||||
TEST_TITLE("manifest with all features - 9.3");
|
||||
|
||||
// Version
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.0\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.3\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
|
||||
// base/1 directory
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite, PG_PATH_BASE, .mode = 0700);
|
||||
@ -203,7 +185,7 @@ testRun(void)
|
||||
HRN_STORAGE_PUT_EMPTY(
|
||||
storagePgWrite, PG_PATH_BASE "/1/t8888888_8888888_vm.999999", .modeFile = 0600, .timeModified = 1565282113);
|
||||
|
||||
// Unlogged relations (pgVersion > 9.1)
|
||||
// Unlogged relations
|
||||
HRN_STORAGE_PUT_EMPTY(
|
||||
storagePgWrite, PG_PATH_BASE "/1/555", .modeFile = 0600, .timeModified = 1565282114,
|
||||
.comment = "skip file because there is an _init");
|
||||
@ -292,13 +274,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.0_201008051/1", .mode = 0700);
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "ts/1/PG_9.3_201306121/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.0_201008051/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.3_201306121/1/16384", "TESTDATA", .modeFile = 0600, .timeModified = 1565282115);
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.0_201008051/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
|
||||
storagePgWrite,"pg_tblspc/1/PG_9.3_201306121/1/t123_123_fsm", "IGNORE_TEMP_RELATION", .modeFile = 0600,
|
||||
.timeModified = 1565282115);
|
||||
|
||||
// Add tablespaceList with error (no name)
|
||||
@ -313,7 +295,7 @@ testRun(void)
|
||||
// Test tablespace error
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_90, hrnPgCatalogVersion(PG_VERSION_90), false, false, false, exclusionList,
|
||||
storagePg, PG_VERSION_93, hrnPgCatalogVersion(PG_VERSION_93), false, false, false, exclusionList,
|
||||
pckWriteResult(tablespaceList)),
|
||||
AssertError,
|
||||
"tablespace with oid 1 not found in tablespace map\n"
|
||||
@ -338,7 +320,7 @@ testRun(void)
|
||||
TEST_ASSIGN(
|
||||
manifest,
|
||||
manifestNewBuild(
|
||||
storagePg, PG_VERSION_90, hrnPgCatalogVersion(PG_VERSION_90), false, false, false, NULL,
|
||||
storagePg, PG_VERSION_93, hrnPgCatalogVersion(PG_VERSION_93), false, false, false, NULL,
|
||||
pckWriteResult(tablespaceList)),
|
||||
"build manifest");
|
||||
TEST_RESULT_VOID(manifestBackupLabelSet(manifest, STRDEF("20190818-084502F")), "backup label set");
|
||||
@ -350,7 +332,7 @@ testRun(void)
|
||||
strNewBuf(contentSave),
|
||||
strNewBuf(harnessInfoChecksumZ(
|
||||
TEST_MANIFEST_HEADER_LABEL
|
||||
TEST_MANIFEST_DB_90
|
||||
TEST_MANIFEST_DB_93
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
"\n"
|
||||
"[backup:target]\n"
|
||||
@ -362,22 +344,17 @@ testRun(void)
|
||||
"\n"
|
||||
"[target:file]\n"
|
||||
"pg_data/PG_VERSION={\"size\":4,\"timestamp\":1565282100}\n"
|
||||
"pg_data/base/1/555={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_fsm={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_init={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_init.1={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_vm.1={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_vm.1_vm={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/global/pg_internal.init.allow={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/pg_dynshmem/BOGUS={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/pg_hba.conf={\"size\":9,\"timestamp\":1565282117}\n"
|
||||
"pg_data/pg_replslot/BOGUS={\"size\":0,\"timestamp\":1565282103}\n"
|
||||
"pg_data/pg_serial/BOGUS={\"size\":0,\"timestamp\":1565282104}\n"
|
||||
"pg_data/pg_snapshots/BOGUS={\"size\":4,\"timestamp\":1565282105}\n"
|
||||
"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.0_201008051/1/16384={\"size\":8,\"timestamp\":1565282115}\n"
|
||||
"pg_tblspc/1/PG_9.3_201306121/1/16384={\"size\":8,\"timestamp\":1565282115}\n"
|
||||
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_TRUE
|
||||
"\n"
|
||||
"[target:link]\n"
|
||||
@ -404,8 +381,8 @@ testRun(void)
|
||||
"pg_data/pg_xlog/archive_status={\"mode\":\"0777\"}\n"
|
||||
"pg_tblspc={}\n"
|
||||
"pg_tblspc/1={}\n"
|
||||
"pg_tblspc/1/PG_9.0_201008051={}\n"
|
||||
"pg_tblspc/1/PG_9.0_201008051/1={}\n"
|
||||
"pg_tblspc/1/PG_9.3_201306121={}\n"
|
||||
"pg_tblspc/1/PG_9.3_201306121/1={}\n"
|
||||
TEST_MANIFEST_PATH_DEFAULT)),
|
||||
"check manifest");
|
||||
|
||||
@ -420,13 +397,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.0_201008051", .recurse = true);
|
||||
HRN_STORAGE_PATH_REMOVE(storageTest,"ts/1/PG_9.3_201306121", .recurse = true);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("manifest with all features - 9.1, online");
|
||||
|
||||
// Version
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.1\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
TEST_TITLE("manifest with all features - 9.3, online");
|
||||
|
||||
// Create a path other than archive_status under pg_xlog for code coverage
|
||||
HRN_STORAGE_PATH_CREATE(storagePgWrite, "pg_xlog/somepath", .mode = 0700);
|
||||
@ -436,10 +410,13 @@ testRun(void)
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storagePgWrite, "pg_wal/000000010000000000000001", "WALDATA", .modeFile = 0600, .timeModified = 1565282120);
|
||||
|
||||
// Files to conditionally ignore before 9.4
|
||||
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_91, hrnPgCatalogVersion(PG_VERSION_91), true, false, false, NULL, NULL),
|
||||
manifestNewBuild(storagePg, PG_VERSION_93, hrnPgCatalogVersion(PG_VERSION_93), true, false, false, NULL, NULL),
|
||||
"build manifest");
|
||||
|
||||
contentSave = bufNew(0);
|
||||
@ -448,7 +425,7 @@ testRun(void)
|
||||
strNewBuf(contentSave),
|
||||
strNewBuf(harnessInfoChecksumZ(
|
||||
TEST_MANIFEST_HEADER
|
||||
TEST_MANIFEST_DB_91
|
||||
TEST_MANIFEST_DB_93
|
||||
TEST_MANIFEST_OPTION_ARCHIVE
|
||||
TEST_MANIFEST_OPTION_CHECKSUM_PAGE_FALSE
|
||||
TEST_MANIFEST_OPTION_ONLINE_TRUE
|
||||
@ -468,8 +445,8 @@ testRun(void)
|
||||
"pg_data/pg_dynshmem/BOGUS={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/pg_hba.conf={\"size\":9,\"timestamp\":1565282117}\n"
|
||||
"pg_data/pg_replslot/BOGUS={\"size\":0,\"timestamp\":1565282103}\n"
|
||||
"pg_data/pg_snapshots/BOGUS={\"size\":4,\"timestamp\":1565282105}\n"
|
||||
"pg_data/pg_wal/000000010000000000000001={\"size\":7,\"timestamp\":1565282120}\n"
|
||||
"pg_data/postgresql.auto.conf.tmp={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/postgresql.conf={\"size\":14,\"timestamp\":1565282116}\n"
|
||||
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_TRUE
|
||||
"\n"
|
||||
@ -504,84 +481,16 @@ testRun(void)
|
||||
HRN_STORAGE_PATH_REMOVE(storageTest, "archivestatus", .recurse = true);
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("manifest with all features - 9.2");
|
||||
|
||||
// Version
|
||||
HRN_STORAGE_PUT_Z(storagePgWrite, PG_FILE_PGVERSION, "9.2\n", .modeFile = 0600, .timeModified = 1565282100);
|
||||
TEST_TITLE("error on circular link");
|
||||
|
||||
// create pg_xlog/wal as a link
|
||||
HRN_STORAGE_PATH_CREATE(storageTest, "wal", .mode = 0700);
|
||||
THROW_ON_SYS_ERROR(symlink(TEST_PATH "/wal", TEST_PATH "/pg/pg_xlog") == -1, FileOpenError, "unable to create symlink");
|
||||
|
||||
// Files to conditionally ignore before 9.4
|
||||
HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTGRESQLAUTOCONFTMP, .modeFile = 0600, .timeModified = 1565282101);
|
||||
|
||||
// Test manifest - pg_snapshots files ignored
|
||||
TEST_ASSIGN(
|
||||
manifest,
|
||||
manifestNewBuild(storagePg, PG_VERSION_92, hrnPgCatalogVersion(PG_VERSION_92), false, false, false, NULL, NULL),
|
||||
"build manifest");
|
||||
|
||||
contentSave = bufNew(0);
|
||||
TEST_RESULT_VOID(manifestSave(manifest, ioBufferWriteNew(contentSave)), "save manifest");
|
||||
TEST_RESULT_STR(
|
||||
strNewBuf(contentSave),
|
||||
strNewBuf(harnessInfoChecksumZ(
|
||||
TEST_MANIFEST_HEADER
|
||||
TEST_MANIFEST_DB_92
|
||||
TEST_MANIFEST_OPTION_ALL
|
||||
"\n"
|
||||
"[backup:target]\n"
|
||||
"pg_data={\"path\":\"" TEST_PATH "/pg\",\"type\":\"path\"}\n"
|
||||
"pg_data/pg_hba.conf={\"file\":\"pg_hba.conf\",\"path\":\"../config\",\"type\":\"link\"}\n"
|
||||
"pg_data/pg_xlog={\"path\":\"" TEST_PATH "/wal\",\"type\":\"link\"}\n"
|
||||
"pg_data/postgresql.conf={\"file\":\"postgresql.conf\",\"path\":\"../config\",\"type\":\"link\"}\n"
|
||||
"\n"
|
||||
"[target:file]\n"
|
||||
"pg_data/PG_VERSION={\"size\":4,\"timestamp\":1565282100}\n"
|
||||
"pg_data/base/1/555_init={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_init.1={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/base/1/555_vm.1_vm={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/global/pg_internal.init.allow={\"size\":0,\"timestamp\":1565282114}\n"
|
||||
"pg_data/pg_dynshmem/BOGUS={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/pg_hba.conf={\"size\":9,\"timestamp\":1565282117}\n"
|
||||
"pg_data/pg_replslot/BOGUS={\"size\":0,\"timestamp\":1565282103}\n"
|
||||
"pg_data/pg_wal/000000010000000000000001={\"size\":7,\"timestamp\":1565282120}\n"
|
||||
"pg_data/postgresql.auto.conf.tmp={\"size\":0,\"timestamp\":1565282101}\n"
|
||||
"pg_data/postgresql.conf={\"size\":14,\"timestamp\":1565282116}\n"
|
||||
TEST_MANIFEST_FILE_DEFAULT_PRIMARY_TRUE
|
||||
"\n"
|
||||
"[target:link]\n"
|
||||
"pg_data/pg_hba.conf={\"destination\":\"../config/pg_hba.conf\"}\n"
|
||||
"pg_data/pg_xlog={\"destination\":\"" TEST_PATH "/wal\"}\n"
|
||||
"pg_data/postgresql.conf={\"destination\":\"../config/postgresql.conf\"}\n"
|
||||
TEST_MANIFEST_LINK_DEFAULT
|
||||
"\n"
|
||||
"[target:path]\n"
|
||||
"pg_data={}\n"
|
||||
"pg_data/base={}\n"
|
||||
"pg_data/base/1={}\n"
|
||||
"pg_data/global={}\n"
|
||||
"pg_data/pg_dynshmem={}\n"
|
||||
"pg_data/pg_notify={}\n"
|
||||
"pg_data/pg_replslot={}\n"
|
||||
"pg_data/pg_serial={}\n"
|
||||
"pg_data/pg_snapshots={}\n"
|
||||
"pg_data/pg_stat_tmp={\"mode\":\"0750\"}\n"
|
||||
"pg_data/pg_subtrans={}\n"
|
||||
"pg_data/pg_tblspc={}\n"
|
||||
"pg_data/pg_wal={}\n"
|
||||
"pg_data/pg_xlog={}\n"
|
||||
TEST_MANIFEST_PATH_DEFAULT)),
|
||||
"check manifest");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("error on circular link");
|
||||
|
||||
THROW_ON_SYS_ERROR(symlink(TEST_PATH "/wal", TEST_PATH "/wal/wal") == -1, FileOpenError, "unable to create symlink");
|
||||
|
||||
TEST_ERROR(
|
||||
manifestNewBuild(storagePg, PG_VERSION_92, hrnPgCatalogVersion(PG_VERSION_92), false, false, false, NULL, NULL),
|
||||
manifestNewBuild(storagePg, PG_VERSION_96, hrnPgCatalogVersion(PG_VERSION_96), false, false, false, NULL, NULL),
|
||||
LinkDestinationError,
|
||||
"link 'pg_xlog/wal' (" TEST_PATH "/wal) destination is the same directory as link 'pg_xlog' (" TEST_PATH "/wal)");
|
||||
|
||||
@ -945,9 +854,6 @@ testRun(void)
|
||||
LinkDestinationError, "link '" TEST_PATH "/pg/linktolink' cannot reference another link '" TEST_PATH "/linktest'");
|
||||
|
||||
#undef TEST_MANIFEST_HEADER
|
||||
#undef TEST_MANIFEST_DB_90
|
||||
#undef TEST_MANIFEST_DB_91
|
||||
#undef TEST_MANIFEST_DB_92
|
||||
#undef TEST_MANIFEST_DB_94
|
||||
#undef TEST_MANIFEST_DB_12
|
||||
#undef TEST_MANIFEST_OPTION_ALL
|
||||
|
@ -271,7 +271,7 @@ testRun(void)
|
||||
MEM_CONTEXT_BEGIN(testContext)
|
||||
{
|
||||
TEST_ASSIGN(
|
||||
manifest, manifestNewBuild(storagePg, PG_VERSION_91, 999999999, false, false, false, NULL, NULL), "build files");
|
||||
manifest, manifestNewBuild(storagePg, PG_VERSION_15, 999999999, false, false, false, NULL, NULL), "build files");
|
||||
}
|
||||
MEM_CONTEXT_END();
|
||||
|
||||
|
@ -50,7 +50,7 @@ testRun(void)
|
||||
if (testBegin("pgControlVersion()"))
|
||||
{
|
||||
TEST_ERROR(pgControlVersion(70300), AssertError, "invalid PostgreSQL version 70300");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_90), 903, "9.0 control version");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_93), 937, "9.3 control version");
|
||||
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_11), 1100, "11 control version");
|
||||
}
|
||||
|
||||
@ -103,13 +103,13 @@ testRun(void)
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
HRN_PG_CONTROL_PUT(
|
||||
storageTest, PG_VERSION_90, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_90),
|
||||
storageTest, PG_VERSION_93, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_93),
|
||||
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88);
|
||||
|
||||
TEST_ASSIGN(info, pgControlFromFile(storageTest), "get control info v90");
|
||||
TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, " check system id");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_90, " check version");
|
||||
TEST_RESULT_UINT(info.catalogVersion, 201008051, " check catalog version");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_93, " check version");
|
||||
TEST_RESULT_UINT(info.catalogVersion, 201306121, " check catalog version");
|
||||
TEST_RESULT_UINT(info.checkpoint, 0xAABBAABBEEFFEEFF, "check checkpoint");
|
||||
TEST_RESULT_UINT(info.timeline, 88, "check timeline");
|
||||
}
|
||||
@ -141,27 +141,18 @@ testRun(void)
|
||||
|
||||
TEST_RESULT_STRLST_Z(
|
||||
pgLsnRangeToWalSegmentList(
|
||||
PG_VERSION_92, 1, pgLsnFromStr(STRDEF("1/60")), pgLsnFromStr(STRDEF("1/60")), 16 * 1024 * 1024),
|
||||
"000000010000000100000000\n", "get single");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
pgLsnRangeToWalSegmentList(
|
||||
PG_VERSION_92, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/1000000")), 16 * 1024 * 1024),
|
||||
"0000000200000001000000FD\n0000000200000001000000FE\n000000020000000200000000\n000000020000000200000001\n",
|
||||
"get range <= 9.2");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
pgLsnRangeToWalSegmentList(
|
||||
PG_VERSION_93, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024),
|
||||
2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024),
|
||||
"0000000200000001000000FD\n0000000200000001000000FE\n0000000200000001000000FF\n000000020000000200000000\n",
|
||||
"get range > 9.2");
|
||||
"get range");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
pgLsnRangeToWalSegmentList(
|
||||
PG_VERSION_11, 2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024),
|
||||
2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024),
|
||||
"000000020000000A00000000\n000000020000000A00000001\n000000020000000A00000002\n000000020000000A00000003\n"
|
||||
"000000020000000B00000000\n000000020000000B00000001\n000000020000000B00000002\n000000020000000B00000003\n",
|
||||
"get range >= 11/1GB");
|
||||
TEST_RESULT_STRLST_Z(
|
||||
pgLsnRangeToWalSegmentList(
|
||||
PG_VERSION_11, 3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024),
|
||||
3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024),
|
||||
"000000030000000700000FFE\n000000030000000700000FFF\n000000030000000800000000\n000000030000000800000001\n",
|
||||
"get range >= 11/1MB");
|
||||
}
|
||||
@ -172,7 +163,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_90, 201008051), "PG_9.0_201008051", "check 9.0 tablespace id");
|
||||
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_93, 201306121), "PG_9.3_201306121", "check 9.3 tablespace id");
|
||||
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_94, 999999999), "PG_9.4_999999999", "check 9.4 tablespace id");
|
||||
|
||||
TEST_RESULT_STR_Z(pgWalName(PG_VERSION_96), "xlog", "check xlog name");
|
||||
@ -234,18 +225,18 @@ testRun(void)
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
memset(bufPtr(result), 0, bufSize(result));
|
||||
hrnPgWalToBuffer(
|
||||
(PgWal){.version = PG_VERSION_90, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT * 2}, result);
|
||||
(PgWal){.version = PG_VERSION_96, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT * 2}, result);
|
||||
|
||||
TEST_ERROR(pgWalFromBuffer(result), FormatError, "wal segment size is 33554432 but must be 16777216 for PostgreSQL <= 10");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
memset(bufPtr(result), 0, bufSize(result));
|
||||
hrnPgWalToBuffer((PgWal){.version = PG_VERSION_90, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT}, result);
|
||||
hrnPgWalToBuffer((PgWal){.version = PG_VERSION_93, .systemId = 0xEAEAEAEA, .size = PG_WAL_SEGMENT_SIZE_DEFAULT}, result);
|
||||
storagePutP(storageNewWriteP(storageTest, walFile), result);
|
||||
|
||||
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest), "get wal info v9.0");
|
||||
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest), "get wal info v9.3");
|
||||
TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_90, " check version");
|
||||
TEST_RESULT_UINT(info.version, PG_VERSION_93, " check version");
|
||||
TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user