2009-04-10

Upgrade to 1.5

Subversion 1.6 is out, Subversion 1.4.x is no more supported. Time to upgrade my svn server from 1.4.2 to 1.5.6. The subversion server runs on a Debian GNU/Linux with a 2.6.8-2-386 kernel and apache 2.2.

The procedure is rather straightforward:
  1. Upgrade all clients to 1.5.x. Older clients and servers interoperate transparently with 1.5 servers and clients. However, some of the new 1.5 features may not be available unless both client and server are the latest versio. So it is a good starting point.
  2. Update the subversion tools. On Debian based system, it goes like:
    $ apt-cache showpkg subversion
    Package: subversion
    Versions:
    1.5.6dfsg-1 [...]
    $ apt-get install subversion=1.5.6dfsg-1
    [...]

  3. Update the SVN apache library. There is no need to update apache itself. But upgrading this lib will also install the latest mod_dav_svn module for apache. Although it is not mandatory, it is highly recommended. On Debian based system, it goes like:
    $ apt-cache showpkg libapache2-svn
    Package: libapache2-svn
    Versions:
    1.5.6dfsg-1 [...]
    $ apt-get install libapache2-svn=1.5.6dfsg-1
    [...]
  4. Restart apache (apache2ctl restart).
  5. Make a simple test:
    $ svn --version
    svn, version 1.5.6 (r36142)
    compiled Feb 26 2009, 02:56:32
    [...]
    $ svnadmin --version
    svnadmin, version 1.5.6 (r36142)
    compiled Feb 26 2009, 02:56:32
    [...]
    We are fine.

  6. Add a start-commit hook script to avoid 1.4.x and lower clients to commit to the repository. The repository format has changed, meaning that 1.4 and older versions of Subversion tools that normally access a repository directly (e.g. svnserve, mod_dav_svn, svnadmin...) won't be able to read a repository created by Subversion 1.5 More on this in a future post.

  7. Upgrade the repositories from the 1.4 structure to the 1.5 one. The repository format has changed between the two releases but, repositories are not upgraded automatically. From the subversion 1.5 release notes:
    some of the new 1.5 features will not become available simply by upgrading your server: you will also have to upgrade your repositories.
    . Again, it is straitforward:
    $ svnadmin help upgrade
    [...]Upgrade the repository located at REPOS_PATH to the latest supported
    schema version.[...]
    $svnadmin upgrade REPO_PATH
    [...]
    It is harmless and run in seconds.

  8. Optional: dump and reload the repositories. I've run the following quick test on a repository full of word/pdf documents:
    • du -sh REPO1 -> 402M.
    • svnadmin dump REPO1 > REPO1.dump
    • du -sh REPO1.dump -> 780M.
    • svnadmin create REPO2.
    • cat REPO1.dump | svnadmin load REPO2
    • du -sh REPO2 ->388M
    The same test on a 153M repository full of JAVA, C/C++ sources and a few binary files gave a resulting repository of 102M. Depending on the number of repositories, the size of them, you should consider the dump/load operation. Please note that dumping a repository is very fast but load it can take some time. Consequently, you should probably plan the move outside working hours and bring the repositories down during the operation.
You are done!