-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support for AWS Keyspaces #579
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.
Thanks for the PR!
database/cassandra/cassandra.go
Outdated
@@ -155,6 +155,10 @@ func (c *Cassandra) Open(url string) (database.Driver, error) { | |||
} | |||
} | |||
|
|||
if s := u.Query().Get("disable-host-lookup"); len(s) > 0 { |
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.
Use ParseBool and handle the error properly
database/cassandra/cassandra.go
Outdated
if previous != database.NilVersion { | ||
// DELETE instead of TRUNCATE because AWS Keyspaces does not support it | ||
// see: https://docs.aws.amazon.com/keyspaces/latest/devguide/cassandra-apis.html | ||
query := `DELETE FROM "` + c.config.MigrationsTable + `" WHERE version = ?` |
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 only removes the previous version and not all versions. Having multiple versions will cause issues since selecting the current versions only selects one version without any ordering.
We can either:
- Delete all rows and keep the current behavior
- Update
Version()
to select the latest version - ??? - Other backwards compatible suggestions?
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.
I believe this causing the tests to fail. You can test locally by running go test -v ./database/cassandra
. You'll need docker installed.
Hello @florentsolt @dhui, I am currently also running into this issue, are there any news on fixing this issue anytime soon ? |
@@ -156,6 +156,12 @@ func (c *Cassandra) Open(url string) (database.Driver, error) { | |||
} | |||
} | |||
|
|||
if flag, err := strconv.ParseBool(u.Query().Get("disable-host-lookup")); err != nil && flag { |
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.
Tests are failing here because it is unable to parse ""
when nothing is provided. Instead it should be:
if len(u.Query().Get("disable-host-lookup")) > 0 {
if flag, err := strconv.ParseBool(u.Query().Get("disable-host-lookup")); err != nil && flag {
cluster.DisableInitialHostLookup = true
} else if err != nil {
return nil, err
}
}
Thanks @florentsolt for the original PR! Due to inactivity, I'm closing this PR in favor of #634. |
AWS Keyspaces does not support TRUNCATE, so DELETE will do the trick.
Also, on the official docs they ask to disable initial host lookup:
https://docs.aws.amazon.com/keyspaces/latest/devguide/using_go_driver.html
Also, I had to upgrade the version of gocql, because the consistency was not properly handled in that version.