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 = \
pg_test_fsync \
pg_test_timing \
pg_trgm \
pg_upgrade \
pgcrypto \
pgrowlocks \
pgstattuple \
......
......@@ -204,7 +204,6 @@ pages.
&pgstandby;
&pgtestfsync;
&pgtesttiming;
&pgupgrade;
&pgxlogdump;
</sect1>
</appendix>
......@@ -136,7 +136,6 @@
<!ENTITY pgtestfsync SYSTEM "pgtestfsync.sgml">
<!ENTITY pgtesttiming SYSTEM "pgtesttiming.sgml">
<!ENTITY pgtrgm SYSTEM "pgtrgm.sgml">
<!ENTITY pgupgrade SYSTEM "pgupgrade.sgml">
<!ENTITY pgxlogdump SYSTEM "pg_xlogdump.sgml">
<!ENTITY postgres-fdw SYSTEM "postgres-fdw.sgml">
<!ENTITY seg SYSTEM "seg.sgml">
......
......@@ -193,6 +193,7 @@ Complete list of usable sgml source files in this directory.
<!ENTITY pgResetxlog SYSTEM "pg_resetxlog.sgml">
<!ENTITY pgRestore SYSTEM "pg_restore.sgml">
<!ENTITY pgRewind SYSTEM "pg_rewind.sgml">
<!ENTITY pgupgrade SYSTEM "pgupgrade.sgml">
<!ENTITY postgres SYSTEM "postgres-ref.sgml">
<!ENTITY postmaster SYSTEM "postmaster.sgml">
<!ENTITY psqlRef SYSTEM "psql-ref.sgml">
......
<!-- doc/src/sgml/pgupgrade.sgml -->
<!-- doc/src/sgml/ref/pgupgrade.sgml -->
<refentry id="pgupgrade">
<indexterm zone="pgupgrade">
......@@ -240,7 +240,8 @@ mv /usr/local/pgsql /usr/local/pgsql.old
<title>Install the new PostgreSQL binaries</title>
<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>
......@@ -252,15 +253,6 @@ make prefix=/usr/local/pgsql.new install
</programlisting></para>
</step>
<step>
<title>Install pg_upgrade</title>
<para>
Install the <application>pg_upgrade</> binary in the new PostgreSQL
installation.
</para>
</step>
<step>
<title>Initialize the new PostgreSQL cluster</title>
......
......@@ -263,6 +263,7 @@
&pgCtl;
&pgResetxlog;
&pgRewind;
&pgupgrade;
&postgres;
&postmaster;
......
......@@ -23,6 +23,7 @@ SUBDIRS = \
pg_dump \
pg_resetxlog \
pg_rewind \
pg_upgrade \
pgbench \
psql \
scripts
......
contrib/pg_upgrade/IMPLEMENTATION
------------------------------------------------------------------------------
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"
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 \
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)
override CPPFLAGS := -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
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
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
......
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.
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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
*/
/*
......
......@@ -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 <unistd.h>
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
#!/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
......
......@@ -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"
......
......@@ -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"
......
......@@ -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'],
......
......@@ -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";
......
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