Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-09-13 Thread Michael Paquier
On Thu, Sep 13, 2018 at 12:00:49PM +0300, Sergei Kornilov wrote:
> Looks better for me. Updated patch attached.

Thanks Sergei for the new version, pushed.
--
Michael


signature.asc
Description: PGP signature


Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-09-13 Thread Sergei Kornilov
Hello

> The brackets look rather useless to me, wouldn't it be better to remove
> them? By doing so the longest message becomes:
> "automatic aggressive vacuum to prevent wraparound of table blah.blah"
Hmm,

> 2018-09-13 11:48:09.303 MSK 6994 @ from  [vxid:6/713 txid:0] [] LOG:  
> automatic aggressive vacuum (to prevent wraparound) of table 
> "template0.pg_toast.pg_toast_12252": index scans: 0
or
> 2018-09-13 11:54:55.095 MSK 10115 @ from  [vxid:3/100278 txid:0] [] LOG:  
> automatic aggressive vacuum to prevent wraparound of table 
> "template0.pg_toast.pg_toast_12252": index scans: 0

Looks better for me. Updated patch attached.

regards, Sergeidiff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 5649a70..8996d36 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -374,10 +374,20 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 			 * emitting individual parts of the message when not applicable.
 			 */
 			initStringInfo();
-			if (aggressive)
-msgfmt = _("automatic aggressive vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			if (params->is_wraparound)
+			{
+if (aggressive)
+	msgfmt = _("automatic aggressive vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
+else
+	msgfmt = _("automatic vacuum to prevent wraparound of table \"%s.%s.%s\": index scans: %d\n");
+			}
 			else
-msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			{
+if (aggressive)
+	msgfmt = _("automatic aggressive vacuum of table \"%s.%s.%s\": index scans: %d\n");
+else
+	msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			}
 			appendStringInfo(, msgfmt,
 			 get_database_name(MyDatabaseId),
 			 get_namespace_name(RelationGetNamespace(onerel)),


Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-09-12 Thread Michael Paquier
On Wed, Sep 12, 2018 at 05:36:31PM +0900, Masahiko Sawada wrote:
> It would be useful if we have a number of the options autovacuum
> workers could use but since there are only 2 I'm not sure we need the
> list-style.

Looking at what Sergei has proposed upthread again, using a
comma-separated list of options may be more painful for translators as
such lists really depend on the language, so I would be fine to commit
what has been added.

One last point though: we use anti-wraparound in already five places in
the docs, still I have sympathy for "to prevent wraparound" as well.
The brackets look rather useless to me, wouldn't it be better to remove
them?  By doing so the longest message becomes:
"automatic aggressive vacuum to prevent wraparound of table blah.blah"
--
Michael


signature.asc
Description: PGP signature


Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-09-12 Thread Masahiko Sawada
On Tue, Jul 24, 2018 at 8:25 PM, Michael Paquier  wrote:
> On Tue, Jul 24, 2018 at 06:02:00PM +0900, Masahiko Sawada wrote:
>> Yeah, for translation I think it's better to make full lines. When we
>> added "aggressive" to autovacuum logs (commit b55509)  we've done the
>> same thing.
>
> I am wondering if it would easier to add an extra line in the output,
> like "Options: aggressive, wraparound prevention" or such...

It would be useful if we have a number of the options autovacuum
workers could use but since there are only 2 I'm not sure we need the
list-style.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-24 Thread Michael Paquier
On Tue, Jul 24, 2018 at 06:02:00PM +0900, Masahiko Sawada wrote:
> Yeah, for translation I think it's better to make full lines. When we
> added "aggressive" to autovacuum logs (commit b55509)  we've done the
> same thing.

I am wondering if it would easier to add an extra line in the output,
like "Options: aggressive, wraparound prevention" or such...
--
Michael


signature.asc
Description: PGP signature


Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-24 Thread Masahiko Sawada
On Sat, Jul 21, 2018 at 6:26 PM, Sergei Kornilov  wrote:
> Hello
>
>> Yes, a bit more verbosity would be nice for that. Using the term
>> "anti-wraparound" directly in the logs makes the most sense?
> I used "(to prevent wraparound)" to looks like reporting in pg_stat_activity. 
> As far i can see currently we not using "anti-wraparound" for user messages.
> On the other hand we using anti-wraparound in docs, so i can change wording.

+1 for "to prevent wraparound".

>
>> The patch could be made simpler by using empty strings with a single
>> ereport() call.
> How about proper translate in this case? Currently we translate full line 
> "automatic vacuum of table \"%s.%s.%s\": index scans: %d\n" before ereport 
> call.
>

Yeah, for translation I think it's better to make full lines. When we
added "aggressive" to autovacuum logs (commit b55509)  we've done the
same thing.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center



Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-23 Thread Robert Haas
On Sat, Jul 21, 2018 at 4:22 AM, Michael Paquier  wrote:
> On Sat, Jul 21, 2018 at 09:38:38AM +0300, Sergei Kornilov wrote:
>> Currently log_autovacuum_min_duration log message has no difference
>> between regular autovacuum and to prevent wraparound autovacuum. There
>> are important differences, for example, backend can automatically
>> cancel regular autovacuum, but not anti-wraparound. I think it is
>> useful indicate anti-wraparound in logs.
>
> Yes, a bit more verbosity would be nice for that.  Using the term
> "anti-wraparound" directly in the logs makes the most sense?

I'm not particularly in love with that terminology.  I doubt that it's
very clear to the average user.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-21 Thread Sergei Kornilov
Hello

> Yes, a bit more verbosity would be nice for that. Using the term
> "anti-wraparound" directly in the logs makes the most sense?
I used "(to prevent wraparound)" to looks like reporting in pg_stat_activity. 
As far i can see currently we not using "anti-wraparound" for user messages.
On the other hand we using anti-wraparound in docs, so i can change wording.

> The patch could be made simpler by using empty strings with a single
> ereport() call.
How about proper translate in this case? Currently we translate full line 
"automatic vacuum of table \"%s.%s.%s\": index scans: %d\n" before ereport call.

regards, Sergei



Re: Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-21 Thread Michael Paquier
On Sat, Jul 21, 2018 at 09:38:38AM +0300, Sergei Kornilov wrote:
> Currently log_autovacuum_min_duration log message has no difference
> between regular autovacuum and to prevent wraparound autovacuum. There
> are important differences, for example, backend can automatically
> cancel regular autovacuum, but not anti-wraparound. I think it is
> useful indicate anti-wraparound in logs.

Yes, a bit more verbosity would be nice for that.  Using the term
"anti-wraparound" directly in the logs makes the most sense?

> Small patch attached. I am not sure can be anti-wraparound autovacuum
> not aggressive, so i leave all 4 variants.

The patch could be made simpler by using empty strings with a single
ereport() call.
--
Michael


signature.asc
Description: PGP signature


Indicate anti-wraparound autovacuum in log_autovacuum_min_duration

2018-07-21 Thread Sergei Kornilov
Hello
Currently log_autovacuum_min_duration log message has no difference between 
regular autovacuum and to prevent wraparound autovacuum. There are important 
differences, for example, backend can automatically cancel regular autovacuum, 
but not anti-wraparound. I think it is useful indicate anti-wraparound in logs.

Small patch attached. I am not sure can be anti-wraparound autovacuum not 
aggressive, so i leave all 4 variants.

regards, Sergeidiff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 5649a70..5792854 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -374,10 +374,20 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params,
 			 * emitting individual parts of the message when not applicable.
 			 */
 			initStringInfo();
-			if (aggressive)
-msgfmt = _("automatic aggressive vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			if (params->is_wraparound)
+			{
+if (aggressive)
+	msgfmt = _("automatic aggressive vacuum (to prevent wraparound) of table \"%s.%s.%s\": index scans: %d\n");
+else
+	msgfmt = _("automatic vacuum (to prevent wraparound) of table \"%s.%s.%s\": index scans: %d\n");
+			}
 			else
-msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			{
+if (aggressive)
+	msgfmt = _("automatic aggressive vacuum of table \"%s.%s.%s\": index scans: %d\n");
+else
+	msgfmt = _("automatic vacuum of table \"%s.%s.%s\": index scans: %d\n");
+			}
 			appendStringInfo(, msgfmt,
 			 get_database_name(MyDatabaseId),
 			 get_namespace_name(RelationGetNamespace(onerel)),