Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion solver/bboltcachestorage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,28 @@ func (s *Store) emptyBranchWithParents(tx *bolt.Tx, id []byte) error {
if backlinks := tx.Bucket([]byte(backlinksBucket)).Bucket(id); backlinks != nil {
if err := backlinks.ForEach(func(k, v []byte) error {
if subLinks := tx.Bucket([]byte(linksBucket)).Bucket(k); subLinks != nil {
// Perform deletion outside of the iteration.
// https://github.com/etcd-io/bbolt/pull/611
var toDelete []string
if err := subLinks.ForEach(func(k, v []byte) error {
parts := bytes.Split(k, []byte("@"))
if len(parts) != 2 {
return errors.Errorf("invalid key %s", k)
}
if bytes.Equal(id, parts[1]) {
return subLinks.Delete(k)
toDelete = append(toDelete, string(k))
}
return nil
}); err != nil {
return err
}

for _, k := range toDelete {
if err := subLinks.Delete([]byte(k)); err != nil {
return err
}
}

if isEmptyBucket(subLinks) {
if subResult := tx.Bucket([]byte(resultBucket)).Bucket(k); isEmptyBucket(subResult) {
if err := tx.Bucket([]byte(linksBucket)).DeleteBucket(k); err != nil {
Expand Down