Skip to content

Commit 37c9346

Browse files
committed
pg_resetxlog specifies log location in hex; more pg_upgrade testing
improvments.
1 parent ba3231a commit 37c9346

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

contrib/pg_resetxlog/pg_resetxlog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.15 2002/01/10 23:46:13 momjian Exp $
26+
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.16 2002/01/11 06:33:01 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -482,7 +482,7 @@ usage(void)
482482
" -f\t force update to be done\n"
483483
" -n\t no update, just show extracted pg_control values (for testing)\n"
484484
" -x XID set XID in pg_control\n"
485-
" -l log_id offset set checkpoint location in pg_control\n");
485+
" -l log_id offset set hex checkpoint location in pg_control\n");
486486
exit(1);
487487
}
488488

@@ -523,11 +523,11 @@ main(int argc, char **argv)
523523
argn++;
524524
if (argn == argc)
525525
usage();
526-
set_checkpoint.xlogid = strtoul(argv[argn], NULL, 0);
526+
set_checkpoint.xlogid = strtoul(argv[argn], NULL, 16);
527527
argn++;
528528
if (argn == argc)
529529
usage();
530-
set_checkpoint.xrecoff = strtoul(argv[argn], NULL, 0);
530+
set_checkpoint.xrecoff = strtoul(argv[argn], NULL, 16);
531531
if (set_checkpoint.xlogid == 0 &&
532532
set_checkpoint.xrecoff == 0)
533533
{

src/bin/pg_dump/pg_upgrade

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# pg_upgrade: update a database without needing a full dump/reload cycle.
44
# CAUTION: Read the manual page before trying to use this!
55

6-
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.26 2002/01/11 06:08:02 momjian Exp $
6+
#set -x
7+
8+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.27 2002/01/11 06:33:01 momjian Exp $
79
#
810
# NOTE: we must be sure to update the version-checking code a few dozen lines
911
# below for each new PostgreSQL release.
@@ -106,7 +108,7 @@ Install it from pgsql/contrib/pg_resetxlog and continue.; exiting" 1>&2
106108
exit 1
107109
fi
108110

109-
if ! pg_resetxlog -x | grep -q XID
111+
if ! pg_resetxlog -x 2>&1 | grep -q XID
110112
then echo "Old version of pg_resetxlog found in path.
111113
Install a newer version from pgsql/contrib/pg_resetxlog.; exiting" 1>&2
112114
exit 1
@@ -261,7 +263,7 @@ fi
261263

262264
# Set checkpoint location of new database
263265

264-
pg_resetxlog -l `echo "$CHKPOINT | tr '/' ' '` data
266+
pg_resetxlog -l `echo "$CHKPOINT" | tr '/' ' '` data
265267
if [ "$?" -ne 0 ]
266268
then echo "Unable to set new checkpoint location.; exiting" 1>&2
267269
exit 1
@@ -278,7 +280,7 @@ fi
278280
# Set sequence values for 7.1-version sequences, which were int4.
279281

280282
if [ "$SRC_VERSION" = "7.1" ]
281-
else echo "Set int8 sequence values from 7.1..."
283+
then echo "Set int8 sequence values from 7.1..."
282284

283285
psql -d template1 -At -c "SELECT datname FROM pg_database" |
284286
while read DB
@@ -355,10 +357,11 @@ SET relkind = 'S'
355357
WHERE relname = '$SEQUENCE';
356358
357359
SQL_END
358-
if [ $? -ne 0 ]
359-
then echo "There were errors during int4 sequence restore.
360-
$0 aborted." 1>&2
361-
exit 1
360+
if [ $? -ne 0 ]
361+
then echo "There were errors during int4 sequence restore.
362+
$0 aborted." 1>&2
363+
exit 1
364+
fi
362365
done
363366
done
364367
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy