1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add integrity-checking functions to pg_visibility.

The new pg_check_visible() and pg_check_frozen() functions can be used to
verify that the visibility map bits for a relation's data pages match the
actual state of the tuples on those pages.

Amit Kapila and Robert Haas, reviewed (in earlier versions) by Andres
Freund.  Additional testing help by Thomas Munro.
This commit is contained in:
Robert Haas
2016-06-15 14:33:58 -04:00
parent 38e9f90a22
commit e472ce9624
7 changed files with 376 additions and 4 deletions

View File

@ -32,7 +32,8 @@
Functions which display information about <literal>PD_ALL_VISIBLE</>
are much more costly than those which only consult the visibility map,
because they must read the relation's data blocks rather than only the
(much smaller) visibility map.
(much smaller) visibility map. Functions that check the relation's
data blocks are similarly expensive.
</para>
<sect2>
@ -92,6 +93,31 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>pg_check_frozen(regclass, t_ctid OUT tid) returns setof tid</function></term>
<listitem>
<para>
Returns the TIDs of non-frozen tuples present in pages marked all-frozen
in the visibility map. If this function returns a non-empty set of
TIDs, the database is corrupt.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>pg_check_visible(regclass, t_ctid OUT tid) returns setof tid</function></term>
<listitem>
<para>
Returns the TIDs of tuples which are not all-visible despite the fact
that the pages which contain them are marked as all-visible in the
visibility map. If this function returns a non-empty set of TIDs, the
database is corrupt.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>