-
Notifications
You must be signed in to change notification settings - Fork 820
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
Refactor Cassandra test utility for NoSQL support #4311
Conversation
4163e94
to
faf2c5f
Compare
69fad9b
to
1f5fa38
Compare
dd166d6
to
5b3e1ed
Compare
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.
LGTM overall. I guess the change won't break our internal repo except for the naming change in TestBaseOptions
struct? @Shaddoll
common/persistence/nosql/store.go
Outdated
|
||
var supportedPlugins = map[string]nosqlplugin.Plugin{} | ||
|
||
// RegisterPlugin will register a SQL plugin |
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.
nit: NoSQL plugin
. Three more in this file.
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.
Done, 4 more actually :D thanks for the catch.
common/persistence/nosql/store.go
Outdated
@@ -0,0 +1,86 @@ | |||
// Copyright (c) 2021 Uber Technologies, Inc. |
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.
nit: store.go
sounds a bit confusing. Maybe plugin.go
or registry.go
?
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.
Updated to plugin.go ,and also rename the one in sql/ for consistency.
// NewClient gets a gocql client based registered object | ||
func NewClient() Client { | ||
// GetOrCreateClient gets a gocql client based registered object | ||
func GetOrCreateClient() Client { |
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.
nit: since it only returned registered client, maybe just GetClient()
?
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.
Yeah good point. I changed to GetRegisteredClient
if you don't mind.
@@ -72,7 +71,7 @@ func verifyCompatibleVersion( | |||
return nil | |||
} | |||
|
|||
if ds.NoSQL.PluginName != cassandra_db.PluginName { |
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.
reusing the defined constant will be better than hardcoding I think? Anything I am missing here?
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.
It's causing another cycle dependency. And since this file will be refactored soon to support NoSQL tools(after the refactor the cycle dep should be gone) so I don't want to spend time on fixing the dependency just for this constant here. I will leave a comment to explain why I don't use the constant.
tools/cli/adminCommands.go
Outdated
tmpl := "select domain from domains where id = ? " | ||
query := session.Query(tmpl, domainID) | ||
res, err := readOneRow(query) | ||
domain, err := db.SelectDomain(ctx.Background(), &domainID, nil) |
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.
nit: ctx.Background()
-> newContext(c)
?
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
package testcluster |
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.
if it's for avoiding cycle dependency would you mind add some comments describing the problem?
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.
yeah added
5b3e1ed
to
6af33ce
Compare
What changed?
Why?
For #3514
So that other NoSQL can run persistence test easily.
Once this is merged, we can start working on NoSQL support.
Though we still need two refactoring: 1) Refactoring schema tool to support NoSQL 2) Refactoring integ test to support NoSQL.
How did you test it?
existing tests.
Potential risks
Low risks. The refactoring is only for testing support for NoSQL
Release notes
No
Documentation Changes
No