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

secret/database: fix bug where too many wal deletes are deferred #16686

Merged
merged 3 commits into from Aug 11, 2022

Conversation

jasonodonnell
Copy link
Contributor

@jasonodonnell jasonodonnell commented Aug 11, 2022

This fixes a small bug in the initQueue function where a WAL write test is performed prior to starting the database secret engine caused a lot of delete wal calls to be queued. To fix the bug we simply check if there is also no error after writing WAL.

When Vault is starting up, its storage is read only, so writes will produce an error. The current code checks if a WAL ID is returned after calling PutWal, but this function always returns a WAL ID so it defers a delete call. Since an error is also returned, it then loops and tries again. If start up is taking an excessive amount of time, this bug will queue up a delete wal every 10ms until Vault's storage accepts writes. This is amplified if you have many database secret engines.

@jasonodonnell jasonodonnell added this to the 1.11.3 milestone Aug 11, 2022
@jasonodonnell jasonodonnell requested a review from a team August 11, 2022 18:23
Copy link
Member

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. +1 on eventually fixing up PutWAL.

changelog/16686.txt Outdated Show resolved Hide resolved
Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants