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

Implement support for fully asynchronous QueryHandles #7964

Merged
merged 6 commits into from
Oct 31, 2024

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Oct 31, 2024

This adds non-blocking methods to all our new shiny storage handles, and uses these new non-blocking primitives to implement asynchronous helpers (read: Futures) in our QueryHandle.
These helpers are then used on the other side to implement a proper Stream.

In particular, all read locks are now recursive, always.
Recursive locks are mandatory for two reasons:

  • As we start parallelizing the viewer further, and especially when using work-stealing schedulers, nested read locks will become a common occurrence.
  • In asynchronous contexts, everything is designed around work stealing.

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!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

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

@teh-cmc teh-cmc added enhancement New feature or request 🔍 re_query affects re_query itself 🚀 performance Optimization, memory use, etc dataplatform Rerun Data Platform integration labels Oct 31, 2024
@teh-cmc
Copy link
Member Author

teh-cmc commented Oct 31, 2024

@rerun-bot full-check

Copy link

@teh-cmc teh-cmc marked this pull request as ready for review October 31, 2024 18:39
@@ -816,7 +858,9 @@ impl<E: StorageEngineLike> QueryHandle<E> {
Retrofilled(UnitChunkShared),
}

let state = self.init();
// That's a synchronous lock, so make sure we barely lock it.
let state = self.init_(store, cache);
Copy link
Member

Choose a reason for hiding this comment

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

This looks suspicious to me -- the body of that function is large and I wouldn't expect us to execute that code unless we aren't able to access self.state.

Why isn't this:

self.state.get_or_init(|| self.init_(store, cache))

Copy link
Member Author

@teh-cmc teh-cmc Oct 31, 2024

Choose a reason for hiding this comment

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

Uh-oh, nice catch. I meant to add a non-blocking optimistic check that comes first.

But now that I think about it, this is in QueryHandle, so realistically nothing will ever contend on this... we can probably just do it all in the OnceLock yeah.

@teh-cmc teh-cmc merged commit 5cf8451 into main Oct 31, 2024
35 checks passed
@teh-cmc teh-cmc deleted the cmc/recursive_handles branch October 31, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dataplatform Rerun Data Platform integration enhancement New feature or request 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.

3 participants