From d298b50a3b469c088bb40a4d36d38111b4cd574d Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 22 Mar 2013 13:02:59 +0200 Subject: Make pg_basebackup work with pre-9.3 servers, and add server version check. A new 'starttli' field was added to the response of BASE_BACKUP command. Make pg_basebackup tolerate the case that it's missing, so that it still works with older servers. Add an explicit check for the server version, so that you get a nicer error message if you try to use it with a pre-9.1 server. The streaming protocol message format changed in 9.3, so -X stream still won't work with pre-9.3 servers. I added a version check to ReceiveXLogStream() earlier, but write that slightly differently, so that in 9.4, it will still work with a 9.3 server. (In 9.4, the error message needs to be adjusted to "9.3 or above", though). Also, if the version check fails, don't retry. --- src/bin/pg_basebackup/pg_receivexlog.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/bin/pg_basebackup/pg_receivexlog.c') diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index e68f8ea7079..e4da799d1fd 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -229,6 +229,16 @@ StreamLog(void) /* Error message already written in GetConnection() */ return; + if (!CheckServerVersionForStreaming(conn)) + { + /* + * Error message already written in CheckServerVersionForStreaming(). + * There's no hope of recovering from a version mismatch, so don't + * retry. + */ + disconnect_and_exit(1); + } + /* * Run IDENTIFY_SYSTEM so we can get the timeline and current xlog * position. -- cgit v1.2.3