Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit064b3fc

Browse files
committed
Fix some documentation in pg_rewind
Since 11, it is possible to use a non-superuser role when using anonline source cluster with pg_rewind as long as the role has properpermissions to execute on the source all the functions used bypg_rewind, and the documentation stated that a superuser is necessary.Let's add at the same time all the details needed to create such arole.A second confusion which comes a lot from users is that it is necessaryto issue a checkpoint on a freshly-promoted standby so as its controlfile has up-to-date timeline information which is used by pg_rewind tovalidate the operation. Let's document that properly. This isback-patched down to 9.5 where pg_rewind has been introduced.Author: Michael PaquierReviewed-by: Magnus HaganderDiscussion:https://postgr.es/m/CABUevEz5bpvbwVsYCaSMV80CBZ5-82nkMzbb+Bu=h1m=rLdn=g@mail.gmail.comBackpatch-through: 9.5
1 parent7dbc075 commit064b3fc

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)

[8]ページ先頭

©2009-2025 Movatter.jp