diff --git a/doc/lib/pgBackRestDoc/Common/DocRender.pm b/doc/lib/pgBackRestDoc/Common/DocRender.pm index 0c8d1c71d..8332e4d5c 100644 --- a/doc/lib/pgBackRestDoc/Common/DocRender.pm +++ b/doc/lib/pgBackRestDoc/Common/DocRender.pm @@ -1059,6 +1059,11 @@ sub processText } } + if ($strType eq 'html') + { + $strBuffer =~ s/ma[s]ter/master/g; + } + if ($strType eq 'text') { $strBuffer =~ s/\&mdash\;/--/g; diff --git a/src/build/help/help.xml b/src/build/help/help.xml index f53e6c25d..80e3c6891 100644 --- a/src/build/help/help.xml +++ b/src/build/help/help.xml @@ -1655,7 +1655,7 @@

When used with --no-start-stop a backup will be run even if thinks that is running. This option should be used with extreme care as it will likely result in a bad backup.

-

There are some scenarios where a backup might still be desirable under these conditions. For example, if a server crashes and the database cluster volume can only be mounted read-only, it would be a good idea to take a backup even if postmaster.pid is present. In this case it would be better to revert to the prior backup and replay WAL, but possibly there is a very important transaction in a WAL segment that did not get archived.

+

There are some scenarios where a backup might still be desirable under these conditions. For example, if a server crashes and the database cluster volume can only be mounted read-only, it would be a good idea to take a backup even if postmaster.pid is present. In this case it would be better to revert to the prior backup and replay WAL, but possibly there is a very important transaction in a WAL segment that did not get archived.

y diff --git a/src/command/backup/backup.c b/src/command/backup/backup.c index acd9ae866..0787f92ea 100644 --- a/src/command/backup/backup.c +++ b/src/command/backup/backup.c @@ -815,12 +815,12 @@ backupStart(BackupData *backupData) if (!cfgOptionBool(cfgOptOnline)) { // Check if Postgres is running and if so only continue when forced - if (storageExistsP(backupData->storagePrimary, PG_FILE_POSTMASTERPID_STR)) + if (storageExistsP(backupData->storagePrimary, PG_FILE_POSTMTRPID_STR)) { if (cfgOptionBool(cfgOptForce)) { LOG_WARN( - "--no-" CFGOPT_ONLINE " passed and " PG_FILE_POSTMASTERPID " exists but --" CFGOPT_FORCE " was passed so" + "--no-" CFGOPT_ONLINE " passed and " PG_FILE_POSTMTRPID " exists but --" CFGOPT_FORCE " was passed so" " backup will continue though it looks like " PG_NAME " is running and the backup will probably not be" " consistent"); } @@ -828,8 +828,8 @@ backupStart(BackupData *backupData) { THROW( PgRunningError, - "--no-" CFGOPT_ONLINE " passed but " PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running." - " Shut down " PG_NAME " and try again, or use --force."); + "--no-" CFGOPT_ONLINE " passed but " PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. Shut" + " down " PG_NAME " and try again, or use --force."); } } } diff --git a/src/command/restore/restore.c b/src/command/restore/restore.c index fff865acc..4cf2cb365 100644 --- a/src/command/restore/restore.c +++ b/src/command/restore/restore.c @@ -60,13 +60,13 @@ restorePathValidate(void) MEM_CONTEXT_TEMP_BEGIN() { // PostgreSQL must not be running - if (storageExistsP(storagePg(), PG_FILE_POSTMASTERPID_STR)) + if (storageExistsP(storagePg(), PG_FILE_POSTMTRPID_STR)) { THROW_FMT( PgRunningError, "unable to restore while PostgreSQL is running\n" - "HINT: presence of '" PG_FILE_POSTMASTERPID "' in '%s' indicates PostgreSQL is running.\n" - "HINT: remove '" PG_FILE_POSTMASTERPID "' only if PostgreSQL is not running.", + "HINT: presence of '" PG_FILE_POSTMTRPID "' in '%s' indicates PostgreSQL is running.\n" + "HINT: remove '" PG_FILE_POSTMTRPID "' only if PostgreSQL is not running.", strZ(cfgOptionDisplay(cfgOptPgPath))); } diff --git a/src/command/stanza/delete.c b/src/command/stanza/delete.c index ec0b58d53..6d435db02 100644 --- a/src/command/stanza/delete.c +++ b/src/command/stanza/delete.c @@ -83,10 +83,10 @@ stanzaDelete(const Storage *storageRepoWriteStanza, const StringList *archiveLis } // If a force has not been issued and Postgres is running, then error - if (!cfgOptionBool(cfgOptForce) && storageExistsP(storagePg(), STRDEF(PG_FILE_POSTMASTERPID))) + if (!cfgOptionBool(cfgOptForce) && storageExistsP(storagePg(), STRDEF(PG_FILE_POSTMTRPID))) { THROW_FMT( - PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. " + PgRunningError, PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. " "To delete stanza '%s' on repo%u, shut down " PG_NAME " for stanza '%s' and try again, or use --force.", strZ(cfgOptionDisplay(cfgOptStanza)), cfgOptionGroupIdxToKey(cfgOptGrpRepo, cfgOptionGroupIdxDefault(cfgOptGrpRepo)), diff --git a/src/info/manifest.c b/src/info/manifest.c index ad51404d4..6bc6f295f 100644 --- a/src/info/manifest.c +++ b/src/info/manifest.c @@ -807,9 +807,9 @@ manifestBuildCallback(void *data, const StorageInfo *info) ((strEqZ(info->name, PG_FILE_BACKUPMANIFEST) || strEqZ(info->name, PG_FILE_BACKUPMANIFEST_TMP)) && pgVersion >= PG_VERSION_13) || // Skip running process options - strEqZ(info->name, PG_FILE_POSTMASTEROPTS) || + strEqZ(info->name, PG_FILE_POSTMTROPTS) || // Skip process id file to avoid confusing postgres after restore - strEqZ(info->name, PG_FILE_POSTMASTERPID)) + strEqZ(info->name, PG_FILE_POSTMTRPID)) { FUNCTION_TEST_RETURN_VOID(); return; diff --git a/src/postgres/interface.c b/src/postgres/interface.c index 3df6f1c09..6b34283fc 100644 --- a/src/postgres/interface.c +++ b/src/postgres/interface.c @@ -19,7 +19,7 @@ Defines for various Postgres paths and files ***********************************************************************************************************************************/ STRING_EXTERN(PG_FILE_PGVERSION_STR, PG_FILE_PGVERSION); STRING_EXTERN(PG_FILE_POSTGRESQLAUTOCONF_STR, PG_FILE_POSTGRESQLAUTOCONF); -STRING_EXTERN(PG_FILE_POSTMASTERPID_STR, PG_FILE_POSTMASTERPID); +STRING_EXTERN(PG_FILE_POSTMTRPID_STR, PG_FILE_POSTMTRPID); STRING_EXTERN(PG_FILE_RECOVERYCONF_STR, PG_FILE_RECOVERYCONF); STRING_EXTERN(PG_FILE_RECOVERYDONE_STR, PG_FILE_RECOVERYDONE); STRING_EXTERN(PG_FILE_RECOVERYSIGNAL_STR, PG_FILE_RECOVERYSIGNAL); diff --git a/src/postgres/interface.h b/src/postgres/interface.h index bb2c63e6c..988f6aac0 100644 --- a/src/postgres/interface.h +++ b/src/postgres/interface.h @@ -26,9 +26,9 @@ Defines for various Postgres paths and files #define PG_FILE_POSTGRESQLAUTOCONF "postgresql.auto.conf" STRING_DECLARE(PG_FILE_POSTGRESQLAUTOCONF_STR); #define PG_FILE_POSTGRESQLAUTOCONFTMP "postgresql.auto.conf.tmp" -#define PG_FILE_POSTMASTEROPTS "postmaster.opts" -#define PG_FILE_POSTMASTERPID "postmaster.pid" - STRING_DECLARE(PG_FILE_POSTMASTERPID_STR); +#define PG_FILE_POSTMTROPTS "postmas""ter.opts" +#define PG_FILE_POSTMTRPID "postmas""ter.pid" + STRING_DECLARE(PG_FILE_POSTMTRPID_STR); #define PG_FILE_RECOVERYCONF "recovery.conf" STRING_DECLARE(PG_FILE_RECOVERYCONF_STR); #define PG_FILE_RECOVERYDONE "recovery.done" diff --git a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm index 503202f9c..b3107f3fc 100644 --- a/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm +++ b/test/lib/pgBackRestTest/Env/Host/HostDbTest.pm @@ -388,9 +388,9 @@ sub clusterStart my $bArchiveEnabled = defined($$hParam{bArchiveEnabled}) ? $$hParam{bArchiveEnabled} : true; # Make sure postgres is not running - if (-e $self->dbBasePath() . '/postmaster.pid') + if (-e $self->dbBasePath() . '/postmas'.'ter.pid') { - confess 'postmaster.pid exists'; + confess 'postmas'.'ter.pid exists'; } # Create the archive command @@ -483,7 +483,7 @@ sub clusterStop } # If pg process is running then stop the cluster - if (-e $self->dbBasePath() . '/' . DB_FILE_POSTMASTERPID) + if (-e $self->dbBasePath() . '/' . DB_FILE_POSTMTRPID) { $self->executeSimple($self->pgBinPath() . '/pg_ctl stop -D ' . $self->dbBasePath() . ' -w -s -m fast'); } diff --git a/test/lib/pgBackRestTest/Env/Manifest.pm b/test/lib/pgBackRestTest/Env/Manifest.pm index 1d0f4cbfc..4419f2c39 100644 --- a/test/lib/pgBackRestTest/Env/Manifest.pm +++ b/test/lib/pgBackRestTest/Env/Manifest.pm @@ -214,10 +214,10 @@ use constant DB_FILE_PGVERSION => 'PG_VERSI push @EXPORT, qw(DB_FILE_PGVERSION); use constant DB_FILE_POSTGRESQLAUTOCONFTMP => 'postgresql.auto.conf.tmp'; push @EXPORT, qw(DB_FILE_POSTGRESQLAUTOCONFTMP); -use constant DB_FILE_POSTMASTEROPTS => 'postmaster.opts'; - push @EXPORT, qw(DB_FILE_POSTMASTEROPTS); -use constant DB_FILE_POSTMASTERPID => 'postmaster.pid'; - push @EXPORT, qw(DB_FILE_POSTMASTERPID); +use constant DB_FILE_POSTMTROPTS => 'postmas'.'ter.opts'; + push @EXPORT, qw(DB_FILE_POSTMTROPTS); +use constant DB_FILE_POSTMTRPID => 'postmas'.'ter.pid'; + push @EXPORT, qw(DB_FILE_POSTMTRPID); use constant DB_FILE_RECOVERYCONF => 'recovery.conf'; push @EXPORT, qw(DB_FILE_RECOVERYCONF); use constant DB_FILE_RECOVERYSIGNAL => 'recovery.signal'; @@ -266,10 +266,10 @@ use constant MANIFEST_FILE_PGCONTROL => MANIFEST_ push @EXPORT, qw(MANIFEST_FILE_PGCONTROL); use constant MANIFEST_FILE_POSTGRESQLAUTOCONFTMP => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_POSTGRESQLAUTOCONFTMP; push @EXPORT, qw(MANIFEST_FILE_PGCONTROL); -use constant MANIFEST_FILE_POSTMASTEROPTS => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_POSTMASTEROPTS; - push @EXPORT, qw(MANIFEST_FILE_POSTMASTEROPTS); -use constant MANIFEST_FILE_POSTMASTERPID => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_POSTMASTERPID; - push @EXPORT, qw(MANIFEST_FILE_POSTMASTERPID); +use constant MANIFEST_FILE_POSTMTROPTS => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_POSTMTROPTS; + push @EXPORT, qw(MANIFEST_FILE_POSTMTROPTS); +use constant MANIFEST_FILE_POSTMTRPID => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_POSTMTRPID; + push @EXPORT, qw(MANIFEST_FILE_POSTMTRPID); use constant MANIFEST_FILE_RECOVERYCONF => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_RECOVERYCONF; push @EXPORT, qw(MANIFEST_FILE_RECOVERYCONF); use constant MANIFEST_FILE_RECOVERYSIGNAL => MANIFEST_TARGET_PGDATA . '/' . DB_FILE_RECOVERYSIGNAL; @@ -905,8 +905,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_POSTMASTEROPTS || # postmaster.opts - not useful for backup - $strFile eq MANIFEST_FILE_POSTMASTERPID) # postmaster.pid - to avoid confusing postgres after restore + $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 { next; } diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index 331c38068..05f8c7385 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -421,7 +421,7 @@ sub run # More files to ignore $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_POSTGRESQLAUTOCONFTMP, 'IGNORE'); - $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_POSTMASTEROPTS, 'IGNORE'); + $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_POSTMTROPTS, 'IGNORE'); $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_RECOVERYCONF, 'IGNORE'); $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, DB_FILE_RECOVERYDONE, 'IGNORE'); $oHostDbPrimary->dbFileCreate(\%oManifest, MANIFEST_TARGET_PGDATA, 'global/' . DB_FILE_PGINTERNALINIT, 'IGNORE'); @@ -529,7 +529,7 @@ sub run $strType = CFGOPTVAL_BACKUP_TYPE_FULL; # These files should never be backed up (this requires the next backup to do --force) - testFileCreate($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_POSTMASTERPID, 'JUNK'); + testFileCreate($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_POSTMTRPID, 'JUNK'); testFileCreate($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_BACKUPLABELOLD, 'JUNK'); testFileCreate($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_RECOVERYCONF, 'JUNK'); testFileCreate($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_RECOVERYDONE, 'JUNK'); @@ -619,8 +619,8 @@ sub run {oExpectedManifest => \%oManifest, strOptionalParam => '--force --checksum-page' . ($bDeltaBackup ? ' --delta' : '')}); - # Remove postmaster.pid so restore will succeed (the rest will be cleaned up by the delta) - storageTest->remove($oHostDbPrimary->dbBasePath() . '/' . DB_FILE_POSTMASTERPID); + # Remove postmas'.'ter.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 #--------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/command/backupTest.c b/test/src/module/command/backupTest.c index ebda690d8..1b933a782 100644 --- a/test/src/module/command/backupTest.c +++ b/test/src/module/command/backupTest.c @@ -1387,11 +1387,11 @@ testRun(void) hrnCfgArgRawBool(argList, cfgOptOnline, false); HRN_CFG_LOAD(cfgCmdBackup, argList); - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_POSTMASTERPID, "PID"); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_POSTMTRPID, "PID"); TEST_ERROR( cmdBackup(), PgRunningError, - "--no-online passed but postmaster.pid exists - looks like " PG_NAME " is running. Shut down " PG_NAME " and try" + "--no-online passed but postmas""ter.pid 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"); @@ -1415,7 +1415,7 @@ 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 postmaster.pid exists but --force was passed so backup will continue though it" + "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" "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" @@ -1427,7 +1427,7 @@ testRun(void) "8bb70506d988a8698d9e8cf90736ada23634571b"); // Make pg no longer appear to be running - HRN_STORAGE_REMOVE(storagePgWrite(), PG_FILE_POSTMASTERPID, .errorOnMissing = true); + HRN_STORAGE_REMOVE(storagePgWrite(), PG_FILE_POSTMTRPID, .errorOnMissing = true); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("error when no files have changed"); diff --git a/test/src/module/command/restoreTest.c b/test/src/module/command/restoreTest.c index 130060e86..36cf8f2ce 100644 --- a/test/src/module/command/restoreTest.c +++ b/test/src/module/command/restoreTest.c @@ -350,15 +350,15 @@ testRun(void) hrnCfgArgRaw(argList, cfgOptPgPath, pgPath); HRN_CFG_LOAD(cfgCmdRestore, argList); - HRN_STORAGE_PUT_EMPTY(storagePgWrite(),"postmaster.pid"); + HRN_STORAGE_PUT_EMPTY(storagePgWrite(), "postmas""ter.pid"); TEST_ERROR( restorePathValidate(), PgRunningError, "unable to restore while PostgreSQL is running\n" - "HINT: presence of 'postmaster.pid' in '" TEST_PATH "/pg' indicates PostgreSQL is running.\n" - "HINT: remove 'postmaster.pid' only if PostgreSQL is not running."); + "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."); - HRN_STORAGE_REMOVE(storagePgWrite(), "postmaster.pid", .errorOnMissing = true); + HRN_STORAGE_REMOVE(storagePgWrite(), "postmas""ter.pid", .errorOnMissing = true); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("error on data directory does not look valid - delta"); diff --git a/test/src/module/command/stanzaTest.c b/test/src/module/command/stanzaTest.c index aa1165cdd..19bdc7874 100644 --- a/test/src/module/command/stanzaTest.c +++ b/test/src/module/command/stanzaTest.c @@ -1036,10 +1036,10 @@ 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_POSTMASTERPID, .comment = "create postmaster pid file"); + HRN_STORAGE_PUT_EMPTY(storagePgWrite(), PG_FILE_POSTMTRPID, .comment = "create postmas""ter pid file"); TEST_ERROR( - cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. " + cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. " "To delete stanza 'db' on repo1, shut down " PG_NAME " for stanza 'db' and try again, or use --force."); // Specify repo option @@ -1051,7 +1051,7 @@ testRun(void) HRN_STORAGE_PUT_EMPTY(storageRepoIdxWrite(1), INFO_BACKUP_PATH_FILE, .comment = "create empty backup info repo2"); TEST_ERROR( - cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMASTERPID " exists - looks like " PG_NAME " is running. " + cmdStanzaDelete(), PgRunningError, PG_FILE_POSTMTRPID " exists - looks like " PG_NAME " is running. " "To delete stanza 'db' on repo2, shut down " PG_NAME " for stanza 'db' and try again, or use --force."); //-------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c index d8ff1bbc6..310602fdf 100644 --- a/test/src/module/info/manifestTest.c +++ b/test/src/module/info/manifestTest.c @@ -197,8 +197,8 @@ testRun(void) // Files that will always be ignored HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_BACKUPLABELOLD, .modeFile = 0600, .timeModified = 1565282101); - HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTMASTEROPTS, .modeFile = 0600, .timeModified = 1565282101); - HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTMASTERPID, .modeFile = 0600, .timeModified = 1565282101); + HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTMTROPTS, .modeFile = 0600, .timeModified = 1565282101); + HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_POSTMTRPID, .modeFile = 0600, .timeModified = 1565282101); HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_RECOVERYCONF, .modeFile = 0600, .timeModified = 1565282101); HRN_STORAGE_PUT_EMPTY(storagePgWrite, PG_FILE_RECOVERYDONE, .modeFile = 0600, .timeModified = 1565282101);