Re: pg_autovacuum patch to display db name in log file is broken

Started by Bruce Momjianabout 21 years ago1 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Patch applied. Thanks.

---------------------------------------------------------------------------

Cosimo Streppone wrote:

Hi Bruce,

it seems that the quick fix I submitted about pg_autovacuum to
show "ANALYZE dbname.tablename" in logs is broken.

In fact, looking at the cvs diff at:

http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pg_autovacuum/pg_autovacuum.c.diff?r1=1.33;r2=1.34

shows that the `buf' string is being snprintf'ed to display log message but
also to run query against backend, so clearly "ANALYZE mydb.mytable" is not
going to work.

I noticed that, I think it should be corrected with something like
the following (diff from pg_autovacuum.c rev. 1.33)

-------8<----------------

--- pg_autovacuum.c.1.33    2005-06-08 13:07:11.744104013 +0200
+++ pg_autovacuum.c 2005-06-08 13:27:02.258965845 +0200
@@ -472,7 +472,7 @@
if (args->debug >= 1)
{
-       sprintf(logbuffer, "Removing table: %s from list.", tbl->table_name);
+       sprintf(logbuffer, "Removing table: %s.%s from list.", tbl->dbi->dbname, 
tbl->table_name);
log_entry(logbuffer, LVL_DEBUG);
fflush(LOGOUTPUT);
}
@@ -1057,7 +1057,7 @@
if (args->debug >= 1)
{
-       sprintf(logbuffer, "Performing: %s", buf);
+       sprintf(logbuffer, "Performing: %s on database %s", buf, dbi->dbname);
log_entry(logbuffer, LVL_DEBUG);
fflush(LOGOUTPUT);
}

------8<-------------

Sorry for the error.
I should have reviewed better the patch before submitting.

--
Cosimo

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+4-4