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

Primary caching 18: range invalidation (ENABLED BY DEFAULT 🎊) #4853

Merged
merged 8 commits into from Jan 23, 2024

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Jan 18, 2024

Implement range invalidation and do a quality pass over all the size tracking stuff in the cache.

Range caching is now enabled by default!


Part of the primary caching series of PR (index search, joins, deserialization):


Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@teh-cmc teh-cmc added 🔍 re_query affects re_query itself 📉 performance Optimization, memory use, etc do-not-merge Do not merge this PR exclude from changelog PRs with this won't show up in CHANGELOG.md labels Jan 18, 2024
crates/re_query_cache/src/cache.rs Outdated Show resolved Hide resolved
crates/re_query_cache/src/cache.rs Outdated Show resolved Hide resolved
crates/re_query_cache/src/flat_vec_deque.rs Show resolved Hide resolved
Copy link
Member Author

Choose a reason for hiding this comment

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

Exact same test suite as in tests/latest_at.rs but with range queries instead.

@@ -65,7 +65,7 @@ impl Default for AppOptions {
experimental_additive_workflow: cfg!(debug_assertions),

experimental_primary_caching_latest_at: true,
experimental_primary_caching_range: false,
experimental_primary_caching_range: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

🥳

teh-cmc added a commit that referenced this pull request Jan 23, 2024
Range queries used to A) return the frame a T-1, B) accumulate state
starting at T-1 and then C) yield frames starting at T.

A) was a huge issue for many reasons, which #4793 took care of by
eliminating both A) and B).

But we need B) for range queries to be context-free, i.e. to be
guaranteed that `Range(5, 10)` and `Range(4, 10)` will return the exact
same data for frame `5`.
This is crucial for multi-tenant settings where those 2 example queries
would share the same cache.

It also is the nicer-nicer version of the range semantics that we wanted
anyway, I just didn't realize back then that it would require so little
changes, or I would've gone straight for that.

---

Part of the primary caching series of PR (index search, joins,
deserialization):
- #4592
- #4593
- #4659
- #4680 
- #4681
- #4698
- #4711
- #4712
- #4721 
- #4726 
- #4773
- #4784
- #4785
- #4793
- #4800
- #4851
- #4852
- #4853
- #4856
@teh-cmc teh-cmc force-pushed the cmc/primcache_17_timeless_range branch from f9f71a7 to 5cfbb47 Compare January 23, 2024 16:45
Base automatically changed from cmc/primcache_17_timeless_range to main January 23, 2024 16:46
teh-cmc added a commit that referenced this pull request Jan 23, 2024
Simply add a timeless path for the range cache, and actually only
iterate over the range the user asked for (we were still blindly
iterating over everything until now).

Also some very minimal clean up related to #4832, but we have a long way
to go...
- #4832

---

- Fixes #4821 

---

Part of the primary caching series of PR (index search, joins,
deserialization):
- #4592
- #4593
- #4659
- #4680 
- #4681
- #4698
- #4711
- #4712
- #4721 
- #4726 
- #4773
- #4784
- #4785
- #4793
- #4800
- #4851
- #4852
- #4853
- #4856
@teh-cmc teh-cmc force-pushed the cmc/primcache_18_range_invalidation branch from 45f8d62 to 890dada Compare January 23, 2024 16:47
@teh-cmc teh-cmc merged commit 36446b6 into main Jan 23, 2024
21 of 31 checks passed
@teh-cmc teh-cmc deleted the cmc/primcache_18_range_invalidation branch January 23, 2024 16:48
@teh-cmc teh-cmc removed the do-not-merge Do not merge this PR label Jan 23, 2024
teh-cmc added a commit that referenced this pull request Jan 23, 2024
- Quick sanity pass over all the intermediary locks and refcounts to
make sure we don't hold anything for longer than we need.
- Get rid of all static globals and let the caches live with their
associated stores in `EntityDb`.
- `CacheKey` no longer requires a `StoreId`.

---

- Fixes #4815 

---

Part of the primary caching series of PR (index search, joins,
deserialization):
- #4592
- #4593
- #4659
- #4680 
- #4681
- #4698
- #4711
- #4712
- #4721 
- #4726 
- #4773
- #4784
- #4785
- #4793
- #4800
- #4851
- #4852
- #4853
- #4856
@teh-cmc teh-cmc removed the exclude from changelog PRs with this won't show up in CHANGELOG.md label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include in changelog 📉 performance Optimization, memory use, etc 🔍 re_query affects re_query itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Primary cache: range invalidation Query caching for "sticky" scenes (plots, text logs...)
2 participants