Skip to content

Conversation

@superzordon
Copy link
Contributor

Fix badger db options for node restarts when hypersyncing.

@superzordon superzordon requested a review from a team as a code owner January 3, 2024 19:59
performanceOptions, err := lib.DbInitializedWithPerformanceOptions(node.Config.DataDirectory)

// If the db options haven't yet been saved, we should base the options on the sync type.
if os.IsNotExist(err) {
Copy link
Member

Choose a reason for hiding this comment

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

Whenever we encounter an annoying bug like this I basically like to leave the post-mortem in a long comment next to the change. Here, I would explain that the reason why you need to save the options to disk is because Badger breaks if you (a) shutdown (b) without closing (c) and then re-open with different options.

The other reason why this is good is it gives us the confidence to delete hacks like this in the future, rather than being scared that we'll break something if we do.

@lazynina lazynina merged commit 83bcaa6 into main Jan 17, 2024
@lazynina lazynina deleted the z/hypersync-db-settings-fix branch January 17, 2024 05:26
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.

4 participants