Re: CLUSTER patch - Mailing list pgsql-patches

From Tom Lane
Subject Re: CLUSTER patch
Date
Msg-id 19224.1026665899@sss.pgh.pa.us
Whole thread Raw
In response to CLUSTER patch  (Alvaro Herrera <alvherre@atentus.com>)
Responses Re: CLUSTER patch
List pgsql-patches
Alvaro Herrera <alvherre@atentus.com> writes:
> The way the cluster is done is still the same: first cluster the heap
> and swap relfilenodes, then drop old heap; then rebuild each index, swap
> relfilenodes with old index and drop new.

I do not see anything in this patch that touches relfilenode.  Perhaps
the patch is incomplete?

> But as soon as I try to do anything to it (the new,
> clustered filenode) before transaction commit (building an index, say),
> the local buffer manager fails an assertion (actually,
> RelationNodeCacheGetRelation returns 0 for the given rnode), and the
> transaction aborts.

Hmm.  If you do the swap in the correct way (viz, update the relation's
pg_class entry and then CommandCounterIncrement) I'd expect the relcache
to respond correctly.  This does involve re-indexing the relcache entry
under a new relfilenode value, but that's not significantly different
from the case of renaming a relation.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: CLUSTER patch
Next
From: Tom Lane
Date:
Subject: Re: CLUSTER patch