1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Add pg_rewind, for re-synchronizing a master server after failback.

Earlier versions of this tool were available (and still are) on github.

Thanks to Michael Paquier, Alvaro Herrera, Peter Eisentraut, Amit Kapila,
and Satoshi Nagayasu for review.
This commit is contained in:
Heikki Linnakangas
2015-03-23 19:47:52 +02:00
parent 87cec51d3a
commit 61081e75c6
29 changed files with 4141 additions and 2 deletions

View File

@ -0,0 +1,41 @@
use strict;
use warnings;
use TestLib;
use Test::More tests => 2;
use RewindTest;
my $testmode = shift;
RewindTest::init_rewind_test('databases', $testmode);
RewindTest::setup_cluster();
# Create a database in master.
master_psql('CREATE DATABASE inmaster');
RewindTest::create_standby();
# Create another database, the creation is replicated to the standby
master_psql('CREATE DATABASE beforepromotion');
RewindTest::promote_standby();
# Create databases in the old master and the new promoted standby.
master_psql('CREATE DATABASE master_afterpromotion');
standby_psql('CREATE DATABASE standby_afterpromotion');
# The clusters are now diverged.
RewindTest::run_pg_rewind();
# Check that the correct databases are present after pg_rewind.
check_query('SELECT datname FROM pg_database',
qq(template1
template0
postgres
inmaster
beforepromotion
standby_afterpromotion
),
'database names');
exit(0);