pg_upgrade; change major version comparisons to use <=, not <
This makes checking for older major versions more consistent. Backpatch-through: 9.5
This commit is contained in:
parent
d7e3aa470e
commit
1499477303
@ -243,7 +243,7 @@ check_cluster_versions(void)
|
|||||||
* upgrades
|
* upgrades
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
|
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
|
||||||
pg_fatal("This utility can only upgrade from PostgreSQL version 8.4 and later.\n");
|
pg_fatal("This utility can only upgrade from PostgreSQL version 8.4 and later.\n");
|
||||||
|
|
||||||
/* Only current PG version is supported as a target */
|
/* Only current PG version is supported as a target */
|
||||||
@ -280,7 +280,7 @@ check_cluster_compatibility(bool live_check)
|
|||||||
check_control_data(&old_cluster.controldata, &new_cluster.controldata);
|
check_control_data(&old_cluster.controldata, &new_cluster.controldata);
|
||||||
|
|
||||||
/* We read the real port number for PG >= 9.1 */
|
/* We read the real port number for PG >= 9.1 */
|
||||||
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
|
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
|
||||||
old_cluster.port == DEF_PGUPORT)
|
old_cluster.port == DEF_PGUPORT)
|
||||||
pg_fatal("When checking a pre-PG 9.1 live old server, "
|
pg_fatal("When checking a pre-PG 9.1 live old server, "
|
||||||
"you must specify the old server's port number.\n");
|
"you must specify the old server's port number.\n");
|
||||||
@ -486,7 +486,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
|
|||||||
fprintf(script, "\"%s/vacuumdb\" %s--all --analyze-in-stages\n",
|
fprintf(script, "\"%s/vacuumdb\" %s--all --analyze-in-stages\n",
|
||||||
new_cluster.bindir, user_specification.data);
|
new_cluster.bindir, user_specification.data);
|
||||||
/* Did we copy the free space files? */
|
/* Did we copy the free space files? */
|
||||||
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
|
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
|
||||||
fprintf(script, "\"%s/vacuumdb\" %s--all\n", new_cluster.bindir,
|
fprintf(script, "\"%s/vacuumdb\" %s--all\n", new_cluster.bindir,
|
||||||
user_specification.data);
|
user_specification.data);
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
|
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
|
||||||
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
|
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
|
||||||
resetwal_bin = "pg_resetxlog\" -n";
|
resetwal_bin = "pg_resetxlog\" -n";
|
||||||
else
|
else
|
||||||
resetwal_bin = "pg_resetwal\" -n";
|
resetwal_bin = "pg_resetwal\" -n";
|
||||||
|
@ -341,13 +341,13 @@ check_data_dir(ClusterInfo *cluster)
|
|||||||
check_single_dir(pg_data, "pg_twophase");
|
check_single_dir(pg_data, "pg_twophase");
|
||||||
|
|
||||||
/* pg_xlog has been renamed to pg_wal in v10 */
|
/* pg_xlog has been renamed to pg_wal in v10 */
|
||||||
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
|
if (GET_MAJOR_VERSION(cluster->major_version) <= 906)
|
||||||
check_single_dir(pg_data, "pg_xlog");
|
check_single_dir(pg_data, "pg_xlog");
|
||||||
else
|
else
|
||||||
check_single_dir(pg_data, "pg_wal");
|
check_single_dir(pg_data, "pg_wal");
|
||||||
|
|
||||||
/* pg_clog has been renamed to pg_xact in v10 */
|
/* pg_clog has been renamed to pg_xact in v10 */
|
||||||
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
|
if (GET_MAJOR_VERSION(cluster->major_version) <= 906)
|
||||||
check_single_dir(pg_data, "pg_clog");
|
check_single_dir(pg_data, "pg_clog");
|
||||||
else
|
else
|
||||||
check_single_dir(pg_data, "pg_xact");
|
check_single_dir(pg_data, "pg_xact");
|
||||||
@ -386,7 +386,7 @@ check_bin_dir(ClusterInfo *cluster)
|
|||||||
get_bin_version(cluster);
|
get_bin_version(cluster);
|
||||||
|
|
||||||
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
|
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
|
||||||
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
|
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
|
||||||
validate_exec(cluster->bindir, "pg_resetxlog");
|
validate_exec(cluster->bindir, "pg_resetxlog");
|
||||||
else
|
else
|
||||||
validate_exec(cluster->bindir, "pg_resetwal");
|
validate_exec(cluster->bindir, "pg_resetwal");
|
||||||
|
@ -86,7 +86,7 @@ get_loadable_libraries(void)
|
|||||||
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
|
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
|
||||||
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
|
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
|
||||||
*/
|
*/
|
||||||
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
|
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900)
|
||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ check_loadable_libraries(void)
|
|||||||
* for languages, and does not help with function shared objects, so
|
* for languages, and does not help with function shared objects, so
|
||||||
* we just do a general fix.
|
* we just do a general fix.
|
||||||
*/
|
*/
|
||||||
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
|
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
|
||||||
strcmp(lib, "$libdir/plpython") == 0)
|
strcmp(lib, "$libdir/plpython") == 0)
|
||||||
{
|
{
|
||||||
lib = "$libdir/plpython2";
|
lib = "$libdir/plpython2";
|
||||||
|
@ -403,7 +403,7 @@ create_new_objects(void)
|
|||||||
* We don't have minmxids for databases or relations in pre-9.3 clusters,
|
* We don't have minmxids for databases or relations in pre-9.3 clusters,
|
||||||
* so set those after we have restored the schema.
|
* so set those after we have restored the schema.
|
||||||
*/
|
*/
|
||||||
if (GET_MAJOR_VERSION(old_cluster.major_version) < 903)
|
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 902)
|
||||||
set_frozenxids(true);
|
set_frozenxids(true);
|
||||||
|
|
||||||
/* update new_cluster info now that we have objects in the databases */
|
/* update new_cluster info now that we have objects in the databases */
|
||||||
@ -462,9 +462,9 @@ copy_xact_xlog_xid(void)
|
|||||||
* Copy old commit logs to new data dir. pg_clog has been renamed to
|
* Copy old commit logs to new data dir. pg_clog has been renamed to
|
||||||
* pg_xact in post-10 clusters.
|
* pg_xact in post-10 clusters.
|
||||||
*/
|
*/
|
||||||
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
|
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) <= 906 ?
|
||||||
"pg_clog" : "pg_xact",
|
"pg_clog" : "pg_xact",
|
||||||
GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
|
GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ?
|
||||||
"pg_clog" : "pg_xact");
|
"pg_clog" : "pg_xact");
|
||||||
|
|
||||||
/* set the next transaction id and epoch of the new cluster */
|
/* set the next transaction id and epoch of the new cluster */
|
||||||
|
@ -221,7 +221,7 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
|
|||||||
snprintf(socket_string + strlen(socket_string),
|
snprintf(socket_string + strlen(socket_string),
|
||||||
sizeof(socket_string) - strlen(socket_string),
|
sizeof(socket_string) - strlen(socket_string),
|
||||||
" -c %s='%s'",
|
" -c %s='%s'",
|
||||||
(GET_MAJOR_VERSION(cluster->major_version) < 903) ?
|
(GET_MAJOR_VERSION(cluster->major_version) <= 902) ?
|
||||||
"unix_socket_directory" : "unix_socket_directories",
|
"unix_socket_directory" : "unix_socket_directories",
|
||||||
cluster->sockdir);
|
cluster->sockdir);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user