Skip to content

Commit 064b3fc

Browse files
committed
Fix some documentation in pg_rewind
Since 11, it is possible to use a non-superuser role when using an online source cluster with pg_rewind as long as the role has proper permissions to execute on the source all the functions used by pg_rewind, and the documentation stated that a superuser is necessary. Let's add at the same time all the details needed to create such a role. A second confusion which comes a lot from users is that it is necessary to issue a checkpoint on a freshly-promoted standby so as its control file has up-to-date timeline information which is used by pg_rewind to validate the operation. Let's document that properly. This is back-patched down to 9.5 where pg_rewind has been introduced. Author: Michael Paquier Reviewed-by: Magnus Hagander Discussion: https://postgr.es/m/CABUevEz5bpvbwVsYCaSMV80CBZ5-82nkMzbb+Bu=h1m=rLdn=g@mail.gmail.com Backpatch-through: 9.5
1 parent 7dbc075 commit 064b3fc

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

doc/src/sgml/ref/pg_rewind.sgml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ PostgreSQL documentation
153153
<listitem>
154154
<para>
155155
Specifies a libpq connection string to connect to the source
156-
<productname>PostgreSQL</productname> server to synchronize the target with.
157-
The connection must be a normal (non-replication) connection
158-
with superuser access. This option requires the source
159-
server to be running and not in recovery mode.
156+
<productname>PostgreSQL</productname> server to synchronize the target
157+
with. The connection must be a normal (non-replication) connection
158+
with a role having sufficient permissions to execute the functions
159+
used by <application>pg_rewind</application> on the source server
160+
(see Notes section for details) or a superuser role. This option
161+
requires the source server to be running and not in recovery mode.
160162
</para>
161163
</listitem>
162164
</varlistentry>
@@ -221,6 +223,30 @@ PostgreSQL documentation
221223
<refsect1>
222224
<title>Notes</title>
223225

226+
<para>
227+
When executing <application>pg_rewind</application> using an online
228+
cluster as source, a role having sufficient permissions to execute the
229+
functions used by <application>pg_rewind</application> on the source
230+
cluster can be used instead of a superuser. Here is how to create such
231+
a role, named <literal>rewind_user</literal> here:
232+
<programlisting>
233+
CREATE USER rewind_user LOGIN;
234+
GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean) TO rewind_user;
235+
GRANT EXECUTE ON function pg_catalog.pg_stat_file(text, boolean) TO rewind_user;
236+
GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text) TO rewind_user;
237+
GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean) TO rewind_user;
238+
</programlisting>
239+
</para>
240+
241+
<para>
242+
When executing <application>pg_rewind</application> using an online
243+
cluster as source which has been recently promoted, it is necessary
244+
to execute a <command>CHECKPOINT</command> after promotion so as its
245+
control file reflects up-to-date timeline information, which is used by
246+
<application>pg_rewind</application> to check if the target cluster
247+
can be rewound using the designated source cluster.
248+
</para>
249+
224250
<refsect2>
225251
<title>How it works</title>
226252

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy