Skip to content

Commit

Permalink
fix(obcluster): list obcluster parameters group by name
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Dec 19, 2024
1 parent 26e8db6 commit 683a4f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/dashboard/business/oceanbase/obcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ func ListOBClusterParameters(ctx context.Context, nn *param.K8sObjectIdentity) (
logger.Info("Failed to get OceanBase database connection")
return nil, errors.Wrap(err, "Get OceanBase database connection")
}
parameters, err := conn.ListParametersWithTenantID(ctx, 1)
parameters, err := conn.ListClusterParameters(ctx)
if err != nil {
logger.WithError(err).Error("Failed to query parameters")
return nil, errors.Wrap(err, "Query parameters")
Expand Down
1 change: 1 addition & 0 deletions pkg/oceanbase-sdk/const/sql/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ const (
const (
ListParametersWithTenantID = "select name, value, data_type, info, section, default_value, isdefault, 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, default_value, isdefault, edit_level, scope, svr_ip, zone, svr_port, IFNULL(tenant_id, 0) from GV$OB_PARAMETERS group by name"
)
9 changes: 9 additions & 0 deletions pkg/oceanbase-sdk/operation/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,12 @@ func (m *OceanbaseOperationManager) GetVersion(ctx context.Context) (*model.OBVe
}
return version, nil
}

func (m *OceanbaseOperationManager) ListClusterParameters(ctx context.Context) ([]*model.Parameter, error) {
params := make([]*model.Parameter, 0)
err := m.QueryList(ctx, &params, sql.ListParametersGroupByName)
if err != nil {
return nil, errors.Wrap(err, "List cluster parameters")
}
return params, nil
}

0 comments on commit 683a4f6

Please sign in to comment.