Commit Graph

270 Commits

Author SHA1 Message Date
Bruce Momjian fbcfa90bb8 Fix pg_upgrade file share violation on Windows created by the commit
4741e9afb9.  This was done by adding an
optional second log file parameter to exec_prog(), and closing and
reopening the log file between system() calls.

Backpatch to 9.2.
2012-08-07 13:10:44 -04:00
Bruce Momjian e8969c4733 In pg_upgrade, use pg_log() instead of prep_status() for
newline-terminated messages, per suggestion from Tom.

Backpatch to 9.2.
2012-08-03 12:43:37 -04:00
Bruce Momjian 4da8fc05f0 Simplify pg_upgrade's handling when returning directory listings.
Backpatch to 9.2.
2012-07-26 06:22:22 -04:00
Tom Lane faf26bf117 Get rid of useless global variable in pg_upgrade.
Since the scandir() emulation was taken out of pg_upgrade, there's
no longer any need for scandir_file_pattern to exist as a global
variable.  Replace it with a local in the one remaining function
that was making use of it.
2012-07-18 01:23:12 -04:00
Tom Lane 3d6ec663bb Improve pg_upgrade's load_directory() function.
Error out on out-of-memory, rather than returning -1, which the sole
existing caller wasn't checking for anyway.  There doesn't seem to be
any use-case for making the caller check for failure here.

Detect failure return from readdir().

Use a less platform-dependent method of calculating the entrysize.
It's possible, but not yet confirmed, that this explains bug #6733,
in which Mike Wilson reports a pg_upgrade crash that did not occur
in 9.1.  (Note that load_directory is effectively new code in 9.2,
at least on platforms that have scandir().)

Fix up comments, avoid uselessly using two counters, reduce the number
of realloc calls to something sane.
2012-07-18 01:13:20 -04:00
Bruce Momjian c742d1dbe7 Update pg_upgrade comments for recent configpath fix. 2012-07-06 09:39:22 -04:00
Bruce Momjian 2eeb5eb23f Fix PGDATAOLD and PGDATANEW to properly set pgconfig location, per
report from Tom.

Backpatch to 9.2.
2012-07-05 23:36:43 -04:00
Alvaro Herrera 666d494d19 pg_upgrade: abstract out copying of files from old cluster to new
Currently only pg_clog is copied, but some other directories could need
the same treatment as well, so create a subroutine to do it.

Extracted from my (somewhat larger) FOR KEY SHARE patch.
2012-07-05 11:38:42 -04:00
Alvaro Herrera 4741e9afb9 Make the pg_upgrade log files contain actual commands
Now the log file not only contains the output from commands executed by
system(), but also what command it was in the first place.  This
arrangement makes debugging a lot simpler.
2012-06-29 11:39:11 -04:00
Alvaro Herrera 9e26326ad6 pg_upgrade: fix off-by-one mistake in snprintf
snprintf counts trailing NUL towards the char limit.  Failing to account
for that was causing an invalid value to be passed to pg_resetxlog -l,
aborting the upgrade process.
2012-06-28 23:37:27 -04:00
Heikki Linnakangas 038f3a0509 Fix pg_upgrade, broken by the xlogid/segno -> 64-bit int refactoring.
The xlogid + segno representation of a particular WAL segment doesn't make
much sense in pg_resetxlog anymore, now that we don't use that anywhere
else. Use the WAL filename instead, since that's a convenient way to name a
particular WAL segment.

I did this partially for pg_resetxlog in the original xlogid/segno -> uint64
patch, but I neglected pg_upgrade and the docs. This should now be more
complete.
2012-06-26 07:49:02 +03:00
Peter Eisentraut bb7520cc26 Make documentation of --help and --version options more consistent
Before, some places didn't document the short options (-? and -V),
some documented both, some documented nothing, and they were listed in
various orders.  Now this is hopefully more consistent and complete.
2012-06-18 02:46:59 +03:00
Bruce Momjian 877b55c619 Improve pg_upgrade wording for pg_ctl start failure; could be
connection failure.

Backpatch to 9.2.

Per report from Evan D. Hoffman
2012-06-15 19:57:01 -04:00
Bruce Momjian b9212e379c In pg_upgrade, verify that the install user has the same oid on both
clusters, and make sure the new cluster has no additional users.

Backpatch to 9.1.
2012-06-13 12:19:18 -04:00
Bruce Momjian 927d61eeff Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
2012-06-10 15:20:04 -04:00
Bruce Momjian 8fcbfea788 In pg_upgrade, report pre-PG 8.1 plpython helper functions left in the
public schema that no longer point to valid shared object libraries, and
suggest a solution.
2012-06-01 11:40:04 -04:00
Bruce Momjian 4498a3407a Improve pg_upgrade C comment. 2012-05-27 06:45:29 -04:00
Bruce Momjian 20a3830b81 Add C comment explaining why we can't exclude checking functions in the
pg_catalog schema, even though they are not explicitly dumped (they are
implicitly dumped, e.g. create language plperl).
2012-05-27 06:35:10 -04:00
Bruce Momjian d4696fa68f Add pg_update C comment about problems with plpython_call_handler(). 2012-05-27 06:29:45 -04:00
Bruce Momjian 45ca31d6a7 Have pg_upgrade only use one extra log file for Win32, not two. 2012-05-25 09:10:07 -04:00
Bruce Momjian d226e236c6 On Windows, have pg_upgrade use different two files to log pg_ctl
start/stop output, to fix file share error reported by Edmund Horner
2012-05-24 20:30:39 -04:00
Bruce Momjian 476291bef0 Adjust pg_upgrade to output a separate log file for pg_ctl output on
Windows, to avoid opening a file by multiple processes.
2012-05-23 20:19:34 -04:00
Peter Eisentraut c8e086795a Remove whitespace from end of lines
pgindent and perltidy should clean up the rest.
2012-05-15 22:19:41 +03:00
Peter Eisentraut 081ca7a0d1 Tweak contrib --help output to match common style
Placeholders such as OPTION are typically kept in singular.
2012-05-08 21:55:05 +03:00
Robert Haas 5d4b60f2f2 Lots of doc corrections.
Josh Kupershmidt
2012-04-23 22:43:09 -04:00
Bruce Momjian 38458e4573 Fix pg_upgrade to properly upgrade a table that is stored in the cluster
default tablespace, but part of a database that is in a user-defined
tablespace.  Caused "file not found" error during upgrade.

Per bug report from Ants Aasma.

Backpatch to 9.1 and 9.0.
2012-04-10 19:57:14 -04:00
Tom Lane 98316e211b Silence compiler warning about uninitialized variable. 2012-03-27 14:47:23 -04:00
Peter Eisentraut 1b12c3e836 pg_upgrade: Add new generated file to .gitignore 2012-03-20 20:40:31 +02:00
Bruce Momjian 02b183acb4 In pg_upgrade, remove dependency on pg_config, as that might not be in
the non-development install.  Instead, use the LOAD mechanism to check
for the pg_upgrade_support shared object, like we do for other shared
object checks.

Backpatch to 9.1.

Report from Àlvaro
2012-03-19 09:31:50 -04:00
Bruce Momjian ced53c38d7 In pg_upgrade, move new echo quote define into include file. 2012-03-17 09:56:56 -04:00
Bruce Momjian faec2815c8 In pg_upgrade, create a script to incrementally generate more accurate
optimizer statistics so the cluster can be made available sooner.
2012-03-16 18:54:23 -04:00
Bruce Momjian 7c8cfed78a Uppercase pg_upgrade status output title. 2012-03-14 19:22:11 -04:00
Bruce Momjian 717f6d6085 In pg_upgrade, add various logging improvements:
add ability to control permissions of created files
	have psql echo its queries for easier debugging
	output four separate log files, and delete them on success
	add -r/--retain option to keep log files after success
	make logs file append-only
	remove -g/-G/-l logging options
	sugggest tailing appropriate log file on failure
	enhance -v/--verbose behavior
2012-03-12 19:48:03 -04:00
Bruce Momjian 2127aac6ef In pg_upgrade, only lock the old cluster if link mode is used, and do it
right after we restore the schema (a common failure point), and right
before we do the link operation.

Per suggesgtions from Robert and ^!C^!^@lvaro
2012-03-05 21:20:06 -05:00
Bruce Momjian 4e6092a227 Improve wording of pg_upgrade logfile option:
-l, --logfile=FILENAME        log internal activity to file\n\
2012-02-22 18:40:32 -05:00
Bruce Momjian 7f951474dc Have pg_upgrade output 'link' or 'copy' when reporting its status.
Idea from Peter.
2012-02-15 14:23:03 -05:00
Bruce Momjian 3946c28161 Fix pg_upgrade --help text for --user to not use a plural cluster name. 2012-01-26 22:18:58 -05:00
Bruce Momjian 6d5aae7afa Now that the shared library name can be adjusted in the library test,
have pg_upgrade allocate a maximum fixed size buffer for testing the
library file name, rather than base the allocation on the library name.

Backpatch to 9.1.
2012-01-25 09:35:17 -05:00
Bruce Momjian a7f2c79a6e Improve plpython fix comment in pg_upgrade. 2012-01-24 22:49:55 -05:00
Bruce Momjian cfe443ab9d In pg_upgrade, when checking for the plpython library, we must check for
"plpython2" when upgrading from pre-PG 9.1.  Patch to head and 9.1.

Per report from Peter.
2012-01-24 22:42:37 -05:00
Bruce Momjian b95aec5290 Fix new SQL tablespace location function usage in pg_upgrade to properly
check cluster version numbers, and fix missing table alias.
2012-01-24 21:51:10 -05:00
Bruce Momjian ecf7a2ea38 Add pg_upgrade C comment about why we check all relkinds for regtypes. 2012-01-19 16:04:34 -05:00
Bruce Momjian e126958c2e Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Peter Eisentraut d383c23f6f Remove support for on_exit()
All supported platforms support the C89 standard function atexit()
(SunOS 4 probably being the last one not to), and supporting both
makes the code clumsy.
2011-12-27 20:57:59 +02:00
Peter Eisentraut c317a3ac16 Run "make all" as a prerequisite of "make check"
This is the standard behavior but was forgotten in some places.
2011-12-27 20:27:24 +02:00
Magnus Hagander 16d8e594ac Remove spclocation field from pg_tablespace
Instead, add a function pg_tablespace_location(oid) used to return
the same information, and do this by reading the symbolic link.

Doing it this way makes it possible to relocate a tablespace when the
database is down by simply changing the symbolic link.
2011-12-07 10:37:33 +01:00
Bruce Momjian 0e8f6bf0e7 In pg_upgrade, allow tables using regclass to be upgraded because we
preserve pg_class oids since PG 9.0.
2011-12-05 16:45:19 -05:00
Tom Lane 9c6aa8cca0 Move EXTRA_CLEAN to where it actually works. 2011-11-29 23:14:16 -05:00
Peter Eisentraut b258ceb3ad pg_upgrade: Disable installcheck
Disabled for now because some build farm members with low resources
are not prepared to handle it.
2011-11-29 06:57:09 +02:00
Peter Eisentraut 08da2d282f Add pg_upgrade test suite
It runs the regression tests, runs pg_upgrade on the populated
database, and compares the before and after dumps.  While not actually
a cross-version upgrade, this does detect omissions and bugs in the
involved tools from time to time.  It's also possible to do a
cross-version upgrade by manually supplying parameters.
2011-11-27 22:42:32 +02:00