Write visibility map during CLUSTER/VACUUM FULL - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Write visibility map during CLUSTER/VACUUM FULL
Date
Msg-id CAPpHfdtcxUVys6r6JqX2s+5CowXDKMOnfcJoJWHyjWDe=hwHMw@mail.gmail.com
Whole thread Raw
Responses Re: Write visibility map during CLUSTER/VACUUM FULL
Re: Write visibility map during CLUSTER/VACUUM FULL
List pgsql-hackers
Hi!

I found it weird that CLUSTER/VACUUM FULL don't write visibility map.
Attached patch implements writing visibility map in
heapam_relation_copy_for_cluster().

I've studied previous attempt to implement this [1].  The main problem
of that attempt was usage of existing heap_page_is_all_visible() and
visibilitymap_set() functions.  These functions works through buffer
manager, while heap rewriting is made bypass buffer manager.

In my patch visibility map pages are handled in the same way as heap
pages are.  RewriteStateData holds contents of single VM page.  Once
heap page is finished, corresponding bits are set to VM page etc.  VM
pages are flushed one-by-one to smgr.

This patch have to implement its own check if tuple is allvisible.
But it appears to be possible to simplify this check assuming that all
tuples already past HeapTupleSatisfiesVacuum(), which sets hint bits.

Links
1. https://www.postgresql.org/message-id/flat/20131203162556.GC27105%40momjian.us#90e4a6e77d92076650dcf1d96b32ba38

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment

pgsql-hackers by date:

Previous
From: Alexey Zagarin
Date:
Subject: Re: row filtering for logical replication
Next
From: Pierre Ducroquet
Date:
Subject: [Patch] Add a reset_computed_values function in pg_stat_statements