From d1f3c3a295b842fbf6a3a9a040cfbd33e52d7333 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Fri, 25 Feb 2022 07:30:49 +0000 Subject: [PATCH v5] pg_walinspect docs --- doc/src/sgml/contrib.sgml | 1 + doc/src/sgml/filelist.sgml | 1 + doc/src/sgml/pgwalinspect.sgml | 165 +++++++++++++++++++++++++++++++++ 3 files changed, 167 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..fa9f1d9b6c --- /dev/null +++ b/doc/src/sgml/pgwalinspect.sgml @@ -0,0 +1,165 @@ + + + + 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. This function will not wait if + the future WAL LSN is provided, instead emits a warning and returns an + empty row. + + + + + + + pg_get_first_valid_wal_record_lsn(in_lsn pg_lsn, lsn OUT pg_lsn, prev_lsn OUT pg_lsn) + + + + + Gets first and previous valid WAL record LSNs 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. This + function will not wait if the future WAL LSN is provided, instead emits + a warning and returns an empty row. + + + + + + + pg_get_first_and_last_valid_wal_record_lsn(wal_file_name text, first_valid_lsn OUT pg_lsn, last_valid_lsn OUT pg_lsn) + + + + + Gets first and last valid WAL record LSNs of the given WAL file. + + + + + + + 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 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. This function will not + wait if the future WAL LSN is provided, instead emits a warning and + returns an empty row. + + + + + + + pg_get_wal_records_info(start_lsn pg_lsn, end_lsn pg_lsn, wait_for_wal boolean DEFAULT false, 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. + This function will wait if the future WAL LSN is provided when + wait_for_wal is passed as true. + If wait_for_wal is false + (default value), it will not wait for the future WAL, instead emits a + warning and returns rows for whatever available WAL records. + + + + + + + pg_get_wal_records_info_till_end_of_wal(start_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 from + start_lsn till end of WAL. This function is + similar to pg_get_wal_records_info except that it + doesn't have end_lsn as input and it doesn't + wait for the future WAL. + + + + + + + pg_get_wal_stats(start_lsn pg_lsn, end_lsn pg_lsn, wait_for_wal boolean DEFAULT false, 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. This function will wait if the + future WAL LSN is provided when wait_for_wal + is passed as true. If wait_for_wal + is false (default value), it will not wait for the + future WAL, instead emits a warning and returns rows for whatever + available WAL records. + + + + + + + pg_get_wal_stats_till_end_of_wal(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 from + start_lsn till end of WAL. This function is + similar to pg_get_wal_stats except that it doesn't + have end_lsn as input and it doesn't wait for + the future WAL. + + + + + + + + -- 2.25.1