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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Cosimo Streppone <cosimo(at)streppone(dot)it>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_autovacuum patch to display db name in log file is broken
Date: 2005-06-15 13:55:42
Message-ID: 200506151355.j5FDtgU01753@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.1 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-06-15 13:57:36 Re: plpgsql raise - parameters can be expressions
Previous Message Gerrit van Dyk 2005-06-15 13:03:46 Python setof patch