Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After indexing a view, its lastSequenceIndexed may be less than db's lastSequence #103

Closed
snej opened this issue Aug 10, 2016 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@snej
Copy link
Contributor

snej commented Aug 10, 2016

As reported in couchbase/couchbase-lite-ios#1379 , after a CBForest view is indexed, the lastSequenceIndexed stored in the view may still be less than the database's lastSequence. This marks the view as not being up to date, so the next time it's queried it will get indexed again (with the same results, if the db hasn't changed.) This is bad for performance.

@snej snej added this to the 1.3.1 milestone Aug 10, 2016
@snej snej added the bug label Aug 10, 2016
@snej
Copy link
Contributor Author

snej commented Aug 10, 2016

The MapReduceIndexer is only updating its last-sequence when it gets called to index a document. So if the last document(s) in sequence order are ones that don't get indexed — like design docs or docs whose docType doesn't match — the last-sequence won't end up equal to the database's last-sequence.

I think the best fix is to stop updating last-sequence every time a document is indexed, but just update it to the database's last-sequence at the end of the indexing, before saving the index metadata.

@snej snej self-assigned this Aug 10, 2016
@snej
Copy link
Contributor Author

snej commented Aug 19, 2016

Fixed by 9c0af6b

@snej snej closed this as completed Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant