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

Restore schema workaround #3697

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/scyllaclient/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ func (c *ConfigClient) UUIDSStableIdentifiers(ctx context.Context) (bool, error)
return resp.Payload, err
}

// ConsistentClusterManagement returns true if node uses RAFT for cluster management and DDL.
func (c *ConfigClient) ConsistentClusterManagement(ctx context.Context) (bool, error) {
resp, err := c.client.Config.FindConfigConsistentClusterManagement(config.NewFindConfigConsistentClusterManagementParamsWithContext(ctx))
if isStatusCode400(err) {
return false, nil
}
Michal-Leszczynski marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return false, err
}
return resp.Payload, err
}

// AlternatorEnforceAuthorization returns whether alternator requires authorization.
func (c *ConfigClient) AlternatorEnforceAuthorization(ctx context.Context) (bool, error) {
resp, err := c.client.Config.FindConfigAlternatorEnforceAuthorization(config.NewFindConfigAlternatorEnforceAuthorizationParamsWithContext(ctx))
Expand Down Expand Up @@ -278,6 +290,7 @@ func (c *ConfigClient) NodeInfo(ctx context.Context) (*NodeInfo, error) {
{Field: &ni.CqlPasswordProtected, Fetcher: c.CQLPasswordProtectionEnabled},
{Field: &ni.AlternatorEnforceAuthorization, Fetcher: c.AlternatorEnforceAuthorization},
{Field: &ni.SstableUUIDFormat, Fetcher: c.UUIDSStableIdentifiers},
{Field: &ni.ConsistentClusterManagement, Fetcher: c.ConsistentClusterManagement},
}

for i, ff := range ffb {
Expand Down
12 changes: 11 additions & 1 deletion pkg/scyllaclient/config_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestClientConfigReturnsResponseFromScylla(t *testing.T) {
Name: "Alternator requires authorization",
ResponseFilePath: "testdata/scylla_api/v2_config_alternator_enforce_authorization.json",
BindClientFunc: func(client *scyllaclient.ConfigClient) configClientFunc {
return convertBool(client.UUIDSStableIdentifiers)
return convertBool(client.AlternatorEnforceAuthorization)
},
Golden: true,
},
Expand All @@ -132,6 +132,14 @@ func TestClientConfigReturnsResponseFromScylla(t *testing.T) {
},
Golden: true,
},
{
Name: "Raft schema enabled",
ResponseFilePath: "testdata/scylla_api/v2_config_consistent_cluster_management.json",
BindClientFunc: func(client *scyllaclient.ConfigClient) configClientFunc {
return convertBool(client.ConsistentClusterManagement)
},
Golden: true,
},
}

for i := range table {
Expand Down Expand Up @@ -174,6 +182,7 @@ func TestConfigClientPullsNodeInformationUsingScyllaAPI(t *testing.T) {
scyllaclienttest.PathFileMatcher("/v2/config/alternator_address", "testdata/scylla_api/v2_config_alternator_address.json"),
scyllaclienttest.PathFileMatcher("/v2/config/alternator_enforce_authorization", "testdata/scylla_api/v2_config_alternator_enforce_authorization.json"),
scyllaclienttest.PathFileMatcher("/v2/config/uuid_sstable_identifiers_enabled", "testdata/scylla_api/v2_config_uuid_sstable_identifiers_enabled.json"),
scyllaclienttest.PathFileMatcher("/v2/config/consistent_cluster_management", "testdata/scylla_api/v2_config_consistent_cluster_management.json"),
),
)
defer closeServer()
Expand Down Expand Up @@ -222,6 +231,7 @@ func TestConfigOptionIsNotSupported(t *testing.T) {
scyllaclienttest.PathFileMatcher("/v2/config/alternator_address", "testdata/scylla_api/v2_config_alternator_disabled.400.json"),
scyllaclienttest.PathFileMatcher("/v2/config/alternator_enforce_authorization", "testdata/scylla_api/v2_config_alternator_disabled.400.json"),
scyllaclienttest.PathFileMatcher("/v2/config/uuid_sstable_identifiers_enabled", "testdata/scylla_api/v2_config_uuid_sstable_identifiers_enabled.400.json"),
scyllaclienttest.PathFileMatcher("/v2/config/consistent_cluster_management", "testdata/scylla_api/v2_config_consistent_cluster_management.400.json"),
),
)
defer closeServer()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"message": "No such config entry: consistent_cluster_management", "code": 400}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"prometheus_port":"9180",
"rpc_address":"192.168.100.101",
"rpc_port":"9160",
"sstable_uuid_format":true
"sstable_uuid_format":true,
"consistent_cluster_management":true
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"prometheus_port":"9180",
"rpc_address":"192.168.100.101",
"rpc_port":"9160",
"sstable_uuid_format":false
"sstable_uuid_format":false,
"consistent_cluster_management":false
}
4 changes: 4 additions & 0 deletions swagger/agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,10 @@
"sstable_uuid_format": {
"description": "Whether Scylla supports uuid-like sstable naming.",
"type": "boolean"
},
"consistent_cluster_management": {
"description": "Whether Scylla uses RAFT for cluster management and DDL.",
"type": "boolean"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions swagger/gen/agent/models/node_info.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions swagger/gen/scylla/v2/client/config/config_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading