Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize revokeSalted by not calling view.List twice #4465

Merged
merged 6 commits into from
May 18, 2018
Merged
Changes from 1 commit
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
13 changes: 10 additions & 3 deletions vault/token_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1214,9 +1214,16 @@ func (ts *TokenStore) revokeSalted(ctx context.Context, saltedID string) (ret er
return errwrap.Wrapf("failed to update child token: {{err}}", err)
}
lock.Unlock()
}
if err = logical.ClearView(ctx, ts.view.SubView(parentPath)); err != nil {
return errwrap.Wrapf("failed to delete entry: {{err}}", err)

// Delete the the child storage entry after we update the token entry Since
// paths are not deeply nested (i.e. they are simply
// parenPrefix/<parentID>/<childID>), we can simply call view.Delete instead
// of view.ClearView
index := parentPath + child
err = ts.view.Delete(ctx, index)
if err != nil {
return errwrap.Wrapf("failed to delete child entry: {{err}}", err)
}
}

// Now that the entry is not usable for any revocation tasks, nuke it
Expand Down