-
Couldn't load subscription status.
- Fork 5
ScalarDB Cluster with Cassandra #159
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @yito88, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've implemented significant changes to enable ScalarDB Cluster to operate with Apache Cassandra as its persistent storage layer. Previously, ScalarDB Cluster was primarily configured for PostgreSQL. This enhancement introduces the capability to dynamically provision and manage a Cassandra cluster alongside ScalarDB Cluster, allowing users to leverage Cassandra's distributed and highly available characteristics. The changes span across deployment scripts, configuration logic, and test infrastructure to ensure seamless integration and validation of this new storage option.
Highlights
- Added Cassandra Support for ScalarDB Cluster: I've extended the ScalarDB Cluster deployment to support Apache Cassandra as an underlying storage backend, in addition to the existing PostgreSQL support. This allows for greater flexibility in choosing the database for ScalarDB Cluster deployments.
- Dynamic Database Configuration and Deployment: The deployment logic now dynamically configures ScalarDB Cluster properties and deploys the appropriate database (PostgreSQL or Cassandra) using Helm charts based on the
db-typespecified. This includes handling connection details, user credentials, and cleanup procedures specific to each database. - Test Runner Integration for Cassandra: I've updated the test runner to recognize and utilize the new
cluster-cassandradatabase type, ensuring that tests can be executed against ScalarDB Cluster backed by Cassandra. This involved refactoring how database generation functions are loaded and how test options are parsed. - Generalized Fault Injection: Fault injection mechanisms have been generalized to apply to any cluster node, rather than being specifically tied to PostgreSQL. This improves the robustness and applicability of chaos engineering experiments across different storage backends.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively adds support for Cassandra as a backend for ScalarDB Cluster tests. The changes are well-structured, introducing dynamic configuration based on the database backend. I've identified a couple of areas for improvement: a duplicate configuration in a Helm command and an opportunity to make the test client's connection to Cassandra more robust by using all available contact points instead of just one. Overall, this is a solid contribution that extends the testing capabilities.
| (defn get-cassandra-ip | ||
| "Get one IP of the Cassandra nodes" | ||
| [] | ||
| (->> (c/exec :kubectl :get :svc) | ||
| str/split-lines | ||
| (filter #(str/includes? % "cassandra-scalardb-cluster")) | ||
| (filter #(str/includes? % "LoadBalancer")) | ||
| (map #(nth (str/split % #"\s+") 3)) | ||
| first)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function currently returns only one IP address for Cassandra, which can be a single point of failure for the test client. It would be more robust to return all available Cassandra LoadBalancer IPs. The docstring should also be updated to reflect this change.
(defn get-cassandra-ip
"Get all IPs of the Cassandra nodes"
[]
(->> (c/exec :kubectl :get :svc)
str/split-lines
(filter #(str/includes? % "cassandra-scalardb-cluster"))
(filter #(str/includes? % "LoadBalancer"))
(map #(nth (str/split % #"\s+") 3))))
| :cluster-cassandra ["cassandra" | ||
| (get-cassandra-ip) | ||
| "cassandra"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make the client connection to Cassandra more robust, get-cassandra-ip should return a list of all available IPs (as suggested in another comment). This call should then be updated to join those IPs into a comma-separated string for the contact_points property.
:cluster-cassandra ["cassandra"
(str/join "," (get-cassandra-ip))
"cassandra"]
| (->> (remove nil?) (string/join "-")))) | ||
|
|
||
| (defn- load-module | ||
| [db-key] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b78ec24 to
2a8cdcc
Compare
Description
Related issues and/or PRs
Changes made
Checklist
Additional notes (optional)