Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YfvMO-0000oQ-Lp for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Apr 2015 19:10:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YfvMO-0006CC-5K for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Apr 2015 19:10:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YfvMN-0006Bz-2p for pgsql-bugs@postgresql.org; Wed, 08 Apr 2015 19:09:59 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YfvMJ-0004Dp-5A for pgsql-bugs@postgresql.org; Wed, 08 Apr 2015 19:09:57 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YfvMI-0001zO-1I; Wed, 08 Apr 2015 15:09:54 -0400 Date: Wed, 8 Apr 2015 15:09:54 -0400 From: Bruce Momjian To: maciek@heroku.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13002: VACUUM to prevent wraparound blocks TRUNCATE Message-ID: <20150408190954.GC22805@momjian.us> References: <20150408184155.26383.16053@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150408184155.26383.16053@wrigleys.postgresql.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Wed, Apr 8, 2015 at 06:41:55PM +0000, maciek@heroku.com wrote: > The following bug has been logged on the website: > > Bug reference: 13002 > Logged by: Maciek Sakrejda > Email address: maciek@heroku.com > PostgreSQL version: 9.3.6 > Operating system: Ubuntu 14.04 > Description: > > If autovacuum is running a VACUUM to prevent wraparound on a certain table, > it looks like it blocks TRUNCATE of that table, which would obviate the need > for the VACUUM in the first place (and could happen much more quickly). This > seems like a usability wart at best--one has to instead kill the autovacuum > (e.g., via pg_cancel_backend) and then TRUNCATE. This is especially > inconvenient when the user trying to truncate does not have permission to > kill (or even see!) the wraparound VACUUM. Would it be possible to have > autovacuum yield to a TRUNCATE in this situation? My guess is this would be hard to do. VACUUM and TRUNCATE request conflicting locks, so you would have to embed in the locking code that the _outcome_ of one should allow it to override the lock of the other. I can't think of anywhere that we allow that. Frankly, you can't really just ignore the lock --- you would have to cancel the vacuum by sending a signal or something. I know we have cases where vacuum aborts if it can't get a lock or something, but I can't remembrer any case where we externally cancel vacuum like that. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs