Skip to content

Support alternates in transactions

Sami Hiltunen requested to merge smh-snapshot-alternate into master

Repositories are linked to object pools via the 'objects/info/alternates' file. Currently there's no way to stage an update to the alternates file in a transaction. This commit adds support for staging an update which allows for either setting an alternate or removing an existing. Basic consistency checks are done to prevent relinking repositories that already have an alternate and unlinking repositories that don't have one.

In addition, the transactions don't currently include a repository's alternate in the snapshot. Snapshotting a repository without its object pool may end up snapshotting the repository in a corrupt state as some of the objects the repository needs were in the alternate and not available in the snapshot. This MR adds snapshotting support for pooled repositories. After snapshotting the transaction's target repository, the snapshotted repository's alternates file is read. If it contains a path, the pointed to repository is also included in the transaction's snapshot. As the repositories are stored in the snapshot at their original relative paths, the relative path in the alternates file will point to the pool also in the snapshot without requiring us to rewrite the path.

Merge request reports