Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa5d7d5

Browse files
committed
Add a server version check to pg_basebackup and pg_receivexlog.
These programs don't work against 9.0 or earlier servers, so check that whenthe connection is made. That's better than a cryptic error message you gotbefore.Also, these programs won't work with a 9.3 server, because the WAL streamingprotocol was changed in a non-backwards-compatible way. As a general rule,we don't make any guarantee that an old client will work with a new server,so check that. However, allow a 9.1 client to connect to a 9.2 server, toavoid breaking environments that currently work; a 9.1 client happens towork with a 9.2 server, even though we didn't make any great effort toensure that.This patch is for the 9.1 and 9.2 branches, I'll commit a similar patch tomaster later. Although this isn't a critical bug fix, it seems safe enoughto back-patch. The error message you got when connecting to a 9.3develserver without this patch was cryptic enough to warrant backpatching.
1 parentf1bd8a8 commitaa5d7d5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,12 +816,33 @@ BaseBackup(void)
816816
inti;
817817
charxlogstart[64];
818818
charxlogend[64];
819+
intminServerMajor,
820+
maxServerMajor;
821+
intserverMajor;
819822

820823
/*
821824
* Connect in replication mode to the server
822825
*/
823826
conn=GetConnection();
824827

828+
/*
829+
* Check server version. BASE_BACKUP command was introduced in 9.1, so
830+
* we can't work with servers older than 9.1. We don't officially support
831+
* servers newer than the client, but the 9.1 version happens to work with
832+
* a 9.2 server. This version check was added to 9.1 branch in a minor
833+
* release, so allow connecting to a 9.2 server, to avoid breaking
834+
* environments that worked before this version check was added.
835+
*/
836+
minServerMajor=901;
837+
maxServerMajor=902;
838+
serverMajor=PQserverVersion(conn) /100;
839+
if (serverMajor<minServerMajor||serverMajor>maxServerMajor)
840+
{
841+
fprintf(stderr,_("%s: unsupported server version %s\n"),
842+
progname,PQparameterStatus(conn,"server_version"));
843+
disconnect_and_exit(1);
844+
}
845+
825846
/*
826847
* Start the actual backup
827848
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp