Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C302C1337B80 for ; Fri, 25 Mar 2011 18:56:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 62503-10 for ; Fri, 25 Mar 2011 21:56:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 2F3C71337990 for ; Fri, 25 Mar 2011 18:56:25 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p2PLuNIs016571; Fri, 25 Mar 2011 17:56:23 -0400 (EDT) To: Christopher Browne cc: Greg Stark , Alvaro Herrera , Maxim Boguk , pgsql-bugs Subject: Re: BUG #5946: Long exclusive lock taken by vacuum (not full) In-reply-to: References: <201103250856.p2P8ufGc004544@wwwmaster.postgresql.org> <4345.1301066239@sss.pgh.pa.us> <13556.1301069421@sss.pgh.pa.us> <1301080686-sup-7539@alvh.no-ip.org> <15329.1301082238@sss.pgh.pa.us> <16028.1301086103@sss.pgh.pa.us> Comments: In-reply-to Christopher Browne message dated "Fri, 25 Mar 2011 17:46:21 -0400" Date: Fri, 25 Mar 2011 17:56:22 -0400 Message-ID: <16570.1301090182@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/346 X-Sequence-Number: 29856 Christopher Browne writes: > What seems natural-ish to me might include: > - Stomping a bit on the FSM replacement to make sure nobody's going to > be writing to the later extensions; > - Watching free space during the process so the "first" extension gets > re-opened up if the free space in the much earlier parts of the table > (e.g. - that are not planned to be dropped off) is running out. You seem to be thinking only about the possibility that somebody would try to write a new tuple into the space-to-be-freed. The problem that necessitates use of AccessExclusiveLock is that somebody could be doing a seqscan that tries to *read* the blocks that are about to be truncated away. We can't really improve matters much here unless we think of a way to fix that. It would be okay if the scan just ignored blocks it failed to read, but how do you distinguish the case from a filesystem error that really should be reported? regards, tom lane