Skip to content

Commit

Permalink
fix: tdbctl_partition_fix TencentBlueKing#9208
Browse files Browse the repository at this point in the history
  • Loading branch information
xfan0805 committed Jan 25, 2025
1 parent e40d0c4 commit f80530a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit f80530a

Please sign in to comment.