Re: [COMMITTERS] pgsql: autovacuum: Drop orphan temp tables more quickly but with more c

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: autovacuum: Drop orphan temp tables more quickly but with more c
Date: 2016-11-22 00:46:43
Message-ID: CAB7nPqSJdpzO17-K4sKDnmEWf4jHXx02kFuFrsiZOiVsOnAMgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Nov 21, 2016 at 10:05 AM, Robert Haas <rhaas(at)postgresql(dot)org> wrote:
> autovacuum: Drop orphan temp tables more quickly but with more caution.
>
> Previously, we only dropped an orphan temp table when it became old
> enough to threaten wraparound; instead, doing it immediately. The
> only value of waiting is that someone might be able to examine the
> contents of the orphan temp table for forensic purposes, but it's
> pretty difficult to actually do that and few users will wish to do so.
> On the flip side, not performing the drop immediately generates log
> spam and bloats pg_class.

I have found an obvious bug when reading the code this morning:
orphan_failures is not initialized:
diff --git a/src/backend/postmaster/autovacuum.c
b/src/backend/postmaster/autovacuum.c
index 954c1a1..be357e7 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1908,7 +1908,7 @@ do_autovacuum(void)
BufferAccessStrategy bstrategy;
ScanKeyData key;
TupleDesc pg_class_desc;
- int orphan_failures;
+ int orphan_failures = 0;
int effective_multixact_freeze_max_age;

/*
Attached is a patch.
--
Michael

Attachment Content-Type Size
autovac-init-fix.patch application/x-patch 428 bytes

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-11-22 00:57:14 Re: Re: [COMMITTERS] pgsql: autovacuum: Drop orphan temp tables more quickly but with more c
Previous Message Tom Lane 2016-11-21 23:22:22 pgsql: Fix PGLC_localeconv() to handle errors better.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-22 00:57:14 Re: Re: [COMMITTERS] pgsql: autovacuum: Drop orphan temp tables more quickly but with more c
Previous Message Michael Paquier 2016-11-21 23:32:41 Re: Improve OOM handling in pg_locale.c