Commit 9fa8b0ee authored by Peter Eisentraut's avatar Peter Eisentraut

Move pg_upgrade from contrib/ to src/bin/

Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent 30982be4
...@@ -36,7 +36,6 @@ SUBDIRS = \ ...@@ -36,7 +36,6 @@ SUBDIRS = \
pg_test_fsync \ pg_test_fsync \
pg_test_timing \ pg_test_timing \
pg_trgm \ pg_trgm \
pg_upgrade \
pgcrypto \ pgcrypto \
pgrowlocks \ pgrowlocks \
pgstattuple \ pgstattuple \
......
...@@ -204,7 +204,6 @@ pages. ...@@ -204,7 +204,6 @@ pages.
&pgstandby; &pgstandby;
&pgtestfsync; &pgtestfsync;
&pgtesttiming; &pgtesttiming;
&pgupgrade;
&pgxlogdump; &pgxlogdump;
</sect1> </sect1>
</appendix> </appendix>
...@@ -136,7 +136,6 @@ ...@@ -136,7 +136,6 @@
<!ENTITY pgtestfsync SYSTEM "pgtestfsync.sgml"> <!ENTITY pgtestfsync SYSTEM "pgtestfsync.sgml">
<!ENTITY pgtesttiming SYSTEM "pgtesttiming.sgml"> <!ENTITY pgtesttiming SYSTEM "pgtesttiming.sgml">
<!ENTITY pgtrgm SYSTEM "pgtrgm.sgml"> <!ENTITY pgtrgm SYSTEM "pgtrgm.sgml">
<!ENTITY pgupgrade SYSTEM "pgupgrade.sgml">
<!ENTITY pgxlogdump SYSTEM "pg_xlogdump.sgml"> <!ENTITY pgxlogdump SYSTEM "pg_xlogdump.sgml">
<!ENTITY postgres-fdw SYSTEM "postgres-fdw.sgml"> <!ENTITY postgres-fdw SYSTEM "postgres-fdw.sgml">
<!ENTITY seg SYSTEM "seg.sgml"> <!ENTITY seg SYSTEM "seg.sgml">
......
...@@ -193,6 +193,7 @@ Complete list of usable sgml source files in this directory. ...@@ -193,6 +193,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY pgResetxlog SYSTEM "pg_resetxlog.sgml"> <!ENTITY pgResetxlog SYSTEM "pg_resetxlog.sgml">
<!ENTITY pgRestore SYSTEM "pg_restore.sgml"> <!ENTITY pgRestore SYSTEM "pg_restore.sgml">
<!ENTITY pgRewind SYSTEM "pg_rewind.sgml"> <!ENTITY pgRewind SYSTEM "pg_rewind.sgml">
<!ENTITY pgupgrade SYSTEM "pgupgrade.sgml">
<!ENTITY postgres SYSTEM "postgres-ref.sgml"> <!ENTITY postgres SYSTEM "postgres-ref.sgml">
<!ENTITY postmaster SYSTEM "postmaster.sgml"> <!ENTITY postmaster SYSTEM "postmaster.sgml">
<!ENTITY psqlRef SYSTEM "psql-ref.sgml"> <!ENTITY psqlRef SYSTEM "psql-ref.sgml">
......
<!-- doc/src/sgml/pgupgrade.sgml --> <!-- doc/src/sgml/ref/pgupgrade.sgml -->
<refentry id="pgupgrade"> <refentry id="pgupgrade">
<indexterm zone="pgupgrade"> <indexterm zone="pgupgrade">
...@@ -240,7 +240,8 @@ mv /usr/local/pgsql /usr/local/pgsql.old ...@@ -240,7 +240,8 @@ mv /usr/local/pgsql /usr/local/pgsql.old
<title>Install the new PostgreSQL binaries</title> <title>Install the new PostgreSQL binaries</title>
<para> <para>
Install the new server's binaries and support files. Install the new server's binaries and support
files. <application>pg_upgrade</> is included in a default installation.
</para> </para>
<para> <para>
...@@ -252,15 +253,6 @@ make prefix=/usr/local/pgsql.new install ...@@ -252,15 +253,6 @@ make prefix=/usr/local/pgsql.new install
</programlisting></para> </programlisting></para>
</step> </step>
<step>
<title>Install pg_upgrade</title>
<para>
Install the <application>pg_upgrade</> binary in the new PostgreSQL
installation.
</para>
</step>
<step> <step>
<title>Initialize the new PostgreSQL cluster</title> <title>Initialize the new PostgreSQL cluster</title>
......
...@@ -263,6 +263,7 @@ ...@@ -263,6 +263,7 @@
&pgCtl; &pgCtl;
&pgResetxlog; &pgResetxlog;
&pgRewind; &pgRewind;
&pgupgrade;
&postgres; &postgres;
&postmaster; &postmaster;
......
...@@ -23,6 +23,7 @@ SUBDIRS = \ ...@@ -23,6 +23,7 @@ SUBDIRS = \
pg_dump \ pg_dump \
pg_resetxlog \ pg_resetxlog \
pg_rewind \ pg_rewind \
pg_upgrade \
pgbench \ pgbench \
psql \ psql \
scripts scripts
......
contrib/pg_upgrade/IMPLEMENTATION
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
PG_UPGRADE: IN-PLACE UPGRADES FOR POSTGRESQL PG_UPGRADE: IN-PLACE UPGRADES FOR POSTGRESQL
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
......
# contrib/pg_upgrade/Makefile # src/bin/pg_upgrade/Makefile
PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility" PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
PGAPPICON = win32 PGAPPICON = win32
PROGRAM = pg_upgrade 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 \ 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 $(WIN32RES) tablespace.o util.o version.o $(WIN32RES)
PG_CPPFLAGS = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) override CPPFLAGS := -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
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 all: pg_upgrade
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs) pg_upgrade: $(OBJS) | submake-libpq submake-libpgport
include $(PGXS) $(CC) $(CFLAGS) $^ $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
else
subdir = contrib/pg_upgrade install: all installdirs
top_builddir = ../.. $(INSTALL_PROGRAM) pg_upgrade$(X) '$(DESTDIR)$(bindir)/pg_upgrade$(X)'
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk installdirs:
endif $(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 check: test.sh all
MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install
......
contrib/pg_upgrade/TESTING
The most effective way to test pg_upgrade, aside from testing on user The most effective way to test pg_upgrade, aside from testing on user
data, is by upgrading the PostgreSQL regression database. data, is by upgrading the PostgreSQL regression database.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* server checks and output routines * server checks and output routines
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/check.c * src/bin/pg_upgrade/check.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* controldata functions * controldata functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/controldata.c * src/bin/pg_upgrade/controldata.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* dump functions * dump functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/dump.c * src/bin/pg_upgrade/dump.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* execution functions * execution functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/exec.c * src/bin/pg_upgrade/exec.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* file system operations * file system operations
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/file.c * src/bin/pg_upgrade/file.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* server-side function support * server-side function support
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/function.c * src/bin/pg_upgrade/function.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* information support functions * information support functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/info.c * src/bin/pg_upgrade/info.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* options functions * options functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/option.c * src/bin/pg_upgrade/option.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* per-page conversion operations * per-page conversion operations
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/page.c * src/bin/pg_upgrade/page.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* multi-process support * multi-process support
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/parallel.c * src/bin/pg_upgrade/parallel.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* main source file * main source file
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/pg_upgrade.c * src/bin/pg_upgrade/pg_upgrade.c
*/ */
/* /*
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pg_upgrade.h * pg_upgrade.h
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/pg_upgrade.h * src/bin/pg_upgrade/pg_upgrade.h
*/ */
#include <unistd.h> #include <unistd.h>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* relfilenode functions * relfilenode functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/relfilenode.c * src/bin/pg_upgrade/relfilenode.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* database server functions * database server functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/server.c * src/bin/pg_upgrade/server.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* tablespace functions * tablespace functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/tablespace.c * src/bin/pg_upgrade/tablespace.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
#!/bin/sh #!/bin/sh
# contrib/pg_upgrade/test.sh # src/bin/pg_upgrade/test.sh
# #
# Test driver for pg_upgrade. Initializes a new database cluster, # Test driver for pg_upgrade. Initializes a new database cluster,
# runs the regression tests (to put in some data), runs pg_dumpall, # runs the regression tests (to put in some data), runs pg_dumpall,
...@@ -21,7 +21,7 @@ unset MAKELEVEL ...@@ -21,7 +21,7 @@ unset MAKELEVEL
# authentication configuration. # authentication configuration.
standard_initdb() { standard_initdb() {
"$1" -N "$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 # Establish how the server will listen for connections
...@@ -92,9 +92,9 @@ fi ...@@ -92,9 +92,9 @@ fi
: ${oldbindir=$bindir} : ${oldbindir=$bindir}
: ${oldsrc=../..} : ${oldsrc=../../..}
oldsrc=`cd "$oldsrc" && pwd` oldsrc=`cd "$oldsrc" && pwd`
newsrc=`cd ../.. && pwd` newsrc=`cd ../../.. && pwd`
PATH=$bindir:$PATH PATH=$bindir:$PATH
export PATH export PATH
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* utility functions * utility functions
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/util.c * src/bin/pg_upgrade/util.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Postgres-version-specific routines * Postgres-version-specific routines
* *
* Copyright (c) 2010-2015, PostgreSQL Global Development Group * Copyright (c) 2010-2015, PostgreSQL Global Development Group
* contrib/pg_upgrade/version.c * src/bin/pg_upgrade/version.c
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
......
...@@ -31,18 +31,18 @@ my $libpq; ...@@ -31,18 +31,18 @@ my $libpq;
# Set of variables for contrib modules # Set of variables for contrib modules
my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' }; my $contrib_defines = { 'refint' => 'REFINT_VERBOSE' };
my @contrib_uselibpq = my @contrib_uselibpq =
('dblink', 'oid2name', 'pg_upgrade', 'postgres_fdw', 'vacuumlo'); ('dblink', 'oid2name', 'postgres_fdw', 'vacuumlo');
my @contrib_uselibpgport = ( my @contrib_uselibpgport = (
'oid2name', 'oid2name',
'pg_standby', 'pg_standby',
'pg_test_fsync', 'pg_test_timing', 'pg_test_fsync', 'pg_test_timing',
'pg_upgrade', 'pg_xlogdump', 'pg_xlogdump',
'vacuumlo'); 'vacuumlo');
my @contrib_uselibpgcommon = ( my @contrib_uselibpgcommon = (
'oid2name', 'oid2name',
'pg_standby', 'pg_standby',
'pg_test_fsync', 'pg_test_timing', 'pg_test_fsync', 'pg_test_timing',
'pg_upgrade', 'pg_xlogdump', 'pg_xlogdump',
'vacuumlo'); 'vacuumlo');
my $contrib_extralibs = undef; my $contrib_extralibs = undef;
my $contrib_extraincludes = my $contrib_extraincludes =
...@@ -54,9 +54,9 @@ my @contrib_excludes = ('pgcrypto', 'intagg', 'sepgsql'); ...@@ -54,9 +54,9 @@ my @contrib_excludes = ('pgcrypto', 'intagg', 'sepgsql');
# Set of variables for frontend modules # Set of variables for frontend modules
my $frontend_defines = { 'initdb' => 'FRONTEND' }; my $frontend_defines = { 'initdb' => 'FRONTEND' };
my @frontend_uselibpq = ('pg_ctl', 'pgbench', 'psql'); my @frontend_uselibpq = ('pg_ctl', 'pg_upgrade', 'pgbench', 'psql');
my @frontend_uselibpgport = ( 'pg_archivecleanup', 'pgbench' ); my @frontend_uselibpgport = ( 'pg_archivecleanup', 'pg_upgrade', 'pgbench' );
my @frontend_uselibpgcommon = ( 'pg_archivecleanup', 'pgbench' ); my @frontend_uselibpgcommon = ( 'pg_archivecleanup', 'pg_upgrade', 'pgbench' );
my $frontend_extralibs = { my $frontend_extralibs = {
'initdb' => ['ws2_32.lib'], 'initdb' => ['ws2_32.lib'],
'pg_restore' => ['ws2_32.lib'], 'pg_restore' => ['ws2_32.lib'],
......
...@@ -269,7 +269,7 @@ sub upgradecheck ...@@ -269,7 +269,7 @@ sub upgradecheck
$ENV{PGHOST} = 'localhost'; $ENV{PGHOST} = 'localhost';
$ENV{PGPORT} ||= 50432; $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; (mkdir $tmp_root || die $!) unless -d $tmp_root;
my $tmp_install = "$tmp_root/install"; my $tmp_install = "$tmp_root/install";
print "Setting up temp install\n\n"; print "Setting up temp install\n\n";
...@@ -282,7 +282,7 @@ sub upgradecheck ...@@ -282,7 +282,7 @@ sub upgradecheck
$ENV{PATH} = "$bindir;$ENV{PATH}"; $ENV{PATH} = "$bindir;$ENV{PATH}";
my $data = "$tmp_root/data"; my $data = "$tmp_root/data";
$ENV{PGDATA} = "$data.old"; $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; (mkdir $logdir || die $!) unless -d $logdir;
print "\nRunning initdb on old cluster\n\n"; print "\nRunning initdb on old cluster\n\n";
standard_initdb() or exit 1; standard_initdb() or exit 1;
...@@ -292,7 +292,7 @@ sub upgradecheck ...@@ -292,7 +292,7 @@ sub upgradecheck
installcheck(); installcheck();
# now we can chdir into the source dir # 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"; print "\nDumping old cluster\n\n";
system("pg_dumpall -f $tmp_root/dump1.sql") == 0 or exit 1; system("pg_dumpall -f $tmp_root/dump1.sql") == 0 or exit 1;
print "\nStopping old cluster\n\n"; print "\nStopping old cluster\n\n";
......
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