Skip to content

Commit

Permalink
fix(remove): don't fail if remove encounters an issue traversing qfs …
Browse files Browse the repository at this point in the history
…history

this is a bit of a stop-gap for now, but users are seeing bad errors when dataset histories aren't fully persisted & they attempt to delete. This may end up causing stray-pinning, and the long-term solution for that is to use logbook for this remove task. We can also use logbook to identify stray pins & reclaim the space

closes #989
  • Loading branch information
b5 committed Nov 5, 2019
1 parent 53e654b commit f842273
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 8 additions & 3 deletions base/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ func RemoveNVersionsFromStore(ctx context.Context, r repo.Repo, ref *repo.Datase
for i != 0 {
// decrement our counter
i--
// unpin dataset
if err = UnpinDataset(ctx, r, curr); err != nil {
// unpin dataset, ignoring "not pinned" errors
if err = UnpinDataset(ctx, r, curr); err != nil && !strings.Contains(err.Error(), "not pinned") {
return err
}
// if no previous path, break
Expand All @@ -316,7 +316,12 @@ func RemoveNVersionsFromStore(ctx context.Context, r repo.Repo, ref *repo.Datase
// load previous dataset into prev
next, err := dsfs.LoadDatasetRefs(ctx, r.Store(), curr.Dataset.PreviousPath)
if err != nil {
return err
// Note: We want delete to succeed even if datasets are remote, so we don't fail on
// this error, and break early instead
// TODO (b5) - removing dataset versions should rely on logbook, which is able
// to traverse across missing datasets in qfs
log.Debugf("error fetching previous: %s", err)
break
}
curr = repo.DatasetRef{
Path: next.Path,
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ require (
github.com/microcosm-cc/bluemonday v1.0.2
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/mitchellh/go-homedir v1.1.0
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mr-tron/base58 v1.1.2
github.com/multiformats/go-multiaddr v0.1.1
github.com/multiformats/go-multicodec v0.1.6
Expand Down

0 comments on commit f842273

Please sign in to comment.