Skip to content

Commit

Permalink
fix(parameters): fixed null string convertion when listing parameters (
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI authored Dec 26, 2024
1 parent cac0dad commit 45797ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
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"
)

0 comments on commit 45797ed

Please sign in to comment.