Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 473A49F971D; Sat, 25 Aug 2007 19:52:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 54516-07; Sat, 25 Aug 2007 19:51:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 19E829F9719; Sat, 25 Aug 2007 19:51:56 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l7PMprT8004910; Sat, 25 Aug 2007 18:51:53 -0400 (EDT) To: Alvaro Herrera cc: dx k9 , pgsql-admin@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: reindexdb hangs In-reply-to: <20070825222150.GU31461@alvh.no-ip.org> References: <22018.1178144703@sss.pgh.pa.us> <20070825222150.GU31461@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Sat, 25 Aug 2007 18:21:50 -0400" Date: Sat, 25 Aug 2007 18:51:53 -0400 Message-ID: <4909.1188082313@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/322 X-Sequence-Number: 26653 Alvaro Herrera writes: > Tom Lane wrote: >> Hmm, there is not any filter in ReindexDatabase() to exclude temp tables >> of other backends, but it sure seems like there needs to be. CLUSTER >> might have the same issue. I think we fixed this in VACUUM long ago, >> but we need to check the other commands that grovel over all of a database. > Was this ever fixed? I think it wasn't, because I don't see any check > in ReindexDatabase. Here is a patch to add one. No, that's still on the todo list. Your patch looks reasonable. > I examined cluster.c and it does seem to be missing a check too. I'm > not sure where to add one though; the best choice would be the place > where the list of rels is built, but that scans only pg_index, so it > doesn't have access to the namespace of each rel. So one idea would be > to get the pg_class row for each candidate, but that seems slow. > Another idea would be to just add all the candidates and silently skip > the temp indexes in cluster_rel. Yeah, an extra fetch of the pg_class row doesn't seem all that nice. I think you'd want to check it in approximately the same two places where pg_class_ownercheck() is applied (one for the 1-xact and one for the multi-xact path). Are there any other commands to be worried about? I can't see any besides VACUUM/ANALYZE, and those seem covered. regards, tom lane