Skip to content
Permalink
Browse files

Merge pull request #83 from mcarmonaa/fix/siva-repositories-release-l…

…ocation-lock

siva: release location lock rolling back if repository saveVersion fails
  • Loading branch information...
jfontan committed Aug 7, 2019
2 parents 14abcd2 + bbd9b97 commit 63019a4105df3cdd5d32400591e1b4652b9f18e6
Showing with 3 additions and 1 deletion.
  1. +3 −1 siva/repository.go
@@ -13,7 +13,7 @@ import (
)

// ErrRepoAlreadyClosed is returned when a repository opened in RW mode was already closed.
var ErrRepoAlreadyClosed = errors.NewKind("repository % already closed")
var ErrRepoAlreadyClosed = errors.NewKind("repository %s already closed")

// Repository is an implementation for siva files of borges.Repository
// interface.
@@ -108,6 +108,8 @@ func (r *Repository) Commit() error {

err := r.saveVersion()
if err != nil {
// TODO: log the rollback error
_ = r.location.Rollback(r.mode)
return err
}

0 comments on commit 63019a4

Please sign in to comment.
You can’t perform that action at this time.