Skip to content

Commit

Permalink
journal: do not return errors from remove omap func if omap missing
Browse files Browse the repository at this point in the history
The previous function used to remove omap keys apparently did not
return errors when removing omap keys from a missing omap (oid).
Mimic that behavior when using the api.

Signed-off-by: John Mulligan <[email protected]>
  • Loading branch information
phlogistonjohn committed Jun 15, 2020
1 parent 51b1245 commit d71166f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions internal/journal/omap.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,25 @@ func removeMapKeys(
}

err = ioctx.RmOmapKeys(oid, keys)
if err != nil {
klog.Errorf(
util.Log(ctx, "failed removing omap keys (pool=%q, namespace=%q, name=%q): %v"),
poolName, namespace, oid, err)
} else {
switch err {
case nil:
klog.V(4).Infof(
util.Log(ctx, "removed omap keys (pool=%q, namespace=%q, name=%q): %+v"),
poolName, namespace, oid, keys)
case rados.ErrNotFound:
// the previous implementation of removing omap keys (via the cli)
// treated failure to find the omap as a non-error. Do so here to
// mimic the previous behavior.
klog.V(4).Infof(
util.Log(ctx, "when removing omap keys, omap not found (pool=%q, namespace=%q, name=%q): %+v"),
poolName, namespace, oid, keys)
default:
klog.Errorf(
util.Log(ctx, "failed removing omap keys (pool=%q, namespace=%q, name=%q): %v"),
poolName, namespace, oid, err)
return err
}
return err
return nil
}

func setOMapKeys(
Expand Down

0 comments on commit d71166f

Please sign in to comment.