Skip to content

Index-Free: Only exclude limit queries if last document changed #737

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

Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Aug 26, 2019

Instead of not using Index-Free queries for all limit queries with modified documents, we can take advantage of the fact that documents edit that don't affect the boundary (last document) don't cause other documents from cache to suddenly fall into the limit.

// limit. If the last document was edited after the query was last synchronized, there is a
// chance that another document from cache sorts higher, in which case we have to perform a full
// cache scan.
Comparator<Document> comparator = query.comparator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't really explain why only the last document matters and it took me a while to reason it through.

Maybe add a paragraph explaining why changes to documents that are not the last document don't matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Can you take another look?

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Aug 27, 2019
@schmidt-sebastian schmidt-sebastian force-pushed the mrschmidt/indexfree-order branch from 2861847 to d583283 Compare August 27, 2019 17:05
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wilhuff wilhuff removed their assignment Aug 27, 2019
@schmidt-sebastian schmidt-sebastian merged commit eb702be into mrschmidt/indexfree-master Aug 27, 2019
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/indexfree-order branch August 27, 2019 23:44
@firebase firebase locked and limited conversation to collaborators Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants