Apply pending WAL when transactions are disabled
If transactions were enabled but have subsequently been disabled,
interrupted WAL application could have left repositories in bad
states. For example, it could be that the old packed-refs
file
was removed but the new not yet linked in place. This would leave
the repository missing references.
To ensure the repositories are whole even after transactions are disabled, this MR implements a middleware that on first access to a repository checks whether it was already assigned to a partition, and if so, start a transaction against the partition to ensure all WAL has been applied. The transaction is then rolled back and the access proceeds in a non-transactional manner as transactions are disabled. This ensures transactions are safe to disable and repositories are not left in bad states. After the partition has been recoverd, all further access to the repositories in it proceed non-transactionally.
Closes Make it safe to disable transactions (#6147 - closed)