pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Remove function names from error messages
8+ messages / 4 participants
[nested] [flat]
* pgsql: Remove function names from error messages
@ 2018-12-19 17:53 Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 8+ messages in thread
From: Alvaro Herrera @ 2018-12-19 17:53 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Remove function names from error messages
They are not necessary, and having them there gives useless work for
translators.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/68f6f2b7395fe3e403034bcd97a1fcfbcc68ae10
Modified Files
--------------
src/backend/access/transam/xlogfuncs.c | 6 ++++--
src/backend/commands/extension.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-12-19 23:41 ` Michael Paquier <michael@paquier.xyz>
2018-12-20 00:42 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
2018-12-21 14:05 ` Re: pgsql: Remove function names from error messages Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 2 replies; 8+ messages in thread
From: Michael Paquier @ 2018-12-19 23:41 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org
On Wed, Dec 19, 2018 at 05:53:48PM +0000, Alvaro Herrera wrote:
> Remove function names from error messages
>
> They are not necessary, and having them there gives useless work for
> translators.
I am spotting a couple of extra ones for functions:
src/backend/access/transam/xlog.c:
(errmsg("pg_stop_backup cleanup done, waiting for required WAL segments
to be archived")));
src/backend/access/transam/xlog.c:
(errmsg("pg_stop_backup still waiting for all required WAL segments to
be archived (%d seconds elapsed)",
Perhaps these could be improved as well?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
@ 2018-12-20 00:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 01:21 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
1 sibling, 1 reply; 8+ messages in thread
From: Tom Lane @ 2018-12-20 00:42 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Dec 19, 2018 at 05:53:48PM +0000, Alvaro Herrera wrote:
>> Remove function names from error messages
> I am spotting a couple of extra ones for functions:
> src/backend/access/transam/xlog.c:
> (errmsg("pg_stop_backup cleanup done, waiting for required WAL segments
> to be archived")));
> src/backend/access/transam/xlog.c:
> (errmsg("pg_stop_backup still waiting for all required WAL segments to
> be archived (%d seconds elapsed)",
> Perhaps these could be improved as well?
Those are at least reporting SQL function names that the user will
recognize ... still, we don't normally localize error messages
by the reporting function name, so I tend to agree that these are
not following the style guide.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
2018-12-20 00:42 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-12-20 01:21 ` Michael Paquier <michael@paquier.xyz>
2018-12-20 04:39 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2018-12-20 01:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
On Wed, Dec 19, 2018 at 07:42:31PM -0500, Tom Lane wrote:
> Those are at least reporting SQL function names that the user will
> recognize ... still, we don't normally localize error messages
> by the reporting function name, so I tend to agree that these are
> not following the style guide.
What do you think about something like the attached?
--
Michael
Attachments:
func-message-clean.patch (text/x-diff, 1.7K) download
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c80b14ed97..c92f2a8e61 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -11077,7 +11077,8 @@ 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("%s cleanup done, waiting for required WAL segments to be archived",
+ "pg_stop_backup()")));
reported_waiting = true;
}
@@ -11087,16 +11088,18 @@ 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)",
- waits),
+ (errmsg("%s still waiting for all required WAL segments to be archived (%d seconds elapsed)",
+ "pg_stop_backup()", waits),
errhint("Check that your archive_command is executing properly. "
- "pg_stop_backup can be canceled safely, "
- "but the database backup will not be usable without all the WAL segments.")));
+ "%s can be canceled safely, "
+ "but the database backup will not be usable without all the WAL segments.",
+ "pg_stop_backup()")));
}
}
ereport(NOTICE,
- (errmsg("pg_stop_backup complete, all required WAL segments have been archived")));
+ (errmsg("%s complete, all required WAL segments have been archived",
+ "pg_stop_backup()")));
}
else if (waitforarchive)
ereport(NOTICE,
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
2018-12-20 00:42 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 01:21 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
@ 2018-12-20 04:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 05:53 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2018-12-20 04:39 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Dec 19, 2018 at 07:42:31PM -0500, Tom Lane wrote:
>> Those are at least reporting SQL function names that the user will
>> recognize ... still, we don't normally localize error messages
>> by the reporting function name, so I tend to agree that these are
>> not following the style guide.
> What do you think about something like the attached?
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.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
2018-12-20 00:42 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 01:21 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
2018-12-20 04:39 ` Re: pgsql: Remove function names from error messages Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-12-20 05:53 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2018-12-20 05:53 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-committers@lists.postgresql.org
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) download
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 (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
@ 2018-12-21 14:05 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2018-12-21 23:29 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
1 sibling, 1 reply; 8+ messages in thread
From: Alvaro Herrera @ 2018-12-21 14:05 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org
On 2018-Dec-20, Michael Paquier wrote:
> On Wed, Dec 19, 2018 at 05:53:48PM +0000, Alvaro Herrera wrote:
> > Remove function names from error messages
> >
> > They are not necessary, and having them there gives useless work for
> > translators.
>
> I am spotting a couple of extra ones for functions:
> src/backend/access/transam/xlog.c:
> (errmsg("pg_stop_backup cleanup done, waiting for required WAL segments
> to be archived")));
Yeah, I grepped for other uses and found format() being mentioned too,
but there didn't seem to be any repetition in the messages other than
the ones I patched, so I didn't bother. Thanks for following through
with these ones in the other thread.
I grepped using '()' as part of the pattern to find function names;
maybe there's a more comprehensive way.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: pgsql: Remove function names from error messages
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Re: pgsql: Remove function names from error messages Michael Paquier <michael@paquier.xyz>
2018-12-21 14:05 ` Re: pgsql: Remove function names from error messages Alvaro Herrera <alvherre@2ndquadrant.com>
@ 2018-12-21 23:29 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2018-12-21 23:29 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, Dec 21, 2018 at 11:05:37AM -0300, Alvaro Herrera wrote:
> Yeah, I grepped for other uses and found format() being mentioned too,
> but there didn't seem to be any repetition in the messages other than
> the ones I patched, so I didn't bother. Thanks for following through
> with these ones in the other thread.
>
> I grepped using '()' as part of the pattern to find function names;
> maybe there's a more comprehensive way.
For the note: I have been grepping for "pg_".
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2018-12-21 23:29 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 17:53 pgsql: Remove function names from error messages Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-12-19 23:41 ` Michael Paquier <michael@paquier.xyz>
2018-12-20 00:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 01:21 ` Michael Paquier <michael@paquier.xyz>
2018-12-20 04:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-12-20 05:53 ` Michael Paquier <michael@paquier.xyz>
2018-12-21 14:05 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2018-12-21 23:29 ` Michael Paquier <michael@paquier.xyz>
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