mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-12-02 09:53:24 +02:00
Fix check_server_version() for Pg10+
This commit is contained in:
parent
492c691d07
commit
8787a061e6
29
src/backup.c
29
src/backup.c
@ -877,30 +877,33 @@ do_backup(time_t start_time)
|
||||
static void
|
||||
check_server_version(void)
|
||||
{
|
||||
|
||||
/* confirm server version */
|
||||
server_version = PQserverVersion(backup_conn);
|
||||
|
||||
if (server_version == 0)
|
||||
elog(ERROR, "Unknown server version %d", server_version);
|
||||
|
||||
if (server_version < 100000)
|
||||
sprintf(server_version_str, "%d.%d",
|
||||
server_version / 10000,
|
||||
(server_version / 100) % 100);
|
||||
else
|
||||
sprintf(server_version_str, "%d",
|
||||
server_version / 10000);
|
||||
|
||||
if (server_version < 90500)
|
||||
elog(ERROR,
|
||||
"server version is %d.%d.%d, must be %s or higher",
|
||||
server_version / 10000,
|
||||
(server_version / 100) % 100,
|
||||
server_version % 100, "9.5");
|
||||
"server version is %s, must be %s or higher",
|
||||
server_version_str, "9.5");
|
||||
|
||||
if (from_replica && server_version < 90600)
|
||||
elog(ERROR,
|
||||
"server version is %d.%d.%d, must be %s or higher for backup from replica",
|
||||
server_version / 10000,
|
||||
(server_version / 100) % 100,
|
||||
server_version % 100, "9.6");
|
||||
"server version is %s, must be %s or higher for backup from replica",
|
||||
server_version_str, "9.6");
|
||||
|
||||
/* Do exclusive backup only for PostgreSQL 9.5 */
|
||||
exclusive_backup = server_version < 90600 ||
|
||||
current.backup_mode == BACKUP_MODE_DIFF_PTRACK;
|
||||
|
||||
/* Save server_version to use it in future */
|
||||
sprintf(server_version_str, "%d.%d", server_version / 10000, (server_version / 100) % 100);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2752,4 +2755,4 @@ pg_ptrack_get_block(backup_files_args *arguments,
|
||||
pfree(params[3]);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user