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

Fix missing data for "bridged" range queries #6177

Merged
merged 4 commits into from
May 3, 2024
Merged

Fix missing data for "bridged" range queries #6177

merged 4 commits into from
May 3, 2024

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Apr 30, 2024

A cheap fix for #5686, both in terms of added code and runtime performance, as it only kicks in in very particular circumstances.
The test added in this PR explains the situation better than words ever could.

The proper solution here would to implement proper bucketing in the range cache (#4810), but that's a much bigger change that I don't want to get into until after the upcoming drastic changes to the datastore.

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
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@teh-cmc teh-cmc added 🪳 bug Something isn't working 🔍 re_query affects re_query itself exclude from changelog PRs with this won't show up in CHANGELOG.md labels Apr 30, 2024
@teh-cmc teh-cmc marked this pull request as ready for review April 30, 2024 17:24
crates/re_query/src/range/query.rs Show resolved Hide resolved
Comment on lines +69 to +72
let hole_start = time_range.max();
let hole_end =
TimeInt::new_temporal(query.range().min().as_i64().saturating_sub(1));
if hole_start < hole_end {
Copy link
Member

Choose a reason for hiding this comment

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

I'm having a hard time mentally matching this to the description, picture above.

This description talks about an ordering between queries. This implementation seems to be in terms of a relationship between a new query and the current state of the cache.

It looks like what's going on is that is that any time a new query comes before or after the existing range cache, then we clear the cache to avoid ever ending up with a hole in the first place?

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like what's going on is that is that any time a new query comes before or after the existing range cache, then we clear the cache to avoid ever ending up with a hole in the first place?

Yes, we prematurely clear the cache anytime two non-contiguous queries (as defined by the checks below) come in one after another, to keep it simple.

Comment on lines 73 to 79
if let Some((data_time, _, _)) = store.latest_at(
&LatestAtQuery::new(query.timeline(), hole_end),
entity_path,
component_name,
&[component_name],
) {
if data_time != hole_start {
Copy link
Member

Choose a reason for hiding this comment

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

Again a little confused by what's happening here. I suspect this is to avoid invalidating in cases where the hole otherwise contains no data.

However, shouldn't it be data_time > hole_start.

Any situation where data_time < hole_start doesn't seem like it should require an invalidation since the values pulled in by the new query should be correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah you're right, nice catch

@teh-cmc teh-cmc added this to the 0.16 milestone May 2, 2024
@teh-cmc teh-cmc merged commit a90b3a8 into main May 3, 2024
34 checks passed
@teh-cmc teh-cmc deleted the cmc/5686 branch May 3, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working exclude from changelog PRs with this won't show up in CHANGELOG.md 🔍 re_query affects re_query itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visible time range queries skip random chunks of data (for 2D points)
2 participants