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

CassandraSinkCluster: Control connection always connects to configured dc/rack #777

Merged
merged 2 commits into from
Sep 1, 2022

Conversation

rukai
Copy link
Member

@rukai rukai commented Aug 31, 2022

closes #758

The new logic looks like:

  1. when we receive our first message populate local_nodes immediately if possible (if not now then we have to wait till handshake is complete)
  2. process handshake
  3. when we receive confirmation that handshake is complete:
    1. send handshake to topology task
    2. if local_nodes is empty then
      1. populate local_nodes blocking until topology task has completed once. (on my machine in int tests this takes ~50ms)
      2. replace control connection with a new connection guaranteed to be from the dc/rack
  4. system.local queries are always routed to a dc/rack node giving us more correctness and allowing us to remove some unneeded logic.

This didnt end up cleaning up as much code as I had originally hoped, the system.peers rewriting still needs to perform its own system.local and system.peers queries regardless, but I think it is still the most correct approach.
I think that the consistency of always having our control connection connect to our dc/rack should help avoid some nasty and hard to detect edge cases.

@rukai rukai marked this pull request as ready for review August 31, 2022 23:31
@conorbros conorbros enabled auto-merge (squash) September 1, 2022 03:35
@conorbros conorbros merged commit 369bb1d into shotover:main Sep 1, 2022
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.

Rewrite CassandraSinkCluster to delay the first query until topology creation is complete.
3 participants