Getting started with Pack Repository Jobs

Applies to: VisualSVN Server 4.1 and later

Pack Repository jobs can be used to perform scheduled packing of the Subversion repositories in background. Packing reduces the number of files on disk and therefore reduces storage and maintenance overhead. This article describes how to create and manage Pack Repository jobs and how to examine the results of their work.

What is repository packing

Subversion repositories use a simple approach to store the incoming data where every new revision gets written to a separate on-disk file. Internally, these files are organized into separate directories called shards. By default, every shard contains up to 1,000 files. Once the shard fills up, a new shard is created automatically.

While this on-disk layout provides great overall versatility, it also has a couple of drawbacks:

  • For large repositories containing hundreds of thousands of revisions, having an equal number of files increases the amount of time necessary for various maintenance and organizational operations — for example, backup, restore or transferring the repositories between servers.
  • This on-disk layout may also result in an increased disk space consumption. The disk space is usually allocated with a file system cluster granularity. On a volume with a 4 KB cluster, the actual space taken by the files may be for example 4 or 8 KB, but not something in between. For every file size in between, there is an amount of wasted disk space, and having more files essentially increases the chances of wasting the space.

Both of these drawbacks may be eliminated by packing the repositories. During the pack operation, every filled repository shard is combined into a single file, therefore reducing the number of files proportionally to the sharding factor of a repository. For example, a repository containing 2,000 revision files will only consist of 2 pack files after packing.

Tip
Repository packing is available starting from repository FSFS format 4 (Subversion 1.6). If your repositories have a format version older than 4, you should upgrade your repositories to enable repository packing. See the article KB142: Upgrading the filesystem format of a repository for repository format upgrade instructions.

How repository packing works

When the repository was never packed before, and the Pack Repository job starts for the first time, it packs all revisions into pack files each (by default) containing 1000 revisions.

Note
If the repository is very large and contains many revisions, the first Repository Pack Job run can take a considerable amount of time.

When the repository had been already packed before and now it contains 1000 revisions that have not yet been concatenated into a pack, the Repository Pack Job will pack them into a new pack file. If there is now less than 1000 non-packed revisions, the job will do nothing.

Subversion repositories that use FSFS format 7 (Subversion 1.9) can be packed in a hot mode meaning that packing can be performed on live repositories of a production server without causing any disruption. If you have repositories with FSFS format 6 or older, it is recommended to upgrade repositories format. See the article KB142: Upgrading the filesystem format of a repository for repository format upgrade instructions.

Note
When repository packing and repository backup jobs overlap, the backup potentially will not be created at that time (but this will not cause repository corruption and will not create a corrupted backup). However, we strongly recommend to schedule the Pack Repository Jobs and Backup Repository Jobs at different times so that they do not overlap.

Creating Pack Repository Jobs

You can add a scheduled Pack Repository job using the corresponding wizard in the VisualSVN Server Manager console:

  1. Right-click the Jobs element in the VisualSVN Server Manager console.
  2. Click New | Pack Repository Job.
  3. Name the job and optionally provide a description for it. Click Next.
  4. Choose which repositories will be packed by the new job. Click Next.
  5. Choose time and days of the week when it should run. Click Next.
  6. Click Create.
  7. Click Finish.

The new job will be created and will run according to schedule.

Managing Pack Repository Jobs

Every configured job, including Pack Repository jobs, are shown within the Jobs element in VisualSVN Server Manager. For each job you can see its name, type, status and the result of the last run. The pack repository jobs will have their type displayed as Pack repository.

The current state of the job is shown in the Status column. Possible values are the following:

  • Ready. The job is in standby mode. It is active and ready to start.
  • Running. The job is running right now.
  • Disabled. The job is deactivated and will not run on its schedule.

The result of the last run is shown in the Last Run column. Possible values are the following:

  • Success. The packing process has completed successfully.
  • Error. At least one error occurred during the packing process.
  • Interrupted. The running job has been interrupted and did not complete.

The last run status of the job is also indicated by the overlay icon near its name. As an example, a warning overlay icon will be displayed if the job's last run was interrupted.

Additionally, the Last Run Details column contains brief information about the outcome of the job's last run. You can see the following string: Successfully processed 10 repositories (2 repositories packed) — it means that ten repositories were processed, and only two of them required packing and were packed.

To manage pack repository jobs, you can use the context menu commands, such as Run, End, or Disable. You can also manage them using the PowerShell cmdlets: Get-SvnJob, Start-SvnJob, Stop-SvnJob, Enable-SvnJob and Disable-SvnJob. For more information about the PowerShell cmdlets, read the article KB88: VisualSVN Server PowerShell Cmdlet Reference.

See also

KB157: Understanding background jobs scheduling
KB185: Understanding Background Job notifications
KB135: Understanding the Subversion repository types and formats

Last Modified: