2013-02-22 20:46:24 +01:00
|
|
|
<!--
|
2017-02-09 22:23:46 +01:00
|
|
|
doc/src/sgml/ref/pg_waldump.sgml
|
2013-02-22 20:46:24 +01:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
2017-02-09 22:23:46 +01:00
|
|
|
<refentry id="pgwaldump">
|
|
|
|
<indexterm zone="pgwaldump">
|
|
|
|
<primary>pg_waldump</primary>
|
2014-02-24 03:25:35 +01:00
|
|
|
</indexterm>
|
|
|
|
|
2013-02-22 20:46:24 +01:00
|
|
|
<refmeta>
|
2017-02-09 22:23:46 +01:00
|
|
|
<refentrytitle><application>pg_waldump</application></refentrytitle>
|
2013-02-22 20:46:24 +01:00
|
|
|
<manvolnum>1</manvolnum>
|
|
|
|
<refmiscinfo>Application</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
2017-02-09 22:23:46 +01:00
|
|
|
<refname>pg_waldump</refname>
|
2016-07-15 04:28:58 +02:00
|
|
|
<refpurpose>display a human-readable rendering of the write-ahead log of a <productname>PostgreSQL</productname> database cluster</refpurpose>
|
2013-02-22 20:46:24 +01:00
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<cmdsynopsis>
|
2017-02-09 22:23:46 +01:00
|
|
|
<command>pg_waldump</command>
|
2013-02-22 20:46:24 +01:00
|
|
|
<arg rep="repeat" choice="opt"><option>option</option></arg>
|
2018-11-13 13:51:38 +01:00
|
|
|
<arg choice="opt"><option>startseg</option><arg choice="opt"><option>endseg</option></arg></arg>
|
2013-02-22 20:46:24 +01:00
|
|
|
</cmdsynopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
2017-10-20 03:16:39 +02:00
|
|
|
<refsect1 id="r1-app-pgwaldump-1">
|
2013-02-22 20:46:24 +01:00
|
|
|
<title>Description</title>
|
|
|
|
<para>
|
2017-02-09 22:23:46 +01:00
|
|
|
<command>pg_waldump</command> displays the write-ahead log (WAL) and is mainly
|
2013-02-22 20:46:24 +01:00
|
|
|
useful for debugging or educational purposes.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This utility can only be run by the user who installed the server, because
|
|
|
|
it requires read-only access to the data directory.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Options</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The following command-line options control the location and format of the
|
|
|
|
output:
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="parameter">startseg</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Start reading at the specified log segment file. This implicitly determines
|
|
|
|
the path in which files will be searched for, and the timeline to use.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="parameter">endseg</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Stop after reading the specified log segment file.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-b</option></term>
|
|
|
|
<term><option>--bkp-details</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Output detailed information about backup blocks.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-e <replaceable>end</replaceable></option></term>
|
|
|
|
<term><option>--end=<replaceable>end</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-05-12 19:51:27 +02:00
|
|
|
Stop reading at the specified WAL location, instead of reading to the
|
2013-02-22 20:46:24 +01:00
|
|
|
end of the log stream.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2014-03-26 12:48:20 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-f</option></term>
|
|
|
|
<term><option>--follow</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
After reaching the end of valid WAL, keep polling once per second for
|
|
|
|
new WAL to appear.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2013-02-22 20:46:24 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-n <replaceable>limit</replaceable></option></term>
|
|
|
|
<term><option>--limit=<replaceable>limit</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Display the specified number of records, then stop.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-p <replaceable>path</replaceable></option></term>
|
|
|
|
<term><option>--path=<replaceable>path</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-01-11 04:38:14 +01:00
|
|
|
Specifies a directory to search for log segment files or a
|
|
|
|
directory with a <literal>pg_wal</literal> subdirectory that
|
|
|
|
contains such files. The default is to search in the current
|
|
|
|
directory, the <literal>pg_wal</literal> subdirectory of the
|
|
|
|
current directory, and the <literal>pg_wal</literal> subdirectory
|
|
|
|
of <envar>PGDATA</envar>.
|
2013-02-22 20:46:24 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-r <replaceable>rmgr</replaceable></option></term>
|
|
|
|
<term><option>--rmgr=<replaceable>rmgr</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Only display records generated by the specified resource manager.
|
2017-10-09 03:44:17 +02:00
|
|
|
If <literal>list</literal> is passed as name, print a list of valid resource manager
|
2013-02-22 20:46:24 +01:00
|
|
|
names, and exit.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-s <replaceable>start</replaceable></option></term>
|
|
|
|
<term><option>--start=<replaceable>start</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-05-12 19:51:27 +02:00
|
|
|
WAL location at which to start reading. The default is to start reading
|
2013-02-22 20:46:24 +01:00
|
|
|
the first valid log record found in the earliest file found.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-t <replaceable>timeline</replaceable></option></term>
|
2016-05-04 20:07:00 +02:00
|
|
|
<term><option>--timeline=<replaceable>timeline</replaceable></option></term>
|
2013-02-22 20:46:24 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Timeline from which to read log records. The default is to use the
|
2017-10-09 03:44:17 +02:00
|
|
|
value in <replaceable>startseg</replaceable>, if that is specified; otherwise, the
|
2013-02-22 20:46:24 +01:00
|
|
|
default is 1.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-V</option></term>
|
|
|
|
<term><option>--version</option></term>
|
2013-02-22 20:46:24 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-02-09 22:23:46 +01:00
|
|
|
Print the <application>pg_waldump</application> version and exit.
|
2013-02-22 20:46:24 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-x <replaceable>xid</replaceable></option></term>
|
|
|
|
<term><option>--xid=<replaceable>xid</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2015-09-11 03:22:21 +02:00
|
|
|
Only display records marked with the given transaction ID.
|
2013-02-22 20:46:24 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2014-09-19 16:33:16 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-z</option></term>
|
|
|
|
<term><option>--stats[=record]</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Display summary statistics (number and size of records and
|
|
|
|
full-page images) instead of individual records. Optionally
|
|
|
|
generate statistics per-record instead of per-rmgr.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2013-02-22 20:46:24 +01:00
|
|
|
<varlistentry>
|
2017-10-09 03:44:17 +02:00
|
|
|
<term><option>-?</option></term>
|
|
|
|
<term><option>--help</option></term>
|
2013-02-22 20:46:24 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2017-02-09 22:23:46 +01:00
|
|
|
Show help about <application>pg_waldump</application> command line
|
2013-02-22 20:46:24 +01:00
|
|
|
arguments, and exit.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
Unified logging system for command-line programs
This unifies the various ad hoc logging (message printing, error
printing) systems used throughout the command-line programs.
Features:
- Program name is automatically prefixed.
- Message string does not end with newline. This removes a common
source of inconsistencies and omissions.
- Additionally, a final newline is automatically stripped, simplifying
use of PQerrorMessage() etc., another common source of mistakes.
- I converted error message strings to use %m where possible.
- As a result of the above several points, more translatable message
strings can be shared between different components and between
frontends and backend, without gratuitous punctuation or whitespace
differences.
- There is support for setting a "log level". This is not meant to be
user-facing, but can be used internally to implement debug or
verbose modes.
- Lazy argument evaluation, so no significant overhead if logging at
some level is disabled.
- Some color in the messages, similar to gcc and clang. Set
PG_COLOR=auto to try it out. Some colors are predefined, but can be
customized by setting PG_COLORS.
- Common files (common/, fe_utils/, etc.) can handle logging much more
simply by just using one API without worrying too much about the
context of the calling program, requiring callbacks, or having to
pass "progname" around everywhere.
- Some programs called setvbuf() to make sure that stderr is
unbuffered, even on Windows. But not all programs did that. This
is now done centrally.
Soft goals:
- Reduces vertical space use and visual complexity of error reporting
in the source code.
- Encourages more deliberate classification of messages. For example,
in some cases it wasn't clear without analyzing the surrounding code
whether a message was meant as an error or just an info.
- Concepts and terms are vaguely aligned with popular logging
frameworks such as log4j and Python logging.
This is all just about printing stuff out. Nothing affects program
flow (e.g., fatal exits). The uses are just too varied to do that.
Some existing code had wrappers that do some kind of print-and-exit,
and I adapted those.
I tried to keep the output mostly the same, but there is a lot of
historical baggage to unwind and special cases to consider, and I
might not always have succeeded. One significant change is that
pg_rewind used to write all error messages to stdout. That is now
changed to stderr.
Reviewed-by: Donald Dong <xdong@csumb.edu>
Reviewed-by: Arthur Zakirov <a.zakirov@postgrespro.ru>
Discussion: https://www.postgresql.org/message-id/flat/6a609b43-4f57-7348-6480-bd022f924310@2ndquadrant.com
2019-04-01 14:24:37 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Environment</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><envar>PGDATA</envar></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Data directory; see also the <option>-p</option> option.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><envar>PG_COLOR</envar></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specifies whether to use color in diagnostics messages. Possible values
|
|
|
|
are <literal>always</literal>, <literal>auto</literal>,
|
|
|
|
<literal>never</literal>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
2013-02-22 20:46:24 +01:00
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
<para>
|
|
|
|
Can give wrong results when the server is running.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Only the specified timeline is displayed (or the default, if none is
|
|
|
|
specified). Records in other timelines are ignored.
|
|
|
|
</para>
|
2015-07-03 04:53:58 +02:00
|
|
|
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
<application>pg_waldump</application> cannot read WAL files with suffix
|
|
|
|
<literal>.partial</literal>. If those files need to be read, <literal>.partial</literal>
|
2015-09-11 03:22:21 +02:00
|
|
|
suffix needs to be removed from the file name.
|
2015-07-03 04:53:58 +02:00
|
|
|
</para>
|
2013-02-22 20:46:24 +01:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2017-11-23 15:39:47 +01:00
|
|
|
<member><xref linkend="wal-internals"/></member>
|
2013-02-22 20:46:24 +01:00
|
|
|
</simplelist>
|
2013-02-22 22:52:59 +01:00
|
|
|
</refsect1>
|
2013-02-22 20:46:24 +01:00
|
|
|
|
|
|
|
</refentry>
|