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, Sergei
diff --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(&buf);
-			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(&buf, msgfmt,
 							 get_database_name(MyDatabaseId),
 							 get_namespace_name(RelationGetNamespace(onerel)),

Reply via email to