On 8/21/2013 7:13 PM, Geoff Field wrote:> I'm keeping the original BDB
repositories, with read-only permissions.
> If I really have the need, I can restart Apache 2 with SVN 1.2.3 and
> go back to the original repositories. Otherwise, I also have the
> option of re-running my batch file (modifying it if absolutely
> required). On top of that, there are bunches of files on another
> server that give us at least the latest state of the projects. The
> dump files in this case are not really as useful as the data itself.
> Regards, Geoff
>
When we did our 1.6 to 1.8 upgrade a few weeks ago, I used the following
steps (ours was an in-place upgrade, so a bit of extra checking was added):
0. Back everything up, twice.
1. Check the version of the repository to see whether it is already 1.8
BASE='/var/svn/'
TARGET='/backup/svndump/'
DIR='somereponame'
SVNADMIN=/path/to/svnadmin
REPOFMT=`grep '^[123456]$' ${BASE}${DIR}/db/format`
echo "FSVS database format is $REPOFMT"
if [ $REPOFMT -ge 6 ]; then
echo "Format >= 6, not upgrading."
continue
fi
Note: That was a quick-n-dirty check that was valid for our
configuration. To be truly correct, you need to verify:
reponame/format
reponame/db/fs-type
reponame/db/format
2. Strip permissions on the original repo down to read-only.
3. Ran "svnadmin verify" on the original repository.
echo "Run svnadmin verify..."
$SVNADMIN verify --quiet ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin verify failed with status: $status"
continue
else
echo "svnadmin verify succeeded"
fi
4. Do the "svnadmin dump", piping the output into gzip -5 (moderate
compression).
echo "svnadmin dump..."
$SVNADMIN dump --quiet ${BASE}${DIR} | gzip -5 --rsyncable >
${TARGET}${DIR}.dump.gz
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin dump failed with status: $status"
continue
fi
5. Remove the old repository directory.
echo "Remove old repository (dangerous)"
rm -rf ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "remove failed with status: $status"
continue
fi
6. Create the repository in svn 1.8.
echo "Recreate repository with svnadmin"
$SVNADMIN create ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin create failed with status: $status"
continue
fi
7. Strip permissions on the repository back down to 700, owned by
root:root while we reload the data.
8. Fix the db/fsfs.conf file to take advantage of new features.
Note: Make sure you understand what enable-dir-deltification,
enable-props-deltification and enable-rep-sharing do. Some of these are
not turned on in SVN 1.8 by default.
echo "Fix db/fsfs.conf file"
sed 's/^[#[:space:]]*enable-rep-sharing =
false[#[:space:]]*$/enable-rep-sharing =
true/g;s/^[#[:space:]]*enable-dir-deltificati
on = false[#[:space:]]*$/enable-dir-deltification =
true/g;s/^[#[:space:]]*enable-props-deltification =
false[#[:space:]]*$/enable-p
rops-deltification = true/g' --in-place=.bkp ${BASE}${DIR}/db/fsfs.conf
status=$?
if [ $status -ne 0 ]; then
echo "sed adjustment of db/fsfs.conf failed with status: $status"
continue
fi
9. Load the repository back from the dump file.
echo "svnadmin load..."
gzip -c -d ${TARGET}${DIR}.dump.gz | $SVNADMIN load --quiet ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin load failed with status: $status"
continue
fi
10. Run "svnadmin pack" to pack revs/revprops files (saves on inodes).
echo "svnadmin pack..."
$SVNADMIN pack --quiet ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin pack failed with status: $status"
continue
fi
11. Run "svnadmin verify".
echo "Run svnadmin verify..."
$SVNADMIN verify --quiet ${BASE}${DIR}
status=$?
if [ $status -ne 0 ]; then
echo "svnadmin verify failed with status: $status"
continue
else
echo "svnadmin verify succeeded"
fi
12. Restore original permissions.
Note: I have a custom script that I can run to set permissions correctly
on our repository directories. I never set file system permissions by
hand on the repositories, I always update the script and then use that.
(With a few hundred repositories, I have to be organized and rely on
scripts.)
13. Back everything up again, twice.
All-in-all, it took us a few days to convert 110GB of repositories
(mostly in 1.6 format), but the resulting size was only 95GB and far
fewer files (due to revprops packing in 1.8). Our nightly backup window
went from about 3 hours, down to 30 minutes from using "svnadmin hotcopy
--incremental". When then use rdiff-backup to push the hotcopy
directory to a backup server.
Received on 2013-08-22 17:26:00 CEST