Commit 2209b392 authored by Bruce Momjian's avatar Bruce Momjian

pg_upgrade: remove support for 8.3 old clusters

This trims down the code, and is in preparation for hardening pg_upgrade
against auto-oid assignment.
parent b0488e5c
...@@ -6,7 +6,7 @@ PGAPPICON = win32 ...@@ -6,7 +6,7 @@ PGAPPICON = win32
PROGRAM = pg_upgrade PROGRAM = pg_upgrade
OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \ OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
option.o page.o parallel.o pg_upgrade.o relfilenode.o server.o \ option.o page.o parallel.o pg_upgrade.o relfilenode.o server.o \
tablespace.o util.o version.o version_old_8_3.o $(WIN32RES) tablespace.o util.o version.o $(WIN32RES)
PG_CPPFLAGS = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) PG_CPPFLAGS = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)
PG_LIBS = $(libpq_pgport) PG_LIBS = $(libpq_pgport)
......
...@@ -73,7 +73,7 @@ output_check_banner(bool live_check) ...@@ -73,7 +73,7 @@ output_check_banner(bool live_check)
void void
check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name) check_and_dump_old_cluster(bool live_check)
{ {
/* -- OLD -- */ /* -- OLD -- */
...@@ -100,29 +100,6 @@ check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name) ...@@ -100,29 +100,6 @@ check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name)
check_for_reg_data_type_usage(&old_cluster); check_for_reg_data_type_usage(&old_cluster);
check_for_isn_and_int8_passing_mismatch(&old_cluster); check_for_isn_and_int8_passing_mismatch(&old_cluster);
/* old = PG 8.3 checks? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
{
old_8_3_check_for_name_data_type_usage(&old_cluster);
old_8_3_check_for_tsquery_usage(&old_cluster);
old_8_3_check_ltree_usage(&old_cluster);
if (user_opts.check)
{
old_8_3_rebuild_tsvector_tables(&old_cluster, true);
old_8_3_invalidate_hash_gin_indexes(&old_cluster, true);
old_8_3_invalidate_bpchar_pattern_ops_indexes(&old_cluster, true);
}
else
/*
* While we have the old server running, create the script to
* properly restore its sequence values but we report this at the
* end.
*/
*sequence_script_file_name =
old_8_3_create_sequence_script(&old_cluster);
}
/* Pre-PG 9.4 had a different 'line' data type internal format */ /* Pre-PG 9.4 had a different 'line' data type internal format */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 903) if (GET_MAJOR_VERSION(old_cluster.major_version) <= 903)
old_9_3_check_for_line_data_type_usage(&old_cluster); old_9_3_check_for_line_data_type_usage(&old_cluster);
...@@ -183,31 +160,8 @@ report_clusters_compatible(void) ...@@ -183,31 +160,8 @@ report_clusters_compatible(void)
void void
issue_warnings(char *sequence_script_file_name) issue_warnings(void)
{ {
/* old = PG 8.3 warnings? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
{
start_postmaster(&new_cluster, true);
/* restore proper sequence values using file created from old server */
if (sequence_script_file_name)
{
prep_status("Adjusting sequences");
exec_prog(UTILITY_LOG_FILE, NULL, true,
"\"%s/psql\" " EXEC_PSQL_ARGS " %s -f \"%s\"",
new_cluster.bindir, cluster_conn_opts(&new_cluster),
sequence_script_file_name);
unlink(sequence_script_file_name);
check_ok();
}
old_8_3_rebuild_tsvector_tables(&new_cluster, false);
old_8_3_invalidate_hash_gin_indexes(&new_cluster, false);
old_8_3_invalidate_bpchar_pattern_ops_indexes(&new_cluster, false);
stop_postmaster(false);
}
/* Create dummy large object permissions for old < PG 9.0? */ /* Create dummy large object permissions for old < PG 9.0? */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
{ {
...@@ -262,8 +216,8 @@ check_cluster_versions(void) ...@@ -262,8 +216,8 @@ check_cluster_versions(void)
* upgrades * upgrades
*/ */
if (GET_MAJOR_VERSION(old_cluster.major_version) < 803) if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
pg_fatal("This utility can only upgrade from PostgreSQL version 8.3 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 */
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM)) if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
......
...@@ -125,13 +125,6 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -125,13 +125,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
cluster->controldata.lc_collate = NULL; cluster->controldata.lc_collate = NULL;
cluster->controldata.lc_ctype = NULL; cluster->controldata.lc_ctype = NULL;
/* Only in <= 8.3 */
if (GET_MAJOR_VERSION(cluster->major_version) <= 803)
{
cluster->controldata.float8_pass_by_value = false;
got_float8_pass_by_value = true;
}
/* Only in <= 9.2 */ /* Only in <= 9.2 */
if (GET_MAJOR_VERSION(cluster->major_version) <= 902) if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
{ {
...@@ -144,23 +137,6 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -144,23 +137,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
{ {
pg_log(PG_VERBOSE, "%s", bufin); pg_log(PG_VERBOSE, "%s", bufin);
#ifdef WIN32
/*
* Due to an installer bug, LANG=C doesn't work for PG 8.3.3, but does
* work 8.2.6 and 8.3.7, so check for non-ASCII output and suggest a
* minor upgrade.
*/
if (GET_MAJOR_VERSION(cluster->major_version) <= 803)
{
for (p = bufin; *p; p++)
if (!isascii((unsigned char) *p))
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
}
#endif
if ((p = strstr(bufin, "pg_control version number:")) != NULL) if ((p = strstr(bufin, "pg_control version number:")) != NULL)
{ {
p = strchr(p, ':'); p = strchr(p, ':');
...@@ -550,7 +526,6 @@ get_control_data(ClusterInfo *cluster, bool live_check) ...@@ -550,7 +526,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
if (!got_date_is_int) if (!got_date_is_int)
pg_log(PG_REPORT, " dates/times are integers?\n"); pg_log(PG_REPORT, " dates/times are integers?\n");
/* value added in Postgres 8.4 */
if (!got_float8_pass_by_value) if (!got_float8_pass_by_value)
pg_log(PG_REPORT, " float8 argument passing method\n"); pg_log(PG_REPORT, " float8 argument passing method\n");
...@@ -598,17 +573,7 @@ check_control_data(ControlData *oldctrl, ...@@ -598,17 +573,7 @@ check_control_data(ControlData *oldctrl,
pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match\n"); pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match\n");
if (oldctrl->date_is_int != newctrl->date_is_int) if (oldctrl->date_is_int != newctrl->date_is_int)
{ pg_fatal("old and new pg_controldata date/time storage types do not match\n");
pg_log(PG_WARNING,
"\nOld and new pg_controldata date/time storage types do not match.\n");
/*
* This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose
*/
pg_fatal("You will need to rebuild the new server with configure option\n"
"--disable-integer-datetimes or get server binaries built with those\n"
"options.\n");
}
/* /*
* We might eventually allow upgrades from checksum to no-checksum * We might eventually allow upgrades from checksum to no-checksum
......
...@@ -325,7 +325,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo) ...@@ -325,7 +325,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
" ON c.relnamespace = n.oid " " ON c.relnamespace = n.oid "
"LEFT OUTER JOIN pg_catalog.pg_index i " "LEFT OUTER JOIN pg_catalog.pg_index i "
" ON c.oid = i.indexrelid " " ON c.oid = i.indexrelid "
"WHERE relkind IN ('r', 'm', 'i'%s) AND " "WHERE relkind IN ('r', 'm', 'i', 'S') AND "
/* /*
* pg_dump only dumps valid indexes; testing indisready is necessary in * pg_dump only dumps valid indexes; testing indisready is necessary in
...@@ -342,9 +342,6 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo) ...@@ -342,9 +342,6 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
" c.oid >= %u) " " c.oid >= %u) "
" OR (n.nspname = 'pg_catalog' AND " " OR (n.nspname = 'pg_catalog' AND "
" relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) ));", " relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) ));",
/* see the comment at the top of old_8_3_create_sequence_script() */
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
"" : ", 'S'",
FirstNormalObjectId, FirstNormalObjectId,
/* does pg_largeobject_metadata need to be migrated? */ /* does pg_largeobject_metadata need to be migrated? */
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ? (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?
......
...@@ -69,7 +69,6 @@ char *output_files[] = { ...@@ -69,7 +69,6 @@ char *output_files[] = {
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
char *sequence_script_file_name = NULL;
char *analyze_script_file_name = NULL; char *analyze_script_file_name = NULL;
char *deletion_script_file_name = NULL; char *deletion_script_file_name = NULL;
bool live_check = false; bool live_check = false;
...@@ -90,7 +89,7 @@ main(int argc, char **argv) ...@@ -90,7 +89,7 @@ main(int argc, char **argv)
check_cluster_compatibility(live_check); check_cluster_compatibility(live_check);
check_and_dump_old_cluster(live_check, &sequence_script_file_name); check_and_dump_old_cluster(live_check);
/* -- NEW -- */ /* -- NEW -- */
...@@ -157,7 +156,7 @@ main(int argc, char **argv) ...@@ -157,7 +156,7 @@ main(int argc, char **argv)
create_script_for_cluster_analyze(&analyze_script_file_name); create_script_for_cluster_analyze(&analyze_script_file_name);
create_script_for_old_cluster_deletion(&deletion_script_file_name); create_script_for_old_cluster_deletion(&deletion_script_file_name);
issue_warnings(sequence_script_file_name); issue_warnings();
pg_log(PG_REPORT, "\nUpgrade Complete\n"); pg_log(PG_REPORT, "\nUpgrade Complete\n");
pg_log(PG_REPORT, "----------------\n"); pg_log(PG_REPORT, "----------------\n");
...@@ -167,7 +166,6 @@ main(int argc, char **argv) ...@@ -167,7 +166,6 @@ main(int argc, char **argv)
pg_free(analyze_script_file_name); pg_free(analyze_script_file_name);
pg_free(deletion_script_file_name); pg_free(deletion_script_file_name);
pg_free(sequence_script_file_name);
cleanup(); cleanup();
......
...@@ -313,11 +313,10 @@ extern OSInfo os_info; ...@@ -313,11 +313,10 @@ extern OSInfo os_info;
/* check.c */ /* check.c */
void output_check_banner(bool live_check); void output_check_banner(bool live_check);
void check_and_dump_old_cluster(bool live_check, void check_and_dump_old_cluster(bool live_check);
char **sequence_script_file_name);
void check_new_cluster(void); void check_new_cluster(void);
void report_clusters_compatible(void); void report_clusters_compatible(void);
void issue_warnings(char *sequence_script_file_name); void issue_warnings(void);
void output_completion_banner(char *analyze_script_file_name, void output_completion_banner(char *analyze_script_file_name,
char *deletion_script_file_name); char *deletion_script_file_name);
void check_cluster_versions(void); void check_cluster_versions(void);
...@@ -471,17 +470,6 @@ void new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster, ...@@ -471,17 +470,6 @@ void new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster,
bool check_mode); bool check_mode);
void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster); void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster);
/* version_old_8_3.c */
void old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster);
void old_8_3_check_for_tsquery_usage(ClusterInfo *cluster);
void old_8_3_check_ltree_usage(ClusterInfo *cluster);
void old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode);
void old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode);
void old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
bool check_mode);
char *old_8_3_create_sequence_script(ClusterInfo *cluster);
/* parallel.c */ /* parallel.c */
void void
parallel_exec_prog(const char *log_file, const char *opt_log_file, parallel_exec_prog(const char *log_file, const char *opt_log_file,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment