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

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

* changelog

* Update changelog/16686.txt

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
This commit is contained in:
Jason O'Donnell 2022-08-11 16:22:53 -04:00 committed by GitHub
parent eed4bdb050
commit c97b982043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -537,7 +537,7 @@ func (b *databaseBackend) initQueue(ctx context.Context, conf *logical.BackendCo
}
walID, err := framework.PutWAL(ctx, conf.StorageView, staticWALKey, &setCredentialsWAL{RoleName: "vault-readonlytest"})
if walID != "" {
if walID != "" && err == nil {
defer framework.DeleteWAL(ctx, conf.StorageView, walID)
}
switch {

3
changelog/16686.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
secrets/database: Fix a bug where the secret engine would queue up a lot of WAL deletes during startup.
```