Initialize in-memory writer from disk backup #128
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.
Hello! First of all, thanks for the awesome library and all the hard work on search in Go ecosystem.
We are using in-memory Bluge index. We also have a separate event stream with changes in the system. On application start we do initial indexing from the database and consume event stream to keep the index actual (starting from event ID known before initial indexing).
One thing we want to improve is a time since application start till possibility to use index. So the idea is to do index backups periodically (using
Reader.Backup
API), and then use the backup on start to initialize initial state for in-memory only index (applying missing updates from the event stream). Similar to Redis RDB periodic snapshots (but we can still catch up to the actual state using our event log).This way we can reduce startup time from ~20s to ~1s.
This pull request contains changes which allow starting in-memory index using on-disk backup. It seems to work and provided test is passing. But to be honest I am not sure I fully understand how Bluge works internally and whether this approach makes sense in terms of correctness. I spent some time reading code - but I am still in a position where I need help from someone who understands internals, so trying to validate an idea here.
Having said this all, a couple of questions:
Reader.Backup
call, but then switching to a fully in-memory index implementation.