From: Alvaro Herrera <alvherre@commandprompt.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: dx k9 <bitsandbytes88@hotmail.com>
Cc: pgsql-admin@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: reindexdb hangs
Date: Sat, 25 Aug 2007 18:21:50 -0400
Message-ID: <20070825222150.GU31461@alvh.no-ip.org> (raw)
In-Reply-To: <22018.1178144703@sss.pgh.pa.us>
References: <BAY116-F2261C1BEF758D30196729DD1420@phx.gbl>
<22018.1178144703@sss.pgh.pa.us>
Tom Lane wrote:
> "dx k9" <bitsandbytes88@hotmail.com> writes:
> > [ stuck reindex ]
> > It turns out it was a temporary database and temporary table, that just
> > wasn't there maybe it thought it was there from some type of snapshot then
> > the next minute it was gone.
>
> 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.
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.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
Attachments:reindex-temp.patch (text/x-diff, 789B) download
Index: src/backend/commands/indexcmds.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/indexcmds.c,v
retrieving revision 1.162
diff -c -p -r1.162 indexcmds.c
*** src/backend/commands/indexcmds.c 25 Aug 2007 19:08:19 -0000 1.162
--- src/backend/commands/indexcmds.c 25 Aug 2007 22:11:18 -0000
*************** ReindexDatabase(const char *databaseName
*** 1292,1297 ****
--- 1292,1301 ----
if (classtuple->relkind != RELKIND_RELATION)
continue;
+ /* Skip temp tables of other backends; we can't reindex them at all */+ if (isOtherTempNamespace(classtuple->relnamespace))+ continue;+
/* Check user/system classification, and optionally skip */
if (IsSystemClass(classtuple))
{
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: alvherre@commandprompt.com, tgl@sss.pgh.pa.us, bitsandbytes88@hotmail.com, pgsql-hackers@postgresql.org
Subject: Re: reindexdb hangs
In-Reply-To: <20070825222150.GU31461@alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox