diff --git a/contrib/Makefile b/contrib/Makefile index 074e39477b1..cc60d680fca 100644 --- a/contrib/Makefile +++ b/contrib/Makefile @@ -36,7 +36,6 @@ SUBDIRS = \ pg_test_fsync \ pg_test_timing \ pg_trgm \ - pg_upgrade \ pgcrypto \ pgrowlocks \ pgstattuple \ diff --git a/contrib/pg_upgrade/Makefile b/contrib/pg_upgrade/Makefile deleted file mode 100644 index 87da4b8e834..00000000000 --- a/contrib/pg_upgrade/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# contrib/pg_upgrade/Makefile - -PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility" -PGAPPICON = win32 - -PROGRAM = pg_upgrade -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 \ - tablespace.o util.o version.o $(WIN32RES) - -PG_CPPFLAGS = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) -PG_LIBS = $(libpq_pgport) - -EXTRA_CLEAN = analyze_new_cluster.sh delete_old_cluster.sh log/ tmp_check/ \ - pg_upgrade_dump_globals.sql \ - pg_upgrade_dump_*.custom pg_upgrade_*.log - -ifdef USE_PGXS -PG_CONFIG = pg_config -PGXS := $(shell $(PG_CONFIG) --pgxs) -include $(PGXS) -else -subdir = contrib/pg_upgrade -top_builddir = ../.. -include $(top_builddir)/src/Makefile.global -include $(top_srcdir)/contrib/contrib-global.mk -endif - -check: test.sh all - MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install - -# disabled because it upsets the build farm -#installcheck: test.sh -# MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) $(SHELL) $< diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml index 57730955bfa..adc21843db2 100644 --- a/doc/src/sgml/contrib.sgml +++ b/doc/src/sgml/contrib.sgml @@ -204,7 +204,6 @@ pages. &pgstandby; &pgtestfsync; &pgtesttiming; - &pgupgrade; &pgxlogdump; diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml index ab935a6664f..2d7514c3ea1 100644 --- a/doc/src/sgml/filelist.sgml +++ b/doc/src/sgml/filelist.sgml @@ -136,7 +136,6 @@ - diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml index 9ae6aecb1a1..211a3c42bd5 100644 --- a/doc/src/sgml/ref/allfiles.sgml +++ b/doc/src/sgml/ref/allfiles.sgml @@ -193,6 +193,7 @@ Complete list of usable sgml source files in this directory. + diff --git a/doc/src/sgml/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml similarity index 98% rename from doc/src/sgml/pgupgrade.sgml rename to doc/src/sgml/ref/pgupgrade.sgml index 45bceff9bea..ce5e3082b5d 100644 --- a/doc/src/sgml/pgupgrade.sgml +++ b/doc/src/sgml/ref/pgupgrade.sgml @@ -1,4 +1,4 @@ - + @@ -240,7 +240,8 @@ mv /usr/local/pgsql /usr/local/pgsql.old Install the new PostgreSQL binaries - Install the new server's binaries and support files. + Install the new server's binaries and support + files. pg_upgrade is included in a default installation. @@ -252,15 +253,6 @@ make prefix=/usr/local/pgsql.new install - - Install pg_upgrade - - - Install the pg_upgrade binary in the new PostgreSQL - installation. - - - Initialize the new PostgreSQL cluster diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml index c1765ef1c5e..fb18d94ea09 100644 --- a/doc/src/sgml/reference.sgml +++ b/doc/src/sgml/reference.sgml @@ -263,6 +263,7 @@ &pgCtl; &pgResetxlog; &pgRewind; + &pgupgrade; &postgres; &postmaster; diff --git a/src/bin/Makefile b/src/bin/Makefile index bb77142cab8..cc78798fba7 100644 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -23,6 +23,7 @@ SUBDIRS = \ pg_dump \ pg_resetxlog \ pg_rewind \ + pg_upgrade \ pgbench \ psql \ scripts diff --git a/contrib/pg_upgrade/.gitignore b/src/bin/pg_upgrade/.gitignore similarity index 100% rename from contrib/pg_upgrade/.gitignore rename to src/bin/pg_upgrade/.gitignore diff --git a/contrib/pg_upgrade/IMPLEMENTATION b/src/bin/pg_upgrade/IMPLEMENTATION similarity index 99% rename from contrib/pg_upgrade/IMPLEMENTATION rename to src/bin/pg_upgrade/IMPLEMENTATION index a0cfcf15dac..9b5ff7295c1 100644 --- a/contrib/pg_upgrade/IMPLEMENTATION +++ b/src/bin/pg_upgrade/IMPLEMENTATION @@ -1,5 +1,3 @@ -contrib/pg_upgrade/IMPLEMENTATION - ------------------------------------------------------------------------------ PG_UPGRADE: IN-PLACE UPGRADES FOR POSTGRESQL ------------------------------------------------------------------------------ diff --git a/src/bin/pg_upgrade/Makefile b/src/bin/pg_upgrade/Makefile new file mode 100644 index 00000000000..4eb20d6b547 --- /dev/null +++ b/src/bin/pg_upgrade/Makefile @@ -0,0 +1,42 @@ +# src/bin/pg_upgrade/Makefile + +PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility" +PGAPPICON = win32 + +subdir = src/bin/pg_upgrade +top_builddir = ../../.. +include $(top_builddir)/src/Makefile.global + +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 \ + tablespace.o util.o version.o $(WIN32RES) + +override CPPFLAGS := -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS) + + +all: pg_upgrade + +pg_upgrade: $(OBJS) | submake-libpq submake-libpgport + $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) + +install: all installdirs + $(INSTALL_PROGRAM) pg_upgrade$(X) '$(DESTDIR)$(bindir)/pg_upgrade$(X)' + +installdirs: + $(MKDIR_P) '$(DESTDIR)$(bindir)' + +uninstall: + rm -f '$(DESTDIR)$(bindir)/pg_upgrade$(X)' + +clean distclean maintainer-clean: + rm -f pg_upgrade$(X) $(OBJS) + rm -rf analyze_new_cluster.sh delete_old_cluster.sh log/ tmp_check/ \ + pg_upgrade_dump_globals.sql \ + pg_upgrade_dump_*.custom pg_upgrade_*.log + +check: test.sh all + MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install + +# disabled because it upsets the build farm +#installcheck: test.sh +# MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) $(SHELL) $< diff --git a/contrib/pg_upgrade/TESTING b/src/bin/pg_upgrade/TESTING similarity index 99% rename from contrib/pg_upgrade/TESTING rename to src/bin/pg_upgrade/TESTING index 359688c6645..4ecfc5798e0 100644 --- a/contrib/pg_upgrade/TESTING +++ b/src/bin/pg_upgrade/TESTING @@ -1,5 +1,3 @@ -contrib/pg_upgrade/TESTING - The most effective way to test pg_upgrade, aside from testing on user data, is by upgrading the PostgreSQL regression database. diff --git a/contrib/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c similarity index 99% rename from contrib/pg_upgrade/check.c rename to src/bin/pg_upgrade/check.c index 6a498c3bd5c..647bf349f4d 100644 --- a/contrib/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -4,7 +4,7 @@ * server checks and output routines * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/check.c + * src/bin/pg_upgrade/check.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c similarity index 99% rename from contrib/pg_upgrade/controldata.c rename to src/bin/pg_upgrade/controldata.c index 0e70b6f80b4..bf53db05515 100644 --- a/contrib/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -4,7 +4,7 @@ * controldata functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/controldata.c + * src/bin/pg_upgrade/controldata.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c similarity index 99% rename from contrib/pg_upgrade/dump.c rename to src/bin/pg_upgrade/dump.c index 906e85f2b53..2c20e847ac0 100644 --- a/contrib/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -4,7 +4,7 @@ * dump functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/dump.c + * src/bin/pg_upgrade/dump.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c similarity index 99% rename from contrib/pg_upgrade/exec.c rename to src/bin/pg_upgrade/exec.c index bf87419b187..7d319126ed9 100644 --- a/contrib/pg_upgrade/exec.c +++ b/src/bin/pg_upgrade/exec.c @@ -4,7 +4,7 @@ * execution functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/exec.c + * src/bin/pg_upgrade/exec.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c similarity index 99% rename from contrib/pg_upgrade/file.c rename to src/bin/pg_upgrade/file.c index 5a8d17ae0f4..79d9390216e 100644 --- a/contrib/pg_upgrade/file.c +++ b/src/bin/pg_upgrade/file.c @@ -4,7 +4,7 @@ * file system operations * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/file.c + * src/bin/pg_upgrade/file.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c similarity index 99% rename from contrib/pg_upgrade/function.c rename to src/bin/pg_upgrade/function.c index d8009d195d8..04492a5cee4 100644 --- a/contrib/pg_upgrade/function.c +++ b/src/bin/pg_upgrade/function.c @@ -4,7 +4,7 @@ * server-side function support * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/function.c + * src/bin/pg_upgrade/function.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c similarity index 99% rename from contrib/pg_upgrade/info.c rename to src/bin/pg_upgrade/info.c index 12549342707..c0a56012090 100644 --- a/contrib/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -4,7 +4,7 @@ * information support functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/info.c + * src/bin/pg_upgrade/info.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c similarity index 99% rename from contrib/pg_upgrade/option.c rename to src/bin/pg_upgrade/option.c index 742d133e391..b8510561350 100644 --- a/contrib/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -4,7 +4,7 @@ * options functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/option.c + * src/bin/pg_upgrade/option.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/page.c b/src/bin/pg_upgrade/page.c similarity index 99% rename from contrib/pg_upgrade/page.c rename to src/bin/pg_upgrade/page.c index 1cfc10f8a2a..3f4c697a108 100644 --- a/contrib/pg_upgrade/page.c +++ b/src/bin/pg_upgrade/page.c @@ -4,7 +4,7 @@ * per-page conversion operations * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/page.c + * src/bin/pg_upgrade/page.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c similarity index 99% rename from contrib/pg_upgrade/parallel.c rename to src/bin/pg_upgrade/parallel.c index 6da996559a4..c6978b596b4 100644 --- a/contrib/pg_upgrade/parallel.c +++ b/src/bin/pg_upgrade/parallel.c @@ -4,7 +4,7 @@ * multi-process support * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/parallel.c + * src/bin/pg_upgrade/parallel.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c similarity index 99% rename from contrib/pg_upgrade/pg_upgrade.c rename to src/bin/pg_upgrade/pg_upgrade.c index 78bd29fb957..fbccc2e8304 100644 --- a/contrib/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -4,7 +4,7 @@ * main source file * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/pg_upgrade.c + * src/bin/pg_upgrade/pg_upgrade.c */ /* diff --git a/contrib/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h similarity index 99% rename from contrib/pg_upgrade/pg_upgrade.h rename to src/bin/pg_upgrade/pg_upgrade.h index ace3465f989..4683c6f71c3 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -2,7 +2,7 @@ * pg_upgrade.h * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/pg_upgrade.h + * src/bin/pg_upgrade/pg_upgrade.h */ #include diff --git a/contrib/pg_upgrade/relfilenode.c b/src/bin/pg_upgrade/relfilenode.c similarity index 99% rename from contrib/pg_upgrade/relfilenode.c rename to src/bin/pg_upgrade/relfilenode.c index 423802bd239..fe058807b68 100644 --- a/contrib/pg_upgrade/relfilenode.c +++ b/src/bin/pg_upgrade/relfilenode.c @@ -4,7 +4,7 @@ * relfilenode functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/relfilenode.c + * src/bin/pg_upgrade/relfilenode.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c similarity index 99% rename from contrib/pg_upgrade/server.c rename to src/bin/pg_upgrade/server.c index c5f66f09632..8d8e7d70734 100644 --- a/contrib/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -4,7 +4,7 @@ * database server functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/server.c + * src/bin/pg_upgrade/server.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c similarity index 98% rename from contrib/pg_upgrade/tablespace.c rename to src/bin/pg_upgrade/tablespace.c index eecdf4b2983..ce7097e71bf 100644 --- a/contrib/pg_upgrade/tablespace.c +++ b/src/bin/pg_upgrade/tablespace.c @@ -4,7 +4,7 @@ * tablespace functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/tablespace.c + * src/bin/pg_upgrade/tablespace.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh similarity index 97% rename from contrib/pg_upgrade/test.sh rename to src/bin/pg_upgrade/test.sh index 2e9f97688c6..0903f30b119 100644 --- a/contrib/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -1,6 +1,6 @@ #!/bin/sh -# contrib/pg_upgrade/test.sh +# src/bin/pg_upgrade/test.sh # # Test driver for pg_upgrade. Initializes a new database cluster, # runs the regression tests (to put in some data), runs pg_dumpall, @@ -21,7 +21,7 @@ unset MAKELEVEL # authentication configuration. standard_initdb() { "$1" -N - ../../src/test/regress/pg_regress --config-auth "$PGDATA" + ../../test/regress/pg_regress --config-auth "$PGDATA" } # Establish how the server will listen for connections @@ -92,9 +92,9 @@ fi : ${oldbindir=$bindir} -: ${oldsrc=../..} +: ${oldsrc=../../..} oldsrc=`cd "$oldsrc" && pwd` -newsrc=`cd ../.. && pwd` +newsrc=`cd ../../.. && pwd` PATH=$bindir:$PATH export PATH diff --git a/contrib/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c similarity index 99% rename from contrib/pg_upgrade/util.c rename to src/bin/pg_upgrade/util.c index 6184ceef933..7f328f06444 100644 --- a/contrib/pg_upgrade/util.c +++ b/src/bin/pg_upgrade/util.c @@ -4,7 +4,7 @@ * utility functions * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/util.c + * src/bin/pg_upgrade/util.c */ #include "postgres_fe.h" diff --git a/contrib/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c similarity index 99% rename from contrib/pg_upgrade/version.c rename to src/bin/pg_upgrade/version.c index 4ae9511d045..e3e7387c92d 100644 --- a/contrib/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -4,7 +4,7 @@ * Postgres-version-specific routines * * Copyright (c) 2010-2015, PostgreSQL Global Development Group - * contrib/pg_upgrade/version.c + * src/bin/pg_upgrade/version.c */ #include "postgres_fe.h" diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index 39281db9011..e4dbebf0604 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -31,18 +31,18 @@ my $libpq; # Set of variables for contrib modules my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' }; my @contrib_uselibpq = - ('dblink', 'oid2name', 'pg_upgrade', 'postgres_fdw', 'vacuumlo'); + ('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo'); my @contrib_uselibpgport = ( 'oid2name', 'pg_standby', 'pg_test_fsync', 'pg_test_timing', - 'pg_upgrade', 'pg_xlogdump', + 'pg_xlogdump', 'vacuumlo'); my @contrib_uselibpgcommon = ( 'oid2name', 'pg_standby', 'pg_test_fsync', 'pg_test_timing', - 'pg_upgrade', 'pg_xlogdump', + 'pg_xlogdump', 'vacuumlo'); my $contrib_extralibs = undef; my $contrib_extraincludes = @@ -54,9 +54,9 @@ my @contrib_excludes = ('pgcrypto', 'intagg', 'sepgsql'); # Set of variables for frontend modules my $frontend_defines = { 'initdb' => 'FRONTEND' }; -my @frontend_uselibpq = ('pg_ctl', 'pgbench', 'psql'); -my @frontend_uselibpgport = ( 'pg_archivecleanup', 'pgbench' ); -my @frontend_uselibpgcommon = ( 'pg_archivecleanup', 'pgbench' ); +my @frontend_uselibpq = ('pg_ctl', 'pg_upgrade', 'pgbench', 'psql'); +my @frontend_uselibpgport = ( 'pg_archivecleanup', 'pg_upgrade', 'pgbench' ); +my @frontend_uselibpgcommon = ( 'pg_archivecleanup', 'pg_upgrade', 'pgbench' ); my $frontend_extralibs = { 'initdb' => ['ws2_32.lib'], 'pg_restore' => ['ws2_32.lib'], diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index bd3dd2ca1e1..4812a0361f6 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -269,7 +269,7 @@ sub upgradecheck $ENV{PGHOST} = 'localhost'; $ENV{PGPORT} ||= 50432; - my $tmp_root = "$topdir/contrib/pg_upgrade/tmp_check"; + my $tmp_root = "$topdir/src/bin/pg_upgrade/tmp_check"; (mkdir $tmp_root || die $!) unless -d $tmp_root; my $tmp_install = "$tmp_root/install"; print "Setting up temp install\n\n"; @@ -282,7 +282,7 @@ sub upgradecheck $ENV{PATH} = "$bindir;$ENV{PATH}"; my $data = "$tmp_root/data"; $ENV{PGDATA} = "$data.old"; - my $logdir = "$topdir/contrib/pg_upgrade/log"; + my $logdir = "$topdir/src/bin/pg_upgrade/log"; (mkdir $logdir || die $!) unless -d $logdir; print "\nRunning initdb on old cluster\n\n"; standard_initdb() or exit 1; @@ -292,7 +292,7 @@ sub upgradecheck installcheck(); # now we can chdir into the source dir - chdir "$topdir/contrib/pg_upgrade"; + chdir "$topdir/src/bin/pg_upgrade"; print "\nDumping old cluster\n\n"; system("pg_dumpall -f $tmp_root/dump1.sql") == 0 or exit 1; print "\nStopping old cluster\n\n";