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

Use the PG_FILE_POSTMTRPID constant where appropriate.

Do the same in Perl with the MANIFEST_FILE_POSTMTRPID constant.
This commit is contained in:
David Steele 2022-01-20 08:41:05 -05:00
parent 4ca0590a51
commit 16559d9e42
7 changed files with 15 additions and 14 deletions

View File

@ -63,6 +63,7 @@
<commit subject="Implement restore ownership without updating manifest internals."/>
<commit subject="Fix issue with Posix read offset handling after an error."/>
<commit subject="Refactor backupProcessQueue() to use BackupJobData struct."/>
<commit subject="Use the PG_FILE_POSTMTRPID constant where appropriate."/>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>

View File

@ -389,9 +389,9 @@ sub clusterStart
my $bArchiveEnabled = defined($$hParam{bArchiveEnabled}) ? $$hParam{bArchiveEnabled} : true;
# Make sure postgres is not running
if (-e $self->dbBasePath() . '/postmas'.'ter.pid')
if (-e $self->dbBasePath() . '/' . DB_FILE_POSTMTRPID)
{
confess 'postmas'.'ter.pid exists';
confess DB_FILE_POSTMTRPID . ' exists';
}
# Create the archive command

View File

@ -904,8 +904,8 @@ sub build
# Skip ignored files
if ($strFile eq MANIFEST_FILE_POSTGRESQLAUTOCONFTMP || # postgresql.auto.conf.tmp - temp file for safe writes
$strFile eq MANIFEST_FILE_BACKUPLABELOLD || # backup_label.old - old backup labels are not useful
$strFile eq MANIFEST_FILE_POSTMTROPTS || # postmas'.'ter.opts - not useful for backup
$strFile eq MANIFEST_FILE_POSTMTRPID) # postmas'.'ter.pid - to avoid confusing postgres after restore
$strFile eq MANIFEST_FILE_POSTMTROPTS || # not useful for backup
$strFile eq MANIFEST_FILE_POSTMTRPID) # to avoid confusing postgres after restore
{
next;
}

View File

@ -621,7 +621,7 @@ sub run
{oExpectedManifest => \%oManifest,
strOptionalParam => '--force --checksum-page' . ($bDeltaBackup ? ' --delta' : '')});
# Remove postmas'.'ter.pid so restore will succeed (the rest will be cleaned up by the delta)
# Remove pid so restore will succeed (the rest will be cleaned up by the delta)
storageTest->remove($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_POSTMTRPID);
# Restore - tests various mode, extra files/paths, missing files/paths

View File

@ -1483,8 +1483,8 @@ testRun(void)
TEST_ERROR(
cmdBackup(), PgRunningError,
"--no-online passed but postmas""ter.pid exists - looks like " PG_NAME " is running. Shut down " PG_NAME " and try"
" again, or use --force.");
"--no-online passed but " PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. Shut down " PG_NAME " and"
" try again, or use --force.");
TEST_RESULT_LOG("P00 WARN: no prior backup exists, incr backup has been changed to full");
@ -1507,8 +1507,8 @@ testRun(void)
TEST_RESULT_LOG_FMT(
"P00 WARN: no prior backup exists, incr backup has been changed to full\n"
"P00 WARN: --no-online passed and postmas""ter.pid exists but --force was passed so backup will continue though it"
" looks like " PG_NAME " is running and the backup will probably not be consistent\n"
"P00 WARN: --no-online passed and " PG_FILE_POSTMTRPID " exists but --force was passed so backup will continue though"
" it looks like " PG_NAME " is running and the backup will probably not be consistent\n"
"P01 DETAIL: backup file " TEST_PATH "/pg1/global/pg_control (8KB, 99%%) checksum %s\n"
"P01 DETAIL: backup file " TEST_PATH "/pg1/postgresql.conf (11B, 100%%) checksum"
" e3db315c260e79211b7b52587123b7aa060f30ab\n"

View File

@ -350,15 +350,15 @@ testRun(void)
hrnCfgArgRaw(argList, cfgOptPgPath, pgPath);
HRN_CFG_LOAD(cfgCmdRestore, argList);
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), "postmas""ter.pid");
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_FILE_POSTMTRPID);
TEST_ERROR(
restorePathValidate(), PgRunningError,
"unable to restore while PostgreSQL is running\n"
"HINT: presence of 'postmas""ter.pid' in '" TEST_PATH "/pg' indicates PostgreSQL is running.\n"
"HINT: remove 'postmas""ter.pid' only if PostgreSQL is not running.");
"HINT: presence of '" PG_FILE_POSTMTRPID "' in '" TEST_PATH "/pg' indicates PostgreSQL is running.\n"
"HINT: remove '" PG_FILE_POSTMTRPID "' only if PostgreSQL is not running.");
HRN_STORAGE_REMOVE(storagePgWrite(), "postmas""ter.pid", .errorOnMissing = true);
HRN_STORAGE_REMOVE(storagePgWrite(), PG_FILE_POSTMTRPID, .errorOnMissing = true);
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("error on data directory does not look valid - delta");

View File

@ -980,7 +980,7 @@ testRun(void)
HRN_STORAGE_PUT_EMPTY(
storageRepoWrite(), INFO_BACKUP_PATH_FILE, .comment = "create empty backup info for stanza '" TEST_STANZA "'");
HRN_STORAGE_PUT_EMPTY(storageHrn, strZ(lockStopFileName(cfgOptionStr(cfgOptStanza))), .comment = "create stop file");
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_FILE_POSTMTRPID, .comment = "create postmas""ter pid file");
HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_FILE_POSTMTRPID, .comment = "create " PG_FILE_POSTMTRPID " file");
TEST_ERROR(
cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. "