postgresql/src
Fujii Masao 3f145f6be3 Support clean switchover.
In replication, when we shutdown the master, walsender tries to send
all the outstanding WAL records to the standby, and then to exit. This
basically means that all the WAL records are fully synced between
two servers after the clean shutdown of the master. So, after
promoting the standby to new master, we can restart the stopped
master as new standby without the need for a fresh backup from
new master.

But there was one problem so far: though walsender tries to send all
the outstanding WAL records, it doesn't wait for them to be replicated
to the standby. Then, before receiving all the WAL records,
walreceiver can detect the closure of connection and exit. We cannot
guarantee that there is no missing WAL in the standby after clean
shutdown of the master. In this case, backup from new master is
required when restarting the stopped master as new standby.

This patch fixes this problem. It just changes walsender so that it
waits for all the outstanding WAL records to be replicated to the
standby before closing the replication connection.

Per discussion, this is a fix that needs to get backpatched rather than
new feature. So, back-patch to 9.1 where enough infrastructure for
this exists.

Patch by me, reviewed by Andres Freund.
2013-06-26 02:20:11 +09:00
..
backend Support clean switchover. 2013-06-26 02:20:11 +09:00
bin Fix pg_restore -l with the directory archive to display the correct format name. 2013-06-16 05:15:44 +09:00
include Ensure no xid gaps during Hot Standby startup 2013-06-23 14:50:17 +01:00
interfaces Stamp 9.1.9. 2013-04-01 14:23:05 -04:00
makefiles Make pgxs build executables with the right suffix. 2013-01-19 14:54:29 -05:00
pl Add semicolons to eval'd strings to hide a minor Perl behavioral change. 2013-06-03 14:19:36 -04:00
port Stamp 9.1.9. 2013-04-01 14:23:05 -04:00
template Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
test Remove unnecessary restrictions about RowExprs in transformAExprIn(). 2013-06-09 18:39:34 -04:00
timezone Update time zone data files to tzdata release 2013b. 2013-03-28 15:25:58 -04:00
tools Properly zero-pad the day-of-year part of the win32 build number 2013-01-31 15:08:05 +01:00
tutorial Modernize string literal syntax in tutorial example. 2013-01-19 17:21:08 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Add mode where contrib installcheck runs each module in a separately named database. 2012-12-11 11:51:51 -05:00
Makefile.shlib Use single quotes in preference to double quotes for protecting pathnames. 2011-06-15 21:45:50 -04:00
nls-global.mk Fix makefile logic to not break the build when xgettext is missing 2010-10-14 23:16:46 +03:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00