summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-03-17 09:49:10 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-03-17 10:55:17 -0400
commitfef2bcdcba0888c95ddf2a7535179c3b9a6a2f0e (patch)
treef0234ec4b3b6ac47d293254b9043d2f62b462aca /doc/src
parent64ae420b275a82534732aafd9d550b9982ca0a5d (diff)
pageinspect: Add page_checksum function
Author: Tomas Vondra <tomas.vondra@2ndquadrant.com> Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/pageinspect.sgml47
1 files changed, 45 insertions, 2 deletions
diff --git a/doc/src/sgml/pageinspect.sgml b/doc/src/sgml/pageinspect.sgml
index 5e6712f9cde..9f41bb21eb9 100644
--- a/doc/src/sgml/pageinspect.sgml
+++ b/doc/src/sgml/pageinspect.sgml
@@ -73,12 +73,55 @@
test=# SELECT * FROM page_header(get_raw_page('pg_class', 0));
lsn | checksum | flags | lower | upper | special | pagesize | version | prune_xid
-----------+----------+--------+-------+-------+---------+----------+---------+-----------
- 0/24A1B50 | 1 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
+ 0/24A1B50 | 0 | 1 | 232 | 368 | 8192 | 8192 | 4 | 0
</screen>
The returned columns correspond to the fields in the
<structname>PageHeaderData</> struct.
See <filename>src/include/storage/bufpage.h</> for details.
- </para>
+ </para>
+
+ <para>
+ The <structfield>checksum</structfield> field is the checksum stored in
+ the page, which might be incorrect if the page is somehow corrupted. If
+ data checksums are not enabled for this instance, then the value stored
+ is meaningless.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <function>page_checksum(page bytea, blkno int4) returns smallint</function>
+ <indexterm>
+ <primary>page_checksum</primary>
+ </indexterm>
+ </term>
+
+ <listitem>
+ <para>
+ <function>page_checksum</function> computes the checksum for the page, as if
+ it was located at the given block.
+ </para>
+
+ <para>
+ A page image obtained with <function>get_raw_page</function> should be
+ passed as argument. For example:
+<screen>
+test=# SELECT page_checksum(get_raw_page('pg_class', 0), 0);
+ page_checksum
+---------------
+ 13443
+</screen>
+ Note that the checksum depends on the block number, so matching block
+ numbers should be passed (except when doing esoteric debugging).
+ </para>
+
+ <para>
+ The checksum computed with this function can be compared with
+ the <structfield>checksum</structfield> result field of the
+ function <function>page_header</function>. If data checksums are
+ enabled for this instance, then the two values should be equal.
+ </para>
</listitem>
</varlistentry>