blob: 4b111f961133b497f1127209670b06a804e3a537 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
<!-- doc/src/sgml/pglogicalinspect.sgml -->
<sect1 id="pglogicalinspect" xreflabel="pg_logicalinspect">
<title>pg_logicalinspect — logical decoding components inspection</title>
<indexterm zone="pglogicalinspect">
<primary>pg_logicalinspect</primary>
</indexterm>
<para>
The <filename>pg_logicalinspect</filename> module provides SQL functions
that allow you to inspect the contents of logical decoding components. It
allows the inspection of serialized logical snapshots of a running
<productname>PostgreSQL</productname> database cluster, which is useful
for debugging or educational purposes.
</para>
<para>
By default, use of these functions is restricted to superusers and members of
the <literal>pg_read_server_files</literal> role. Access may be granted by
superusers to others using <command>GRANT</command>.
</para>
<sect2 id="pglogicalinspect-funcs">
<title>Functions</title>
<variablelist>
<varlistentry id="pglogicalinspect-funcs-pg-get-logical-snapshot-meta">
<term>
<function>pg_get_logical_snapshot_meta(filename text) returns record</function>
</term>
<listitem>
<para>
Gets logical snapshot metadata about a snapshot file that is located in
the server's <filename>pg_logical/snapshots</filename> directory.
The <replaceable>filename</replaceable> argument represents the snapshot
file name.
For example:
<screen>
postgres=# SELECT * FROM pg_ls_logicalsnapdir();
-[ RECORD 1 ]+-----------------------
name | 0-40796E18.snap
size | 152
modification | 2024-08-14 16:36:32+00
postgres=# SELECT * FROM pg_get_logical_snapshot_meta('0-40796E18.snap');
-[ RECORD 1 ]--------
magic | 1369563137
checksum | 1028045905
version | 6
postgres=# SELECT ss.name, meta.* FROM pg_ls_logicalsnapdir() AS ss,
pg_get_logical_snapshot_meta(ss.name) AS meta;
-[ RECORD 1 ]-------------
name | 0-40796E18.snap
magic | 1369563137
checksum | 1028045905
version | 6
</screen>
</para>
<para>
If <replaceable>filename</replaceable> does not match a snapshot file, the
function raises an error.
</para>
</listitem>
</varlistentry>
<varlistentry id="pglogicalinspect-funcs-pg-get-logical-snapshot-info">
<term>
<function>pg_get_logical_snapshot_info(filename text) returns record</function>
</term>
<listitem>
<para>
Gets logical snapshot information about a snapshot file that is located in
the server's <filename>pg_logical/snapshots</filename> directory.
The <replaceable>filename</replaceable> argument represents the snapshot
file name.
For example:
<screen>
postgres=# SELECT * FROM pg_ls_logicalsnapdir();
-[ RECORD 1 ]+-----------------------
name | 0-40796E18.snap
size | 152
modification | 2024-08-14 16:36:32+00
postgres=# SELECT * FROM pg_get_logical_snapshot_info('0-40796E18.snap');
-[ RECORD 1 ]------------+-----------
state | consistent
xmin | 751
xmax | 751
start_decoding_at | 0/40796AF8
two_phase_at | 0/40796AF8
initial_xmin_horizon | 0
building_full_snapshot | f
in_slot_creation | f
last_serialized_snapshot | 0/0
next_phase_at | 0
committed_count | 0
committed_xip |
catchange_count | 2
catchange_xip | {751,752}
postgres=# SELECT ss.name, info.* FROM pg_ls_logicalsnapdir() AS ss,
pg_get_logical_snapshot_info(ss.name) AS info;
-[ RECORD 1 ]------------+----------------
name | 0-40796E18.snap
state | consistent
xmin | 751
xmax | 751
start_decoding_at | 0/40796AF8
two_phase_at | 0/40796AF8
initial_xmin_horizon | 0
building_full_snapshot | f
in_slot_creation | f
last_serialized_snapshot | 0/0
next_phase_at | 0
committed_count | 0
committed_xip |
catchange_count | 2
catchange_xip | {751,752}
</screen>
</para>
<para>
If <replaceable>filename</replaceable> does not match a snapshot file, the
function raises an error.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="pglogicalinspect-author">
<title>Author</title>
<para>
Bertrand Drouvot <email>[email protected]</email>
</para>
</sect2>
</sect1>
|