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

Commit e469f0a

Browse files
committed
Remove pg_upgrade support for upgrading from pre-9.2 servers.
Per discussion, we'll limit support for old servers to those branches that can still be built easily on modern platforms, which as of now is 9.2 and up. Discussion: https://postgr.es/m/2923349.1634942313@sss.pgh.pa.us
1 parent 30e7c17 commit e469f0a

File tree

9 files changed

+43
-227
lines changed

9 files changed

+43
-227
lines changed

doc/src/sgml/ref/pgupgrade.sgml

+1-16
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ PostgreSQL documentation
6868
</para>
6969

7070
<para>
71-
pg_upgrade supports upgrades from 8.4.X and later to the current
71+
pg_upgrade supports upgrades from 9.2.X and later to the current
7272
major release of <productname>PostgreSQL</productname>, including snapshot and beta releases.
7373
</para>
7474
</refsect1>
@@ -800,21 +800,6 @@ psql --username=postgres --file=script.sql postgres
800800
(<type>regclass</type>, <type>regrole</type>, and <type>regtype</type> can be upgraded.)
801801
</para>
802802

803-
<para>
804-
If you are upgrading a pre-<productname>PostgreSQL</productname> 9.2 cluster
805-
that uses a configuration-file-only directory, you must pass the
806-
real data directory location to <application>pg_upgrade</application>, and
807-
pass the configuration directory location to the server, e.g.,
808-
<literal>-d /real-data-directory -o '-D /configuration-directory'</literal>.
809-
</para>
810-
811-
<para>
812-
If using a pre-9.1 old server that is using a non-default Unix-domain
813-
socket directory or a default that differs from the default of the
814-
new cluster, set <envar>PGHOST</envar> to point to the old server's socket
815-
location. (This is not relevant on Windows.)
816-
</para>
817-
818803
<para>
819804
If you want to use link mode and you do not want your old cluster
820805
to be modified when the new cluster is started, consider using the clone mode.

src/bin/pg_upgrade/check.c

+2-26
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ check_and_dump_old_cluster(bool live_check)
159159
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 903)
160160
old_9_3_check_for_line_data_type_usage(&old_cluster);
161161

162-
/* Pre-PG 9.0 had no large object permissions */
163-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
164-
new_9_0_populate_pg_largeobject_metadata(&old_cluster, true);
165-
166162
/*
167163
* While not a check option, we do this now because this is the only time
168164
* the old server is running.
@@ -233,10 +229,6 @@ issue_warnings_and_set_wal_level(void)
233229
*/
234230
start_postmaster(&new_cluster, true);
235231

236-
/* Create dummy large object permissions for old < PG 9.0? */
237-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
238-
new_9_0_populate_pg_largeobject_metadata(&new_cluster, false);
239-
240232
/* Reindex hash indexes for old < 10.0 */
241233
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 906)
242234
old_9_6_invalidate_hash_indexes(&new_cluster, false);
@@ -295,8 +287,8 @@ check_cluster_versions(void)
295287
* upgrades
296288
*/
297289

298-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
299-
pg_fatal("This utility can only upgrade from PostgreSQL version 8.4 and later.\n");
290+
if (GET_MAJOR_VERSION(old_cluster.major_version) < 902)
291+
pg_fatal("This utility can only upgrade from PostgreSQL version 9.2 and later.\n");
300292

301293
/* Only current PG version is supported as a target */
302294
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
@@ -331,12 +323,6 @@ check_cluster_compatibility(bool live_check)
331323
get_control_data(&new_cluster, false);
332324
check_control_data(&old_cluster.controldata, &new_cluster.controldata);
333325

334-
/* We read the real port number for PG >= 9.1 */
335-
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
336-
old_cluster.port == DEF_PGUPORT)
337-
pg_fatal("When checking a pre-PG 9.1 live old server, "
338-
"you must specify the old server's port number.\n");
339-
340326
if (live_check && old_cluster.port == new_cluster.port)
341327
pg_fatal("When checking a live server, "
342328
"the old and new port numbers must be different.\n");
@@ -479,11 +465,6 @@ check_databases_are_compatible(void)
479465
* they do, it would cause an error while restoring global objects.
480466
* This allows the failure to be detected at check time, rather than
481467
* during schema restore.
482-
*
483-
* Note, v8.4 has no tablespace_suffix, which is fine so long as the
484-
* version being upgraded *to* has a suffix, since it's not allowed
485-
* to pg_upgrade from a version to the same version if tablespaces are
486-
* in use.
487468
*/
488469
static void
489470
check_for_new_tablespace_dir(ClusterInfo *new_cluster)
@@ -597,11 +578,6 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
597578
int dbnum;
598579

599580
fprintf(script, "\n");
600-
/* remove PG_VERSION? */
601-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
602-
fprintf(script, RM_CMD " %s%cPG_VERSION\n",
603-
fix_path_separator(os_info.old_tablespaces[tblnum]),
604-
PATH_SEPARATOR);
605581

606582
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
607583
fprintf(script, RMDIR_CMD " %c%s%c%u%c\n", PATH_QUOTE,

src/bin/pg_upgrade/info.c

+6-18
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,9 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
118118
* Verify that rels of same OID have same name. The namespace name
119119
* should always match, but the relname might not match for TOAST
120120
* tables (and, therefore, their indexes).
121-
*
122-
* TOAST table names initially match the heap pg_class oid, but
123-
* pre-9.0 they can change during certain commands such as CLUSTER, so
124-
* don't insist on a match if old cluster is < 9.0.
125121
*/
126122
if (strcmp(old_rel->nspname, new_rel->nspname) != 0 ||
127-
(strcmp(old_rel->relname, new_rel->relname) != 0 &&
128-
(GET_MAJOR_VERSION(old_cluster.major_version) >= 900 ||
129-
strcmp(old_rel->nspname, "pg_toast") != 0)))
123+
strcmp(old_rel->relname, new_rel->relname) != 0)
130124
{
131125
pg_log(PG_WARNING, "Relation names for OID %u in database \"%s\" do not match: "
132126
"old name \"%s.%s\", new name \"%s.%s\"\n",
@@ -352,16 +346,13 @@ get_db_infos(ClusterInfo *cluster)
352346

353347
snprintf(query, sizeof(query),
354348
"SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, "
355-
"%s AS spclocation "
349+
"pg_catalog.pg_tablespace_location(t.oid) AS spclocation "
356350
"FROM pg_catalog.pg_database d "
357351
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
358352
" ON d.dattablespace = t.oid "
359353
"WHERE d.datallowconn = true "
360354
/* we don't preserve pg_database.oid so we sort by name */
361-
"ORDER BY 2",
362-
/* 9.2 removed the spclocation column */
363-
(GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
364-
"t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid)");
355+
"ORDER BY 2");
365356

366357
res = executeQueryOrDie(conn, "%s", query);
367358

@@ -492,7 +483,8 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
492483
*/
493484
snprintf(query + strlen(query), sizeof(query) - strlen(query),
494485
"SELECT all_rels.*, n.nspname, c.relname, "
495-
" c.relfilenode, c.reltablespace, %s "
486+
" c.relfilenode, c.reltablespace, "
487+
" pg_catalog.pg_tablespace_location(t.oid) AS spclocation "
496488
"FROM (SELECT * FROM regular_heap "
497489
" UNION ALL "
498490
" SELECT * FROM toast_heap "
@@ -504,11 +496,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
504496
" ON c.relnamespace = n.oid "
505497
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
506498
" ON c.reltablespace = t.oid "
507-
"ORDER BY 1;",
508-
/* 9.2 removed the pg_tablespace.spclocation column */
509-
(GET_MAJOR_VERSION(cluster->major_version) >= 902) ?
510-
"pg_catalog.pg_tablespace_location(t.oid) AS spclocation" :
511-
"t.spclocation");
499+
"ORDER BY 1;");
512500

513501
res = executeQueryOrDie(conn, "%s", query);
514502

src/bin/pg_upgrade/pg_upgrade.h

+1-15
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,7 @@ extern char *output_files[];
8989

9090

9191
/*
92-
* postmaster/postgres -b (binary_upgrade) flag added during PG 9.1
93-
* development
94-
*/
95-
#define BINARY_UPGRADE_SERVER_FLAG_CAT_VER 201104251
96-
97-
/*
98-
* Visibility map changed with this 9.2 commit,
99-
* 8f9fe6edce358f7904e0db119416b4d1080a83aa; pick later catalog version.
100-
*/
101-
#define VISIBILITY_MAP_CRASHSAFE_CAT_VER 201107031
102-
103-
/*
104-
* The format of visibility map is changed with this 9.6 commit,
92+
* The format of visibility map was changed with this 9.6 commit.
10593
*/
10694
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011
10795

@@ -447,8 +435,6 @@ bool check_for_data_types_usage(ClusterInfo *cluster,
447435
bool check_for_data_type_usage(ClusterInfo *cluster,
448436
const char *type_name,
449437
const char *output_path);
450-
void new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster,
451-
bool check_mode);
452438
void old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster);
453439
void old_9_6_check_for_unknown_data_type_usage(ClusterInfo *cluster);
454440
void old_9_6_invalidate_hash_indexes(ClusterInfo *cluster,

src/bin/pg_upgrade/relfilenode.c

+1-11
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,8 @@ static void
137137
transfer_single_new_db(FileNameMap *maps, int size, char *old_tablespace)
138138
{
139139
int mapnum;
140-
bool vm_crashsafe_match = true;
141140
bool vm_must_add_frozenbit = false;
142141

143-
/*
144-
* Do the old and new cluster disagree on the crash-safetiness of the vm
145-
* files? If so, do not copy them.
146-
*/
147-
if (old_cluster.controldata.cat_ver < VISIBILITY_MAP_CRASHSAFE_CAT_VER &&
148-
new_cluster.controldata.cat_ver >= VISIBILITY_MAP_CRASHSAFE_CAT_VER)
149-
vm_crashsafe_match = false;
150-
151142
/*
152143
* Do we need to rewrite visibilitymap?
153144
*/
@@ -167,8 +158,7 @@ transfer_single_new_db(FileNameMap *maps, int size, char *old_tablespace)
167158
* Copy/link any fsm and vm files, if they exist
168159
*/
169160
transfer_relfile(&maps[mapnum], "_fsm", vm_must_add_frozenbit);
170-
if (vm_crashsafe_match)
171-
transfer_relfile(&maps[mapnum], "_vm", vm_must_add_frozenbit);
161+
transfer_relfile(&maps[mapnum], "_vm", vm_must_add_frozenbit);
172162
}
173163
}
174164
}

src/bin/pg_upgrade/server.c

+2-12
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,7 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
227227
#endif
228228

229229
/*
230-
* Since PG 9.1, we have used -b to disable autovacuum. For earlier
231-
* releases, setting autovacuum=off disables cleanup vacuum and analyze,
232-
* but freeze vacuums can still happen, so we set
233-
* autovacuum_freeze_max_age to its maximum.
234-
* (autovacuum_multixact_freeze_max_age was introduced after 9.1, so there
235-
* is no need to set that.) We assume all datfrozenxid and relfrozenxid
236-
* values are less than a gap of 2000000000 from the current xid counter,
237-
* so autovacuum will not touch them.
230+
* Use -b to disable autovacuum.
238231
*
239232
* Turn off durability requirements to improve object creation speed, and
240233
* we only modify the new cluster, so only use it there. If there is a
@@ -245,11 +238,8 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
245238
* vacuumdb --freeze actually freezes the tuples.
246239
*/
247240
snprintf(cmd, sizeof(cmd),
248-
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s\" start",
241+
"\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d -b%s %s%s\" start",
249242
cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
250-
(cluster->controldata.cat_ver >=
251-
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? " -b" :
252-
" -c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
253243
(cluster == &new_cluster) ?
254244
" -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c vacuum_defer_cleanup_age=0" : "",
255245
cluster->pgopts ? cluster->pgopts : "", socket_string);

src/bin/pg_upgrade/tablespace.c

+7-15
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,10 @@ get_tablespace_paths(void)
4646
char query[QUERY_ALLOC];
4747

4848
snprintf(query, sizeof(query),
49-
"SELECT %s "
49+
"SELECT pg_catalog.pg_tablespace_location(oid) AS spclocation "
5050
"FROM pg_catalog.pg_tablespace "
5151
"WHERE spcname != 'pg_default' AND "
52-
" spcname != 'pg_global'",
53-
/* 9.2 removed the spclocation column */
54-
(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
55-
"spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
52+
" spcname != 'pg_global'");
5653

5754
res = executeQueryOrDie(conn, "%s", query);
5855

@@ -105,15 +102,10 @@ get_tablespace_paths(void)
105102
static void
106103
set_tablespace_directory_suffix(ClusterInfo *cluster)
107104
{
108-
if (GET_MAJOR_VERSION(cluster->major_version) <= 804)
109-
cluster->tablespace_suffix = pg_strdup("");
110-
else
111-
{
112-
/* This cluster has a version-specific subdirectory */
105+
/* This cluster has a version-specific subdirectory */
113106

114-
/* The leading slash is needed to start a new directory. */
115-
cluster->tablespace_suffix = psprintf("/PG_%s_%d",
116-
cluster->major_version_str,
117-
cluster->controldata.cat_ver);
118-
}
107+
/* The leading slash is needed to start a new directory. */
108+
cluster->tablespace_suffix = psprintf("/PG_%s_%d",
109+
cluster->major_version_str,
110+
cluster->controldata.cat_ver);
119111
}

src/bin/pg_upgrade/test.sh

-3
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ if "$MAKE" -C "$oldsrc" installcheck-parallel; then
202202
# update references to old source tree's regress.so etc
203203
fix_sql=""
204204
case $oldpgversion in
205-
804??)
206-
fix_sql="UPDATE pg_proc SET probin = replace(probin::text, '$oldsrc', '$newsrc')::bytea WHERE probin LIKE '$oldsrc%';"
207-
;;
208205
*)
209206
fix_sql="UPDATE pg_proc SET probin = replace(probin, '$oldsrc', '$newsrc') WHERE probin LIKE '$oldsrc%';"
210207
;;

0 commit comments

Comments
 (0)