1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Use pg_rewind when target timeline was switched

Allow pg_rewind to work when target timeline was switched. Now
user can return promoted standby to old master.

Target timeline history becomes a global variable. Index
in target timeline history is used in function interfaces instead of
specifying TLI directly. Thus, SimpleXLogPageRead() can easily start
reading XLOGs from next timeline when current timeline ends.

Author: Alexander Korotkov
Review: Michael Paquier
This commit is contained in:
Teodor Sigaev
2015-12-01 18:56:44 +03:00
parent 0e0776bc99
commit e50cda7840
5 changed files with 181 additions and 77 deletions

View File

@ -61,13 +61,17 @@ PostgreSQL documentation
<application>pg_rewind</> examines the timeline histories of the source
and target clusters to determine the point where they diverged, and
expects to find WAL in the target cluster's <filename>pg_xlog</> directory
reaching all the way back to the point of divergence. In the typical
failover scenario where the target cluster was shut down soon after the
divergence, that is not a problem, but if the target cluster had run for a
long time after the divergence, the old WAL files might not be present
anymore. In that case, they can be manually copied from the WAL archive to
the <filename>pg_xlog</> directory. Fetching missing files from a WAL
archive automatically is currently not supported.
reaching all the way back to the point of divergence. The point of divergence
could be found either on target timeline, source timeline or their common
ancestor. In the typical failover scenario where the target cluster was
shut down soon after the divergence, that is not a problem, but if the
target cluster had run for a long time after the divergence, the old WAL
files might not be present anymore. In that case, they can be manually
copied from the WAL archive to the <filename>pg_xlog</> directory. Fetching
missing files from a WAL archive automatically is currently not supported.
Besides, <application>pg_rewind</> use cases are not limited by failover.
For instance, standby server could be promoted, run some writes and
then be returned back as stanby.
</para>
<para>