Re: CLUSTER and MVCC - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: CLUSTER and MVCC
Date
Msg-id 1173443467.3641.212.camel@silverbirch.site
Whole thread Raw
In response to CLUSTER and MVCC  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: CLUSTER and MVCC  ("Zeugswetter Andreas ADI SD" <ZeugswetterA@spardat.at>)
List pgsql-hackers
On Fri, 2007-03-09 at 11:29 +0000, Heikki Linnakangas wrote:
> Is there a particular reason why CLUSTER isn't MVCC-safe? It seems to me 
> that it would be trivial to fix, by using SnapshotAny instead of 
> SnapshotNow, and not overwriting the xmin/xmax with the xid of the 
> cluster command.

It's trivial to fix now in this way, but it would break HOT, since an
indexscan only returns one row per index entry.

> I feel that I must missing something, or someone would've already fixed 
> it a long time ago...
> 
> Csaba, you mentioned recently 
> (http://archives.postgresql.org/pgsql-hackers/2007-03/msg00027.php) that 
> you're actually using the MVCC-violation to clean up tables during a 
> backup. Can you tell us a bit more about that? Would you be upset if we 
> shut that backdoor?

On that thread I suggested we add NOWAIT syntax to allow the existing
behaviour to continue, as Csaba requested. The default should be to wait
for other transactions to complete, like CREATE INDEX CONCURRENTLY, when
the command is run outside of a transaction block.

If you do this any other way, you'll need to fix it for HOT.

> In any case, the MVCC-violation needs to be documented. I'll send a doc 
> patch to pgsql-patches shortly.
> 

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: CLUSTER and MVCC
Next
From: Gregory Stark
Date:
Subject: Re: RFC: changing autovacuum_naptime semantics