Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2209b39

Browse files
committed
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.
1 parent b0488e5 commit 2209b39

File tree

7 files changed

+11
-878
lines changed

7 files changed

+11
-878
lines changed

contrib/pg_upgrade/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PGAPPICON = win32
66
PROGRAM = pg_upgrade
77
OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
88
option.o page.o parallel.o pg_upgrade.o relfilenode.o server.o \
9-
tablespace.o util.o version.o version_old_8_3.o $(WIN32RES)
9+
tablespace.o util.o version.o $(WIN32RES)
1010

1111
PG_CPPFLAGS = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)
1212
PG_LIBS = $(libpq_pgport)

contrib/pg_upgrade/check.c

+4-50
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ output_check_banner(bool live_check)
7373

7474

7575
void
76-
check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name)
76+
check_and_dump_old_cluster(bool live_check)
7777
{
7878
/* -- OLD -- */
7979

@@ -100,29 +100,6 @@ check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name)
100100
check_for_reg_data_type_usage(&old_cluster);
101101
check_for_isn_and_int8_passing_mismatch(&old_cluster);
102102

103-
/* old = PG 8.3 checks? */
104-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
105-
{
106-
old_8_3_check_for_name_data_type_usage(&old_cluster);
107-
old_8_3_check_for_tsquery_usage(&old_cluster);
108-
old_8_3_check_ltree_usage(&old_cluster);
109-
if (user_opts.check)
110-
{
111-
old_8_3_rebuild_tsvector_tables(&old_cluster, true);
112-
old_8_3_invalidate_hash_gin_indexes(&old_cluster, true);
113-
old_8_3_invalidate_bpchar_pattern_ops_indexes(&old_cluster, true);
114-
}
115-
else
116-
117-
/*
118-
* While we have the old server running, create the script to
119-
* properly restore its sequence values but we report this at the
120-
* end.
121-
*/
122-
*sequence_script_file_name =
123-
old_8_3_create_sequence_script(&old_cluster);
124-
}
125-
126103
/* Pre-PG 9.4 had a different 'line' data type internal format */
127104
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 903)
128105
old_9_3_check_for_line_data_type_usage(&old_cluster);
@@ -183,31 +160,8 @@ report_clusters_compatible(void)
183160

184161

185162
void
186-
issue_warnings(char *sequence_script_file_name)
163+
issue_warnings(void)
187164
{
188-
/* old = PG 8.3 warnings? */
189-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
190-
{
191-
start_postmaster(&new_cluster, true);
192-
193-
/* restore proper sequence values using file created from old server */
194-
if (sequence_script_file_name)
195-
{
196-
prep_status("Adjusting sequences");
197-
exec_prog(UTILITY_LOG_FILE, NULL, true,
198-
"\"%s/psql\" " EXEC_PSQL_ARGS " %s -f \"%s\"",
199-
new_cluster.bindir, cluster_conn_opts(&new_cluster),
200-
sequence_script_file_name);
201-
unlink(sequence_script_file_name);
202-
check_ok();
203-
}
204-
205-
old_8_3_rebuild_tsvector_tables(&new_cluster, false);
206-
old_8_3_invalidate_hash_gin_indexes(&new_cluster, false);
207-
old_8_3_invalidate_bpchar_pattern_ops_indexes(&new_cluster, false);
208-
stop_postmaster(false);
209-
}
210-
211165
/* Create dummy large object permissions for old < PG 9.0? */
212166
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
213167
{
@@ -262,8 +216,8 @@ check_cluster_versions(void)
262216
* upgrades
263217
*/
264218

265-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 803)
266-
pg_fatal("This utility can only upgrade from PostgreSQL version 8.3 and later.\n");
219+
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
220+
pg_fatal("This utility can only upgrade from PostgreSQL version 8.4 and later.\n");
267221

268222
/* Only current PG version is supported as a target */
269223
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))

contrib/pg_upgrade/controldata.c

+1-36
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
125125
cluster->controldata.lc_collate = NULL;
126126
cluster->controldata.lc_ctype = NULL;
127127

128-
/* Only in <= 8.3 */
129-
if (GET_MAJOR_VERSION(cluster->major_version) <= 803)
130-
{
131-
cluster->controldata.float8_pass_by_value = false;
132-
got_float8_pass_by_value = true;
133-
}
134-
135128
/* Only in <= 9.2 */
136129
if (GET_MAJOR_VERSION(cluster->major_version) <= 902)
137130
{
@@ -144,23 +137,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
144137
{
145138
pg_log(PG_VERBOSE, "%s", bufin);
146139

147-
#ifdef WIN32
148-
149-
/*
150-
* Due to an installer bug, LANG=C doesn't work for PG 8.3.3, but does
151-
* work 8.2.6 and 8.3.7, so check for non-ASCII output and suggest a
152-
* minor upgrade.
153-
*/
154-
if (GET_MAJOR_VERSION(cluster->major_version) <= 803)
155-
{
156-
for (p = bufin; *p; p++)
157-
if (!isascii((unsigned char) *p))
158-
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
159-
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
160-
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
161-
}
162-
#endif
163-
164140
if ((p = strstr(bufin, "pg_control version number:")) != NULL)
165141
{
166142
p = strchr(p, ':');
@@ -550,7 +526,6 @@ get_control_data(ClusterInfo *cluster, bool live_check)
550526
if (!got_date_is_int)
551527
pg_log(PG_REPORT, " dates/times are integers?\n");
552528

553-
/* value added in Postgres 8.4 */
554529
if (!got_float8_pass_by_value)
555530
pg_log(PG_REPORT, " float8 argument passing method\n");
556531

@@ -598,17 +573,7 @@ check_control_data(ControlData *oldctrl,
598573
pg_fatal("old and new pg_controldata maximum TOAST chunk sizes are invalid or do not match\n");
599574

600575
if (oldctrl->date_is_int != newctrl->date_is_int)
601-
{
602-
pg_log(PG_WARNING,
603-
"\nOld and new pg_controldata date/time storage types do not match.\n");
604-
605-
/*
606-
* This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose
607-
*/
608-
pg_fatal("You will need to rebuild the new server with configure option\n"
609-
"--disable-integer-datetimes or get server binaries built with those\n"
610-
"options.\n");
611-
}
576+
pg_fatal("old and new pg_controldata date/time storage types do not match\n");
612577

613578
/*
614579
* We might eventually allow upgrades from checksum to no-checksum

contrib/pg_upgrade/info.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
325325
" ON c.relnamespace = n.oid "
326326
"LEFT OUTER JOIN pg_catalog.pg_index i "
327327
" ON c.oid = i.indexrelid "
328-
"WHERE relkind IN ('r', 'm', 'i'%s) AND "
328+
"WHERE relkind IN ('r', 'm', 'i', 'S') AND "
329329

330330
/*
331331
* pg_dump only dumps valid indexes; testing indisready is necessary in
@@ -342,9 +342,6 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
342342
" c.oid >= %u) "
343343
" OR (n.nspname = 'pg_catalog' AND "
344344
" relname IN ('pg_largeobject', 'pg_largeobject_loid_pn_index'%s) ));",
345-
/* see the comment at the top of old_8_3_create_sequence_script() */
346-
(GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
347-
"" : ", 'S'",
348345
FirstNormalObjectId,
349346
/* does pg_largeobject_metadata need to be migrated? */
350347
(GET_MAJOR_VERSION(old_cluster.major_version) <= 804) ?

contrib/pg_upgrade/pg_upgrade.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ char *output_files[] = {
6969
int
7070
main(int argc, char **argv)
7171
{
72-
char *sequence_script_file_name = NULL;
7372
char *analyze_script_file_name = NULL;
7473
char *deletion_script_file_name = NULL;
7574
bool live_check = false;
@@ -90,7 +89,7 @@ main(int argc, char **argv)
9089

9190
check_cluster_compatibility(live_check);
9291

93-
check_and_dump_old_cluster(live_check, &sequence_script_file_name);
92+
check_and_dump_old_cluster(live_check);
9493

9594

9695
/* -- NEW -- */
@@ -157,7 +156,7 @@ main(int argc, char **argv)
157156
create_script_for_cluster_analyze(&analyze_script_file_name);
158157
create_script_for_old_cluster_deletion(&deletion_script_file_name);
159158

160-
issue_warnings(sequence_script_file_name);
159+
issue_warnings();
161160

162161
pg_log(PG_REPORT, "\nUpgrade Complete\n");
163162
pg_log(PG_REPORT, "----------------\n");
@@ -167,7 +166,6 @@ main(int argc, char **argv)
167166

168167
pg_free(analyze_script_file_name);
169168
pg_free(deletion_script_file_name);
170-
pg_free(sequence_script_file_name);
171169

172170
cleanup();
173171

contrib/pg_upgrade/pg_upgrade.h

+2-14
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,10 @@ extern OSInfo os_info;
313313
/* check.c */
314314

315315
void output_check_banner(bool live_check);
316-
void check_and_dump_old_cluster(bool live_check,
317-
char **sequence_script_file_name);
316+
void check_and_dump_old_cluster(bool live_check);
318317
void check_new_cluster(void);
319318
void report_clusters_compatible(void);
320-
void issue_warnings(char *sequence_script_file_name);
319+
void issue_warnings(void);
321320
void output_completion_banner(char *analyze_script_file_name,
322321
char *deletion_script_file_name);
323322
void check_cluster_versions(void);
@@ -471,17 +470,6 @@ void new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster,
471470
bool check_mode);
472471
void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster);
473472

474-
/* version_old_8_3.c */
475-
476-
void old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster);
477-
void old_8_3_check_for_tsquery_usage(ClusterInfo *cluster);
478-
void old_8_3_check_ltree_usage(ClusterInfo *cluster);
479-
void old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode);
480-
void old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode);
481-
void old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
482-
bool check_mode);
483-
char *old_8_3_create_sequence_script(ClusterInfo *cluster);
484-
485473
/* parallel.c */
486474
void
487475
parallel_exec_prog(const char *log_file, const char *opt_log_file,

0 commit comments

Comments
 (0)