Your patch has been added to the PostgreSQL unapplied patches list at:

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.


Heikki Linnakangas wrote:
> Here's an update, fixing conflict by Tom's recent commit of Simon's 
> patch to skip WAL-inserts when archiving is not enabled.
> Heikki Linnakangas wrote:
> > This patch makes CLUSTER MVCC-safe. Visibility information and update 
> > chains are preserved like in VACUUM FULL.
> > 
> > I created a new generic rewriteheap-facility to handle rewriting tables 
> > in a visibility-preserving manner. All the update chain tracking is done 
> > in rewriteheap.c, the caller is responsible for supplying the stream of 
> > tuples.
> > 
> > CLUSTER is currently the only user of the facility, but I'm envisioning 
> > we might have other users in the future. For example, a version of 
> > VACUUM FULL that rewrites the whole table. We could also use it to make 
> > ALTER TABLE MVCC-safe, but there's some issues with that. For example, 
> > what to do if RECENTLY_DEAD tuples don't satisfy a newly added constraint.
> > 
> > One complication in the implementation was the fact that heap_insert 
> > overwrites the visibility information, and it doesn't write the full 
> > tuple header to WAL. I ended up implementing a special-purpose 
> > raw_heap_insert function instead, which is optimized for bulk inserting 
> > a lot of tuples, knowing that we have exclusive access to the heap. 
> > raw_heap_insert keeps the current buffer locked over calls, until it 
> > gets full, and inserts the whole page to WAL as a single record using 
> > the existing XLOG_HEAP_NEWPAGE record type.
> > 
> > This makes CLUSTER a more viable alternative to VACUUM FULL. One 
> > motivation for making CLUSTER MVCC-safe is that if some poor soul runs 
> > pg_dump to make a backup concurrently with CLUSTER, the clustered tables 
> > will appear to be empty in the dump file.
> > 
> > The documentation doesn't anything about CLUSTER not being MVCC-safe, so 
> > I suppose there's no need to touch the docs. I sent a doc patch earlier 
> > to add a note about it, that doc patch should still be applied to older 
> > release branches, IMO.
> -- 
>    Heikki Linnakangas
>    EnterpriseDB

> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

  Bruce Momjian  <[EMAIL PROTECTED]>

  + If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to