Commit 6b34e556 authored by Peter Eisentraut's avatar Peter Eisentraut

pg_rewind: Don't error if the two clusters are already on the same timeline

This previously resulted in an error and a nonzero exit status, but
after discussion this should rather be a noop with a zero exit status.
parent 8c161553
...@@ -216,8 +216,12 @@ main(int argc, char **argv) ...@@ -216,8 +216,12 @@ main(int argc, char **argv)
* do. * do.
*/ */
if (ControlFile_target.checkPointCopy.ThisTimeLineID == ControlFile_source.checkPointCopy.ThisTimeLineID) if (ControlFile_target.checkPointCopy.ThisTimeLineID == ControlFile_source.checkPointCopy.ThisTimeLineID)
pg_fatal("source and target cluster are on the same timeline\n"); {
printf(_("source and target cluster are on the same timeline\n"));
rewind_needed = false;
}
else
{
findCommonAncestorTimeline(&divergerec, &lastcommontliIndex); findCommonAncestorTimeline(&divergerec, &lastcommontliIndex);
printf(_("servers diverged at WAL position %X/%X on timeline %u\n"), printf(_("servers diverged at WAL position %X/%X on timeline %u\n"),
(uint32) (divergerec >> 32), (uint32) divergerec, (uint32) (divergerec >> 32), (uint32) divergerec,
...@@ -252,6 +256,7 @@ main(int argc, char **argv) ...@@ -252,6 +256,7 @@ main(int argc, char **argv)
else else
rewind_needed = true; rewind_needed = true;
} }
}
if (!rewind_needed) if (!rewind_needed)
{ {
......
use strict;
use warnings;
use TestLib;
use Test::More tests => 1;
use RewindTest;
# Test that running pg_rewind if the two clusters are on the same
# timeline runs successfully.
RewindTest::setup_cluster();
RewindTest::start_master();
RewindTest::create_standby();
RewindTest::run_pg_rewind('local');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment