You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/sgml/ref/pg_rewind.sgml
+49-45
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ PostgreSQL documentation
16
16
17
17
<refnamediv>
18
18
<refname>pg_rewind</refname>
19
-
<refpurpose>synchronize a <productname>PostgreSQL</productname> data directory with another data directory that was forked from the first one</refpurpose>
19
+
<refpurpose>synchronize a <productname>PostgreSQL</productname> data directory with another data directory that was forked from it</refpurpose>
20
20
</refnamediv>
21
21
22
22
<refsynopsisdiv>
@@ -44,56 +44,56 @@ PostgreSQL documentation
44
44
<application>pg_rewind</> is a tool for synchronizing a PostgreSQL cluster
45
45
with another copy of the same cluster, after the clusters' timelines have
46
46
diverged. A typical scenario is to bring an old master server back online
47
-
after failover, as a standby that follows the new master.
47
+
after failover as a standby that follows the new master.
48
48
</para>
49
49
50
50
<para>
51
51
The result is equivalent to replacing the target data directory with the
52
-
source one. All files are copied, including configuration files. The
52
+
source one. Only changed blocks from relation files are copied;
53
+
all other files are copied in full, including configuration files. The
53
54
advantage of <application>pg_rewind</> over taking a new base backup, or
54
55
tools like <application>rsync</>, is that <application>pg_rewind</> does
55
-
not require reading through all unchanged files in the cluster. That makes
56
-
it a lot faster when the database is large and only a small portion of it
57
-
differs between the clusters.
56
+
not require reading through unchanged blocks in the cluster. This makes
57
+
it a lot faster when the database is large and only a small
58
+
fraction of blocks differ between the clusters.
58
59
</para>
59
60
60
61
<para>
61
62
<application>pg_rewind</> examines the timeline histories of the source
62
63
and target clusters to determine the point where they diverged, and
63
64
expects to find WAL in the target cluster's <filename>pg_xlog</> directory
64
65
reaching all the way back to the point of divergence. The point of divergence
65
-
could be found either on target timeline, source timeline or their common
66
+
can be found either on the target timeline, the source timeline, or their common
66
67
ancestor. In the typical failover scenario where the target cluster was
67
-
shut down soon after the divergence, that is not a problem, but if the
68
-
target cluster had run for a long time after the divergence, the old WAL
69
-
files might not be present anymore. In that case, they can be manually
70
-
copied from the WAL archive to the <filename>pg_xlog</> directory. Fetching
71
-
missing files from a WAL archive automatically is currently not supported.
72
-
Besides, <application>pg_rewind</> use cases are not limited by failover.
73
-
For instance, standby server could be promoted, run some writes and
74
-
then be returned back as standby.
68
+
shut down soon after the divergence, this is not a problem, but if the
69
+
target cluster ran for a long time after the divergence, the old WAL
70
+
files might no longer be present. In that case, they can be manually
71
+
copied from the WAL archive to the <filename>pg_xlog</> directory, or
72
+
fetched on startup by configuring <filename>recovery.conf</>. The use of
73
+
<application>pg_rewind</> is not limited to failover, e.g. a standby
74
+
server can be promoted, run some write transactions, and then rewinded
75
+
to become a standby again.
75
76
</para>
76
77
77
78
<para>
78
-
When the target server is started up for the first time after running
79
+
When the target server is started for the first time after running
79
80
<application>pg_rewind</>, it will go into recovery mode and replay all
80
81
WAL generated in the source server after the point of divergence.
81
82
If some of the WAL was no longer available in the source server when
82
-
<application>pg_rewind</> was run, and therefore could not be copied by
83
-
<application>pg_rewind</> session, it needs to be made available when the
84
-
target server is started up. That can be done by creating a
83
+
<application>pg_rewind</> was run, and therefore could not be copied by the
84
+
<application>pg_rewind</> session, it must be made available when the
85
+
target server is started. This can be done by creating a
85
86
<filename>recovery.conf</> file in the target data directory with a
86
87
suitable <varname>restore_command</>.
87
88
</para>
88
89
89
90
<para>
90
91
<application>pg_rewind</> requires that the target server either has
91
-
the <xref linkend="guc-wal-log-hints"> option is enabled
92
-
in <filename>postgresql.conf</> or that data checksums were enabled when
92
+
the <xref linkend="guc-wal-log-hints"> option enabled
93
+
in <filename>postgresql.conf</> or data checksums enabled when
93
94
the cluster was initialized with <application>initdb</>. Neither of these
94
-
are currently on by default.
95
-
<xref linkend="guc-full-page-writes"> must also be enabled. That is the
96
-
default.
95
+
are currently on by default. <xref linkend="guc-full-page-writes">
96
+
must also be set to <literal>on</>, but is enabled by default.
97
97
</para>
98
98
</refsect1>
99
99
@@ -111,7 +111,7 @@ PostgreSQL documentation
111
111
<listitem>
112
112
<para>
113
113
This option specifies the target data directory that is synchronized
114
-
with the source. The target server must shut down cleanly before
114
+
with the source. The target server must be shut down cleanly before
0 commit comments