Skip to content

Instantly share code, notes, and snippets.

@justinmassiot
Last active December 15, 2023 09:29
Show Gist options
  • Save justinmassiot/706689e5d132bc2702c85522da8f0a08 to your computer and use it in GitHub Desktop.
Save justinmassiot/706689e5d132bc2702c85522da8f0a08 to your computer and use it in GitHub Desktop.

Subversion data format and revisions

Introduction

Each repository follows a repository format and a data store format.

Repository format (schema)

SUBVERSION VERSION NUMBER SCHEMA VERSION
Up to and including 0.27 1
0.28 - 0.33.1 2
0.34 - 1.3 3
(no released version used this) 4
1.4 - 5

Source: https://svn.apache.org/repos/asf/subversion/trunk/notes/repos_upgrade_HOWTO

Data store format

FSFS is used as the default data store since Subversion 1.2. Before that, Berkeley DB (BDB) was used by default.
More info about the FSFS structure can be found here: https://svn.apache.org/repos/asf/subversion/trunk/subversion/libsvn_fs_fs/structure

FSFS format Compatible with Summary
1 Subversion 1.1+ The very first release of FSFS repository backend and the first FSFS filesystem format.
2 Subversion 1.4+ Introduced compression for the data stored in the repository.
3 Subversion 1.5+ Introduced the merge tracking and the sharded repository layout.
4 Subversion 1.6+ Introduced repository packing and representation sharing (i.e. data deduplication).
6 Subversion 1.8+ Extended the repository packing feature to also pack revision properties.
7 Subversion 1.9+ Introduced logical revision content addressing and several optional performance-related configuration options.
8 Subversion 1.10+ Introduced LZ4 compression.

Source: https://www.visualsvn.com/support/topic/00135/#FilesystemFormat

Which format is used by my repositories?

Since Subversion 1.9, you can get both the repository format and the data store format with a single command executed on the server side:

svnadmin info MyRepo

Which gives, for example:

Path: MyRepo
UUID: 1fd1a4d4-5b13-11ee-b3b5-690c71163c99
Revisions: 733
Repository Format: 5
Compatible With Version: 1.6.0
Repository Capability: mergeinfo
Filesystem Type: fsfs
Filesystem Format: 4
FSFS Sharded: yes
FSFS Shard Size: 1000
FSFS Shards Packed: 0/0
FSFS Logical Addressing: no
Configuration File: MyRepo/db/fsfs.conf

More info: https://subversion.apache.org/docs/release-notes/1.9.html#fsfs-improvements

Upgrade instructions

The normal procedure to upgrade a repository to the newest format is to dump then load the full repository.
Source 1: https://svnbook.red-bean.com/en/1.8/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate.svnadmin\ Source 2: https://svn.apache.org/repos/asf/subversion/trunk/notes/repos_upgrade_HOWTO

But there is also a fast track upgrade procedure, even if it is not officially recommended.
This special command seems to upgrade both the repository format and the data store format.

svnadmin help upgrade gives the following info:

upgrade: usage: svnadmin upgrade REPOS_PATH

Upgrade the repository located at REPOS_PATH to the latest supported
schema version.

This functionality is provided as a convenience for repository
administrators who wish to make use of new Subversion functionality
without having to undertake a potentially costly full repository dump
and load operation.  As such, the upgrade performs only the minimum
amount of work needed to accomplish this while still maintaining the
integrity of the repository.  It does not guarantee the most optimized
repository state as a dump and subsequent load would.

Real life example: svnadmin upgrade

> svnadmin info MyRepo/
Path: MyRepo
UUID: 1fd1a4d4-5b13-11ee-b3b5-690c71163c99
Revisions: 733
Repository Format: 5
Compatible With Version: 1.6.0
Repository Capability: mergeinfo
Filesystem Type: fsfs
Filesystem Format: 4
FSFS Sharded: yes
FSFS Shard Size: 1000
FSFS Shards Packed: 0/0
FSFS Logical Addressing: no
Configuration File: MyRepo/db/fsfs.conf

> svnadmin upgrade MyRepo
Repository lock acquired.
Please wait; upgrading the repository may take some time...
Bumped repository format to 8

Upgrade completed.

> svnadmin info MyRepo/
Path: MyRepo
UUID: 1fd1a4d4-5b13-11ee-b3b5-690c71163c99
Revisions: 733
Repository Format: 5
Compatible With Version: 1.10.0
Repository Capability: mergeinfo
Filesystem Type: fsfs
Filesystem Format: 8
FSFS Sharded: yes
FSFS Shard Size: 1000
FSFS Shards Packed: 0/0
FSFS Logical Addressing: no
Configuration File: MyRepo/db/fsfs.conf

Real life example: svnadmin dump & svnadmin load

# change the name of the existing repo
mv MyRepo MyRepo_bak
# create a dump
svnadmin dump MyRepo_bak > dumpfile
# create a new repo from scratch
svnadmin create MyRepo
# load the dump, keep the UUID
svnadmin load --force-uuid MyRepo < dumpfile
# also copy the hooks and config
cp MyRepo_bak/hooks/* MyRepo/hooks/
cp MyRepo_bak/conf/* MyRepo/conf
# change the files owner if needed
chown -R <svnowner>:<svnowner> MyRepo
# delete the dump
rm dumpfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment