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(backend): TendbCluster分区执行问题修复(去除中控) #9208 #9209

Open
wants to merge 1 commit into
base: v1.5.0
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion dbm-services/mysql/db-partition/service/cron_basic_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func GetTendbclusterInstances(cluster string) (map[string][]SpiderNode, int, err
}
// 查询remote master各分片实例和tdbctl主节点
splitSql := fmt.Sprintf("select HOST,PORT,replace(server_name,'SPT','') as SPLIT_NUM, SERVER_NAME, WRAPPER "+
"from mysql.servers where wrapper in ('mysql','TDBCTL') and "+
"from mysql.servers where wrapper in ('mysql') and "+
"(server_name like 'SPT%%' or server_name like '%s')", tdbctlPrimary)
queryRequest = QueryRequest{Addresses: []string{address}, Cmds: []string{splitSql}, Force: true, QueryTimeout: 30,
BkCloudId: cloud}
Expand Down
10 changes: 9 additions & 1 deletion dbm-services/mysql/db-partition/service/manage_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,17 @@ func (m *QueryLogInput) GetPartitionLog() ([]*PartitionLog, int64, error) {
slog.Error("cnt sql execute error", cntResult.Error)
return nil, 0, cntResult.Error
}

order := clause.OrderByColumn{
Column: clause.Column{
Name: "create_time",
},
Desc: true,
}

// 使用session函数,开启新的会话查询,避免和上面的查询重复(条件,返回字段)
result := tx.Session(&gorm.Session{}).
Select("id,create_time as execute_time,check_info,status").
Select("id,create_time as execute_time,check_info,status").Order(order).
Limit(m.Limit).Offset(m.Offset).Find(&allResults)
if result.Error != nil {
slog.Error("sql execute error", result.Error)
Expand Down