-
Notifications
You must be signed in to change notification settings - Fork 35
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
Don't add cluster to SM DB before validation finishes #4029
Conversation
Commit 5bf6b35 introduced a bug that when adding cluster to SM finished with error, cluster was still saved in SM DB, but only with the ID and known hosts fields. That's because method validateHostsConnectivity used discoverAndSetClusterHosts instead of discoverClusterHosts, which happened before inserting cluster to SM DB. Fixes #4028
62c01b9
to
9356865
Compare
E.g. clusters created before SM 3.2.6 can have empty --host SM DB column.
In case client was mistakenly initialized with "" host, getting host from the pool would panic: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x11da5ac] goroutine 253 [running]: github.com/scylladb/scylla-manager/v3/pkg/scyllaclient.NewClient.hostPool.func3(0xc0004345a0) github.com/scylladb/scylla-manager/v3/pkg/scyllaclient/hostpool.go:32 +0xac This should be replaced with a simple error. This commit adds additional validation to client config, which prohibits specifying empty host there. It also makes host pool return an error instead of panic in case of invalid host pool response. Fixes scylladb/scylla-enterprise#4692
As it is possible that the --host field in SM DB is empty, we should test that this scenario does not break anything in SM. Tests scylladb/scylla-enterprise#4692
9356865
to
0008113
Compare
@karol-kokoszka This PR is ready for review! Failures are connected to #4032. |
Thanks !
Scylla-manager started with
... what is fine. Eventually, it is possible to update the host with
|
@Michal-Leszczynski can you run operator tests on that ? |
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.
PR is OK, let's merge after getting the results from operator tests.
Operator tests passed, but since this time I added some more safety nets and tests, so I will re-trigger them. |
Operator tests started here: scylladb/scylla-operator#2105 (comment). |
@karol-kokoszka operator tests passed: scylladb/scylla-operator#2105 (comment)! |
OK, so merging to master and backporting to branch-3.3 |
Commit 5bf6b35 introduced a bug that when adding cluster to SM finished with error,
cluster was still saved in SM DB, but only with the ID and known hosts fields.
That's because method validateHostsConnectivity used discoverAndSetClusterHosts
instead of discoverClusterHosts, which happened before inserting cluster to SM DB.
In case client was mistakenly initialized with "" host, getting host from the pool would panic.
This should be replaced with a simple error. This PR adds additional validation to client config,
which prohibits specifying empty host there. It also makes host pool return an error instead of panic
in case of invalid host pool response.
This PR also includes testes for mentioned issues (validated that those tests weren't passing without the fixes).
Fixes #4028