-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalidate view indexes when documents are purged
After a document is purged, view indexes may contain obsolete rows that were emitted by that document. If the doc is still in ForestDB's tree, the right things will happen -- the fdb_del() call incremented the db's lastSequence, triggering a view index update, and the deleted doc will be enumerated and have its rows removed. But if the doc has already been removed from ForestDB's tree, the indexer won't see it at all and won't know to remove the obsolete rows. The fix is based on what CouchDB does: we store a purgeCount in the db which is incremented after every database compaction that purges deleted docs. A view index also saves the current db purgeCount. If the purgeCount has increased, the index is obsolete and needs to be erased and rebuilt. In the process of fixing this I also found some bugs in the C API where deleted/purged docs weren't being handled properly: they were skipped entirely, when they should be passed to the indexer even though the client app doesn't map them. Fixed. Fixes #1164
- Loading branch information
Showing
15 changed files
with
256 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.