Skip to content

Fix dreyfus/clouseau purging#5918

Open
nickva wants to merge 2 commits intomainfrom
fix-dreyfus-purgeseq-tracking
Open

Fix dreyfus/clouseau purging#5918
nickva wants to merge 2 commits intomainfrom
fix-dreyfus-purgeseq-tracking

Conversation

@nickva
Copy link
Contributor

@nickva nickva commented Mar 9, 2026

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.

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.

nickva added 2 commits March 9, 2026 17:33
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.
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.

1 participant