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

Expose cluster metadata and token ranges #1664

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

cs-sotescu
Copy link

This PR does a few things:

  • It refactors the cluster metadata handling by extracting it from the TokenAwareHostPolicy into its own manager;
  • It manages cluster metadata for any host policy, in the session itself;
  • It exposes the metadata through a new Session.ClusterMetadata method;
  • It gives access to the token ring thorough ClusterMetadata.GetTokenRing;
  • It publishes TokenRing.GetHostForToken and adds a new method, TokenRing.GetTokenRanges.
  • The goal is to allow people to build host-targeted token range queries like SELECT id,foo FROM mytable WHERE TOKEN(id)>$startToken AND TOKEN(id)<=$endToken.

Copy link
Contributor

@martin-sucha martin-sucha left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request and sorry for the late reply! I think this could be useful for full table scans, for example.

token.go Outdated Show resolved Hide resolved
token.go Outdated Show resolved Hide resolved
token.go Outdated Show resolved Hide resolved
token.go Outdated Show resolved Hide resolved
@martin-sucha
Copy link
Contributor

How will the API behave in case the token ring is not available (e.g. because of DisableInitialHostLookup option)? The documentation should explicitly mention that.

@cs-sotescu
Copy link
Author

I've updated the documentation for ClusterMetadata.TokenRing to clarify in which instances the token ring is not available. The documentation for the TokenRing.Tokens method now has an example function showing how to build token-based queries using the returned token ranges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants