Hi all, Alvaro has cleaned up a couple of error messages recently so as they do not include the function name in what gets translated as per 68f6f2b7.
While looking in the code for similar patterns, I have been reminded that pg_stop_backup() is included in some messages when waiting for segments to be archived. This has resulted in an exchange between Tom and me here: https://www.postgresql.org/message-id/[email protected] The thing is that the current messages are actually misleading, because for base backups taken by the replication protocol pg_stop_backup is never called, which is I think confusing. While looking around I have also noticed that the top comments of do_pg_start_backup and do_pg_stop_backup also that they are used with BASE_BACKUP. Attached is a patch to reduce the confusion and improve the related comments and messages. Thoughts? -- Michael
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c80b14ed97..57b5a91f96 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -10163,9 +10163,10 @@ XLogFileNameP(TimeLineID tli, XLogSegNo segno)
}
/*
- * do_pg_start_backup is the workhorse of the user-visible pg_start_backup()
- * function. It creates the necessary starting checkpoint and constructs the
- * backup label file.
+ * do_pg_start_backup
+ *
+ * Utility function called at the start of an online backup. It creates the
+ * necessary starting checkpoint and constructs the backup label file.
*
* There are two kind of backups: exclusive and non-exclusive. An exclusive
* backup is started with pg_start_backup(), and there can be only one active
@@ -10705,8 +10706,10 @@ get_backup_status(void)
}
/*
- * do_pg_stop_backup is the workhorse of the user-visible pg_stop_backup()
- * function.
+ * do_pg_stop_backup
+ *
+ * Utility function called at the end of an online backup. It cleans up the
+ * backup state and can optionally wait for WAL segments to be archived.
*
* If labelfile is NULL, this stops an exclusive backup. Otherwise this stops
* the non-exclusive backup specified by 'labelfile'.
@@ -11077,7 +11080,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
if (!reported_waiting && waits > 5)
{
ereport(NOTICE,
- (errmsg("pg_stop_backup cleanup done, waiting for required WAL segments to be archived")));
+ (errmsg("waiting for required WAL segments to be archived")));
reported_waiting = true;
}
@@ -11087,16 +11090,16 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
{
seconds_before_warning *= 2; /* This wraps in >10 years... */
ereport(WARNING,
- (errmsg("pg_stop_backup still waiting for all required WAL segments to be archived (%d seconds elapsed)",
+ (errmsg("still waiting for all required WAL segments to be archived (%d seconds elapsed)",
waits),
errhint("Check that your archive_command is executing properly. "
- "pg_stop_backup can be canceled safely, "
+ "Backup can be canceled safely, "
"but the database backup will not be usable without all the WAL segments.")));
}
}
ereport(NOTICE,
- (errmsg("pg_stop_backup complete, all required WAL segments have been archived")));
+ (errmsg("all required WAL segments have been archived")));
}
else if (waitforarchive)
ereport(NOTICE,
signature.asc
Description: PGP signature
