diff --git a/cdb/db_heartbeat.go b/cdb/db_heartbeat.go index 4160af78..65911b85 100644 --- a/cdb/db_heartbeat.go +++ b/cdb/db_heartbeat.go @@ -224,8 +224,8 @@ func (oDb *DB) HBLogLastExtend(ctx context.Context, l ...*DBHeartbeatLog) error } placeholders := strings.Repeat("(?,?,?),", len(l)-1) + "(?,?,?)" - query := fmt.Sprintf("UPDATE `hbmon_log_last` SET `end` = NOW() WHERE (`node_id`,`peer_node_id`,`name`) IN %s)", placeholders) - args := make([]any, 3*len(l)) + query := fmt.Sprintf("UPDATE `hbmon_log_last` SET `end` = NOW() WHERE (`node_id`,`peer_node_id`,`name`) IN (%s)", placeholders) + args := make([]any, 0, 3*len(l)) for _, v := range l { args = append(args, v.NodeID, v.PeerNodeID, v.Name) } diff --git a/cdb/db_resources.go b/cdb/db_resources.go index f162fcfe..5f4a0cd7 100644 --- a/cdb/db_resources.go +++ b/cdb/db_resources.go @@ -415,7 +415,7 @@ func (oDb *DB) ResmonUpdate(ctx context.Context, l ...*DBInstanceResource) error insertColList = "(`svc_id`,`node_id`,`vmname`,`rid`,`res_status`,`res_type`,`res_log`,`res_desc`,`res_optional`,`res_disable`,`res_monitor`, `changed`, `updated`)" valueList = "(?,?,?,?,?,?,?,?,?,?,?,?,NOW())" onDuplicateAssignment = "" + - "`svc_id`=VALUES(`svc_id`), `node_id`=VALUES(`node_id`), `vmname`=VALUES(`vmname`), `rid`=VALUES(`rid`), `res_status`=VALUES(`res_status`)," + + "`res_status`=VALUES(`res_status`)," + "`res_type`=VALUES(`res_type`), `res_log`=VALUES(`res_log`), `res_desc`=VALUES(`res_desc`), `res_optional`=VALUES(`res_optional`)," + "`res_disable`=VALUES(`res_disable`), `res_monitor`=VALUES(`res_monitor`),`changed`=VALUES(`changed`),`updated`=VALUES(`updated`)" )