Open
Conversation
Make sure we call `maybe_create_local_purge_doc(Db, Pid, Index)` with the still opened `Db` not after we close it.
Issue: #5916 Previously, `dreyfus_index_updater:purge_index/3`, updated the final purge_seq from the last value seen in the accumulator. When there is nothing to purge that will be the initial accumulator purge_seq value = 0, which is wrong. For example, if the minimum purge sequence is 12 and current purge sequence is 42, resetting the value back to 0 would mean the users would get an exception like `{invalid_start_purge_seq, 0, 12}` every time they update the index. To the purge system this looks like the "client" (the search index) has missed processing some purges and is now out of sync with the main database. To fix the issue we do what nouveau does, and set the index purge sequence based on the current database purge sequence, instead of getting it from the accumulator. As a side-effect, we simplify the fold function a bit, since we don't have to track the purge sequence inside.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue: #5916
Previously,
dreyfus_index_updater:purge_index/3updated the final purge_seq from the last value seen in the accumulator. When there is nothing to purge that will be the initial accumulator purge_seq value = 0, which is wrong.For example, if the minimum purge sequence is 12 and current purge sequence is 42, resetting the value back to 0 would mean the users would get an exception like
{invalid_start_purge_seq, 0, 12}every time they update the index. To the purge system this looks like the "client" (the search index) has missed processing some purges and is now out of sync with the main database.To fix the issue we do what nouveau does, and set the index purge sequence based on the current database purge sequence, instead of getting it from the accumulator. As a side-effect, we simplify the fold function a bit, since we don't have to track the purge sequence inside.
As a separate commit, a minor correctness fix to make sure we don't operate on a closed database. Previously we we closed the db then then tried to use to open/write the checkpoint file.