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

integration: direct node connectivity test #1189

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

wprzytula
Copy link
Collaborator

Problem

I noticed that we lacked a test that requires direct connectivity to all nodes in the cluster in order to pass. Other tests would often succeed even if only one node (the initial contact point) was directly reachable.

The issue has manifested in testing serverless cloud why working on rustls support: tests would pass even with address translation disabled...

Side note

An example of a test which has exercised direct connectivity to all nodes is tablets.rs, yet it could be enabled only for non-cloud case, as it uses the proxy.

Solution

I wrote a test that iterates though all targets (pairs (node, shard)) and sends a request directly to them (using a load balancing policy that produces singleton query plans).

Bonus

I extracted and refactored some utils from tablets.rs to utils.rs, so that they can be used by other tests.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • [ ] I have provided docstrings for the public items that I want to introduce.
  • [ ] I have adjusted the documentation in ./docs/source/.
  • [ ] I added appropriate Fixes: annotations to PR description.

The following helpers are all usable universally, not only for tablets:
- SingleTargetLBP,
- send_statement_everywhere,
- send_unprepared_query_everywhere,

so it makes sense to extract them to utils.rs.
The following helpers were renamed to better convey their semantics:
- `send_statement_everywhere` -> `execute_prepared_statement_everywhere`,
- `send_unprepared_query_everywhere` ->
  `execute_unprepared_statement_everywhere`.
…y values

`execute_unprepared_statement_everywhere` was limited to empty values;
now any value list is supported.
`execute_(un)prepared_statement_everywhere` both have similar logic that
can be extracted to a generic function. `for_each_target_execute`
extraction will be even more important in the next commit, where we make
its logic a bit more complex not to `unwrap()` the Sharder.
Before, `for_each_target_execute` would panic on absence of Sharder
for a Node. This could be caused by two main reasons:
1) the node was unsharded (e.g., a Cassandra node),
2) there were no open connections to the node, e.g. due to the node
   being down.

In both cases, we prefer not to panic in `for_each_target_execute` but
rather assume the node is unsharded and proceed. In the case 1),
execution of the request should succeed, whereas in 2) we should get
the ConnectionPoolError.
I noticed that we lacked a test that requires direct connectivity to all
nodes in the cluster in order to pass. Other tests would often succeed
even if only one node (the initial contact point) was directly
reachable.

An example of a test which has exercised direct connectivity to all
nodes is tablets.rs, yet it could be enabled only for non-cloud case,
as it uses the proxy.
@wprzytula wprzytula added the area/testing Related to tests - unit, integration, or even out of repo label Feb 1, 2025
@wprzytula wprzytula self-assigned this Feb 1, 2025
Copy link

github-actions bot commented Feb 1, 2025

cargo semver-checks found no API-breaking changes in this PR! 🎉🥳
Checked commit: fdaa97e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Related to tests - unit, integration, or even out of repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant