storage: Use timeout for boltdb database opening #3148
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
To dump the DB, the service must be stopped. If this is not the case
dump
command just hangs without any output.This may be unexpected from the ops POV (hello, @532910).
Solution
Introduce timeout for bbolt db open. I have decided not to put it in the configuration, because 5 seconds is more than enough, given that flock retry is 50 milliseconds
https://github.com/etcd-io/bbolt/blob/db45d0d6b1f6d173baad00019fdc7c58ad0ab002/db.go#L19
https://github.com/etcd-io/bbolt/blob/db45d0d6b1f6d173baad00019fdc7c58ad0ab002/db.go#L222
Do you think this is worth having in the configuration (like I dump and then stop the service and expect dump to work for such a usecase)?