From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove function names from error messages
Date: Thu, 20 Dec 2018 14:53:26 +0900
Message-ID: <20181220055326.GP27104@paquier.xyz> (raw)
In-Reply-To: <22053.1545280763@sss.pgh.pa.us>
References: <E1gZg2W-0008Lq-0w@gemulon.postgresql.org>
<20181219234103.GC27104@paquier.xyz>
<13206.1545266551@sss.pgh.pa.us>
<20181220012145.GG27104@paquier.xyz>
<22053.1545280763@sss.pgh.pa.us>
On Wed, Dec 19, 2018 at 11:39:23PM -0500, Tom Lane wrote:
> Hm, I guess I shouldn't have used the word "localize". I didn't
> mean whether the function name should be translated; what I meant
> was that we normally don't mention individual functions at all in
> error messages. The messages are supposed to be written as though
> a monolithic entity "the system" is speaking to you. So what
> I'd propose here is just
>
> ereport(NOTICE,
> (errmsg("waiting for required WAL segments to be archived")));
>
> or something along that line. I'm not sure if the "cleanup done" part
> is important, but I'd tend to the idea that it isn't.
Okay. The cleanup part is roughly about the work of putting all the
shared variables back to an initial state, so indeed that does not
matter much to remove this part.
While at it, I am tempted to rework a bit the comments at the top of
do_pg_start_backup and do_pg_stop_backup as those are not only used for
the SQL-level interface but can also be used for base backups taken with
the replication protocol.
The WARNING about the segments not archived yet should not mention
directly pg_stop_backup as well as BASE_BACKUP never calls it.
--
Michael
Attachments:func-message-clean-v2.patch (text/x-diff, 2.5K) downloaddiff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.cindex 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 (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org
Subject: Re: pgsql: Remove function names from error messages
In-Reply-To: <20181220055326.GP27104@paquier.xyz>
References: <E1gZg2W-0008Lq-0w@gemulon.postgresql.org> <20181219234103.GC27104@paquier.xyz> <13206.1545266551@sss.pgh.pa.us> <20181220012145.GG27104@paquier.xyz> <22053.1545280763@sss.pgh.pa.us> <20181220055326.GP27104@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox