From dda4f219d98851e80bd5d691c22204873a9940f9 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Wed, 9 Feb 2022 18:11:05 +0000 Subject: [PATCH v4] pg_walinspect docs --- doc/src/sgml/contrib.sgml | 1 + doc/src/sgml/filelist.sgml | 1 + doc/src/sgml/pgwalinspect.sgml | 120 +++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 doc/src/sgml/pgwalinspect.sgml diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml index be9711c6f2..19614a42e1 100644 --- a/doc/src/sgml/contrib.sgml +++ b/doc/src/sgml/contrib.sgml @@ -130,6 +130,7 @@ CREATE EXTENSION module_name; &pgsurgery; &pgtrgm; &pgvisibility; + &pgwalinspect; &postgres-fdw; &seg; &sepgsql; diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml index 328cd1f378..a2e8fd4a08 100644 --- a/doc/src/sgml/filelist.sgml +++ b/doc/src/sgml/filelist.sgml @@ -146,6 +146,7 @@ + diff --git a/doc/src/sgml/pgwalinspect.sgml b/doc/src/sgml/pgwalinspect.sgml new file mode 100644 index 0000000000..a2c11d36b7 --- /dev/null +++ b/doc/src/sgml/pgwalinspect.sgml @@ -0,0 +1,120 @@ + + + + pg_walinspect + + + pg_walinspect + + + + The pg_walinspect module provides functions that allow + you to inspect the contents of write-ahead log of PostgreSQL + database cluster at a low level, which is useful for debugging and analytical + purposes. + + + + By default, use of these functions is restricted to superusers and members of + the pg_monitor role. Access may be granted to others using + GRANT. + + + + General Functions + + + + + pg_get_raw_wal_record(in_lsn pg_lsn, lsn OUT pg_lsn, record OUT bytea) + + + + + Gets raw WAL record data of a given LSN. Issues a warning if the given + LSN wasn't a pointer to the start of a record and also wasn't a pointer + to the beginning of a WAL segment file. + + + + + + + pg_get_first_valid_wal_record_lsn(in_lsn pg_lsn, lsn OUT pg_lsn) + + + + + Checks if given LSN points to a valid WAL record, if yes, just outputs + it. Otherwise, gets the pointer to the start of a valid WAL record data + of the given LSN. Issues a warning if the given LSN wasn't a pointer to + the start of a record and also wasn't a pointer to the beginning of a WAL + segment file. + + + + + + + pg_verify_raw_wal_record(record bytea, is_valid OUT boolean) + + + + + Checks correctness of given raw WAL record by verifying its CRC. Returns + true if WAL record is valid, otherwise false. + + + + + + + pg_get_wal_record_info(in_lsn pg_lsn, lsn OUT pg_lsn, prev_lsn OUT pg_lsn, xid OUT xid, resource_manager OUT text, length OUT int4, total_length OUT int4, description OUT text, block_ref OUT text, data OUT bytea, data_len OUT int4) + + + + + Gets WAL record information of given LSN. Issues a warning if the given + LSN wasn't a pointer to the start of a record and also wasn't a pointer + to the beginning of a WAL segment file. + + + + + + + pg_get_wal_records_info(start_lsn pg_lsn, end_lsn pg_lsn, lsn OUT pg_lsn, prev_lsn OUT pg_lsn, xid OUT xid, resource_manager OUT text, length OUT int4, total_length OUT int4, description OUT text, block_ref OUT text, data OUT bytea, data_len OUT int4) + + + + + Gets information of all the valid WAL records between + start_lsn and end_lsn. + Returns one row per each valid WAL record. Issues a warning if the given + start_lsn wasn't a pointer to the start of a + record and also wasn't a pointer to the beginning of a WAL segment file. + + + + + + + pg_get_wal_stats(start_lsn pg_lsn, end_lsn pg_lsn, resource_manager OUT text, count OUT int8, count_percentage OUT float4, record_size OUT int8, record_size_percentage OUT float4, fpi_size OUT int8, fpi_size_percentage OUT float4, combined_size OUT int8, combined_size_percentage OUT float4) + + + + + Gets statistics of all the valid WAL records between + start_lsn and end_lsn. + Returns one row per each resource_manager type. + Issues a warning if the given start_lsn wasn't + a pointer to the start of a record and also wasn't a pointer to the + beginning of a WAL segment file. + + + + + + + + -- 2.25.1