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

fix(parameters): fixed null string convertion when listing parameters #695

Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 3 additions & 11 deletions internal/dashboard/business/oceanbase/obcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,23 +921,15 @@ func ListOBClusterParameters(ctx context.Context, nn *param.K8sObjectIdentity) (
if err != nil {
return nil, errors.Wrapf(err, "Get obcluster %s %s", nn.Namespace, nn.Name)
}
observerList := v1alpha1.OBServerList{}
err = clients.ServerClient.List(ctx, nn.Namespace, &observerList, metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", oceanbaseconst.LabelRefOBCluster, nn.Name),
})
if err != nil {
logger.WithError(err).Error("Failed to list observers")
return nil, errors.Wrap(err, "List observers")
}
conn, err := utils.GetOBConnection(ctx, obcluster, "root", "sys", obcluster.Spec.UserSecrets.Root)
if err != nil {
logger.Info("Failed to get OceanBase database connection")
return nil, errors.Wrap(err, "Get OceanBase database connection")
logger.WithError(err).Info("Failed to get OceanBase database connection")
return nil, nil
}
parameters, err := conn.ListClusterParameters(ctx)
if err != nil {
logger.WithError(err).Error("Failed to query parameters")
return nil, errors.Wrap(err, "Query parameters")
return nil, errors.New("Failed to list obcluster parameters")
}
return parameters, nil
}
4 changes: 2 additions & 2 deletions pkg/oceanbase-sdk/const/sql/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
)

const (
ListParametersWithTenantID = "select name, value, data_type, info, section, edit_level, scope from GV$OB_PARAMETERS where tenant_id = ?"
ListParametersWithTenantID = "select name, value, IFNULL(data_type, 'unknown') as data_type, info, section, edit_level, scope from GV$OB_PARAMETERS where tenant_id = ?"
SelectCompatibleOfTenants = "select name, value, tenant_id from GV$OB_PARAMETERS where name = 'compatible'"
ListParametersGroupByName = "select name, value, data_type, info, section, edit_level, scope, svr_ip, zone, svr_port, IFNULL(tenant_id, 0) as tenant_id from GV$OB_PARAMETERS group by name"
ListParametersGroupByName = "select name, value, IFNULL(data_type, 'unknown') as data_type, info, section, edit_level, scope, svr_ip, zone, svr_port, IFNULL(tenant_id, 0) as tenant_id from GV$OB_PARAMETERS group by name"
)
Loading