Skip to content

Fix dreyfus/clouseau purging#5918

Merged
nickva merged 2 commits intomainfrom
fix-dreyfus-purgeseq-tracking
Mar 11, 2026
Merged

Fix dreyfus/clouseau purging#5918
nickva merged 2 commits intomainfrom
fix-dreyfus-purgeseq-tracking

Conversation

@nickva
Copy link
Copy Markdown
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.

Make sure we call `maybe_create_local_purge_doc(Db, Pid, Index)` with the still
opened `Db` not after we close it.
@nickva nickva force-pushed the fix-dreyfus-purgeseq-tracking branch from 875cae6 to 4178a75 Compare March 11, 2026 02:09
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.
@nickva nickva force-pushed the fix-dreyfus-purgeseq-tracking branch from 4178a75 to c853aef Compare March 11, 2026 03:20
@nickva nickva merged commit ab6bd03 into main Mar 11, 2026
60 checks passed
@nickva nickva deleted the fix-dreyfus-purgeseq-tracking branch March 11, 2026 04:24
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.

2 participants