Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0DCFD650014 for ; Sat, 19 Jul 2008 04:58:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01327-02 for ; Sat, 19 Jul 2008 04:58:02 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mk-outboundfilter-5.mail.uk.tiscali.com (mk-outboundfilter-5.mail.uk.tiscali.com [212.74.114.1]) by postgresql.org (Postfix) with ESMTP id 9EB2964FD0D for ; Sat, 19 Jul 2008 04:58:04 -0300 (ADT) X-Trace: 59665985/mk-outboundfilter-5.mail.uk.tiscali.com/F2S/$F2S-NILDRAM-ACCEPTED/f2s-temporary-group/85.211.229.155 X-SBRS: None X-RemoteIP: 85.211.229.155 X-IP-MAIL-FROM: simon@2ndquadrant.com X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUAAN87gUhV0+Wb/2dsb2JhbAAIrlU X-IronPort-AV: E=Sophos;i="4.31,214,1215385200"; d="scan'208";a="59665985" X-IP-Direction: IN Received: from 85-211-229-155.dyn.gotadsl.co.uk (HELO [192.168.0.3]) ([85.211.229.155]) by smtp.f2s.tiscali.co.uk with ESMTP; 19 Jul 2008 08:58:01 +0100 Subject: Re: Is autovacuum doing a wraparound-avoiding VACUUM? From: Simon Riggs To: Tom Lane Cc: Alvaro Herrera , List pgsql-patches In-Reply-To: <10642.1216359878@sss.pgh.pa.us> References: <1216227339.19656.364.camel@ebony.2ndQuadrant> <20080717211044.GR3934@alvh.no-ip.org> <1216335729.19656.683.camel@ebony.2ndQuadrant> <10642.1216359878@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="=-Qd+ABxdDzeyPuYgWLoUA" Date: Sat, 19 Jul 2008 09:04:08 +0100 Message-Id: <1216454648.19656.798.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL=0.004 X-Spam-Level: X-Archive-Number: 200807/183 X-Sequence-Number: 6877 --=-Qd+ABxdDzeyPuYgWLoUA Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 2008-07-18 at 01:44 -0400, Tom Lane wrote: > Simon Riggs writes: > > On Thu, 2008-07-17 at 17:10 -0400, Alvaro Herrera wrote: > >> I don't like your wording though; it feels too verbose (and you're > >> losing the ANALYZE in case it's doing both things). How about > >> > >> snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, > >> "autovacuum: VACUUM%s%s", vac > >> tab->at_doanalyze ? " ANALYZE" : "", > >> tab->at_wraparound ? " (wraparound)" : ""); > > > Yes, looks good. > > May I suggest "(to prevent wraparound)" or something like that? > Otherwise, +1. > > >> You're not proposing it for 8.3 right? > > > I think I am. It's an important diagnostic for your other fix. > > I agree, this is important for visibility into what's happening. > The string isn't getting translated so I don't see any big downside > to applying the patch in back branches. Patches for 8.3 and CVS HEAD. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support --=-Qd+ABxdDzeyPuYgWLoUA Content-Disposition: attachment; filename=wraparound_msg.v2.CVS_HEAD.patch Content-Type: text/x-patch; name=wraparound_msg.v2.CVS_HEAD.patch; charset=utf-8 Content-Transfer-Encoding: 7bit Index: src/backend/postmaster/autovacuum.c =================================================================== RCS file: /home/sriggs/pg/REPOSITORY/pgsql/src/backend/postmaster/autovacuum.c,v retrieving revision 1.81 diff -c -r1.81 autovacuum.c *** src/backend/postmaster/autovacuum.c 17 Jul 2008 21:02:31 -0000 1.81 --- src/backend/postmaster/autovacuum.c 19 Jul 2008 07:58:33 -0000 *************** *** 2657,2664 **** /* Report the command and possible options */ if (tab->at_dovacuum) snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, ! "autovacuum: VACUUM%s", ! tab->at_doanalyze ? " ANALYZE" : ""); else snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: ANALYZE"); --- 2657,2665 ---- /* Report the command and possible options */ if (tab->at_dovacuum) snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, ! "autovacuum: VACUUM%s%s", ! tab->at_doanalyze ? " ANALYZE" : "", ! tab->at_wraparound ? " (to prevent wraparound)" : ""); else snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: ANALYZE"); --=-Qd+ABxdDzeyPuYgWLoUA Content-Disposition: attachment; filename=wraparound_msg.v2.REL8_3_STABLE.patch Content-Type: text/x-patch; name=wraparound_msg.v2.REL8_3_STABLE.patch; charset=utf-8 Content-Transfer-Encoding: 7bit Index: src/backend/postmaster/autovacuum.c =================================================================== RCS file: /home/sriggs/pg/REPOSITORY/pgsql/src/backend/postmaster/autovacuum.c,v retrieving revision 1.71.2.4 diff -c -r1.71.2.4 autovacuum.c *** src/backend/postmaster/autovacuum.c 17 Jul 2008 21:02:41 -0000 1.71.2.4 --- src/backend/postmaster/autovacuum.c 19 Jul 2008 07:58:43 -0000 *************** *** 291,297 **** static PgStat_StatTabEntry *get_pgstat_tabentry_relid(Oid relid, bool isshared, PgStat_StatDBEntry *shared, PgStat_StatDBEntry *dbentry); ! static void autovac_report_activity(VacuumStmt *vacstmt, Oid relid); static void avl_sighup_handler(SIGNAL_ARGS); static void avl_sigusr1_handler(SIGNAL_ARGS); static void avl_sigterm_handler(SIGNAL_ARGS); --- 291,297 ---- static PgStat_StatTabEntry *get_pgstat_tabentry_relid(Oid relid, bool isshared, PgStat_StatDBEntry *shared, PgStat_StatDBEntry *dbentry); ! static void autovac_report_activity(VacuumStmt *vacstmt, Oid relid, bool for_wraparound); static void avl_sighup_handler(SIGNAL_ARGS); static void avl_sigusr1_handler(SIGNAL_ARGS); static void avl_sigterm_handler(SIGNAL_ARGS); *************** *** 2633,2639 **** MemoryContextSwitchTo(old_cxt); /* Let pgstat know what we're doing */ ! autovac_report_activity(&vacstmt, relid); vacuum(&vacstmt, relids, bstrategy, for_wraparound, true); } --- 2633,2639 ---- MemoryContextSwitchTo(old_cxt); /* Let pgstat know what we're doing */ ! autovac_report_activity(&vacstmt, relid, for_wraparound); vacuum(&vacstmt, relids, bstrategy, for_wraparound, true); } *************** *** 2650,2656 **** * bother to report "" or some such. */ static void ! autovac_report_activity(VacuumStmt *vacstmt, Oid relid) { char *relname = get_rel_name(relid); char *nspname = get_namespace_name(get_rel_namespace(relid)); --- 2650,2656 ---- * bother to report "" or some such. */ static void ! autovac_report_activity(VacuumStmt *vacstmt, Oid relid, bool for_wraparound) { char *relname = get_rel_name(relid); char *nspname = get_namespace_name(get_rel_namespace(relid)); *************** *** 2661,2668 **** /* Report the command and possible options */ if (vacstmt->vacuum) snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, ! "autovacuum: VACUUM%s", ! vacstmt->analyze ? " ANALYZE" : ""); else snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: ANALYZE"); --- 2661,2669 ---- /* Report the command and possible options */ if (vacstmt->vacuum) snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, ! "autovacuum: VACUUM%s%s", ! vacstmt->analyze ? " ANALYZE" : "", ! for_wraparound ? " (to prevent wraparound)" : ""); else snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: ANALYZE"); --=-Qd+ABxdDzeyPuYgWLoUA--