Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4d151d0

Browse files
committed
More improvements; still disabled. (Don't panic.)
1 parent92a2598 commit4d151d0

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

‎src/bin/pg_dump/pg_upgrade

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.20 2002/01/09 21:50:52 momjian Exp $
6+
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/pg_upgrade,v 1.21 2002/01/10 03:05:48 momjian Exp $
77
#
88
# NOTE: we must be sure to update the version-checking code a few dozen lines
99
# below for each new PostgreSQL release.
@@ -164,7 +164,7 @@ fi
164164

165165
# Now vacuum each result database in case our transaction increase
166166
# causes all the XID's to be marked with the frozen XID.
167-
psql -l|whileread DB
167+
psql -d template1 -At -c"SELECT datname FROM pg_database"|whileread DB
168168
do
169169
echo"VACUUM;"| psql"$DB"
170170
if [$?-ne 0 ]
@@ -179,12 +179,16 @@ pg_dumpall -s > $TMPFILE 2>/dev/null
179179

180180
# flush buffers to disk
181181
pg_ctl stop
182+
if ["$?"-ne 0 ]
183+
thenecho"Unable to stop database server.; exiting"1>&2
184+
exit 1
185+
fi
182186

183187
echo"Commit fixes complete, moving data files..."
184188

185189
cat"$SCHEMA"|whileread LINE
186190
do
187-
if /bin/echo"$LINE"| grep -q"^\\\\connect"
191+
if /bin/echo"$LINE"| grep -q"^\\\\connect[^]*$"
188192
thenOLDDB="$DB"
189193
DB="`/bin/echo\"$LINE\"| cut -d'' -f2`"
190194
if ["$DB"="-" ]
@@ -251,19 +255,37 @@ do
251255
fi
252256
done
253257

254-
# set max transaction id, check < 2gig
255-
256258
# 7.1 has non-compressed log file format
257259
if ["$SRCVERSION"="7.1" ]
258-
# pg_log is oid 1269 in 7.1
259-
LOGSIZE=`ls -l"$OLDDIR"/global/1269"$OLDDIR"/global/1269.*2>/dev/null|
260-
awk -F' *''
261-
BEGIN {sum=0;}
262-
{sum += $5;}
263-
END{print sum;}'`
260+
then
261+
# pg_log is oid 1269 in 7.1
262+
LOGSIZE=`ls -l"$OLDDIR"/global/1269"$OLDDIR"/global/1269.*2>/dev/null|
263+
awk -F' *''
264+
BEGIN {sum=0;}
265+
{sum += $5;}
266+
END{print sum;}'`
267+
268+
# check < 2gig
269+
270+
# set max transaction id
271+
272+
else
273+
# how to handle 7.2?
274+
rm -r data/pg_clog&&
275+
mv"$OLDDIR"/data/pg_clog data/pg_clog&&
276+
mv"$OLDDIR"/data/global/pg_control data/global/pg_control
277+
if ["$?"-ne 0 ]
278+
thenecho"Moving of transaction and control files failed.; exiting"1>&2
279+
exit 1
280+
fi
281+
fi
282+
283+
pg_ctl start
284+
if ["$?"-ne 0 ]
285+
thenecho"Unable to restart database server.; exiting"1>&2
286+
exit 1
264287
fi
265288

266-
echo"You must stop/start the postmaster before doing anything else."
267289
echo"You may remove the$OLDDIR directory with 'rm -r$OLDDIR'."
268290

269291
exit 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp