Skip to content

Commit

Permalink
refactor(backend): 同步v1.3.0代码 #4351
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 authored May 11, 2024
2 parents 129f200 + 460a72e commit e08d685
Show file tree
Hide file tree
Showing 145 changed files with 4,396 additions and 912 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package manage
import (
"encoding/json"
"fmt"
"strings"
"time"

"dbm-services/common/db-resource/internal/model"
Expand All @@ -22,6 +21,7 @@ import (
"dbm-services/common/go-pubpkg/logger"

"github.com/gin-gonic/gin"
"github.com/samber/lo"
"gorm.io/gorm"
)

Expand Down Expand Up @@ -95,11 +95,10 @@ func (p GetOperationInfoParam) query(db *gorm.DB) {
if cmutil.IsNotEmpty(p.BeginTime) {
db.Where("create_time >= ? ", p.BeginTime)
}
switch strings.ToLower(strings.TrimSpace(p.Orderby)) {
case "asc":
db.Order("create_time asc")
default:
if lo.IsEmpty(p.Orderby) {
db.Order("create_time desc")
} else {
db.Order(p.Orderby)
}
}

Expand Down
93 changes: 81 additions & 12 deletions dbm-services/mysql/db-tools/dbactuator/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,12 @@
"description": "repl user, 环境变量 GENERAL_ACCOUNT_repl_user",
"type": "string"
},
"tbinlogdumper_admin_pwd": {
"type": "string"
},
"tbinlogdumper_admin_user": {
"type": "string"
},
"tdbctl_pwd": {
"type": "string"
},
Expand Down Expand Up @@ -1607,6 +1613,9 @@
"json",
"dump"
]
},
"time_layout": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -1966,6 +1975,9 @@
"general": {
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components.GeneralParam"
},
"mySQLConfigParams": {
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components_mysql.MySQLConfigParams"
},
"timeZone": {
"type": "string"
}
Expand All @@ -1976,7 +1988,6 @@
"required": [
"charset",
"host",
"mycnf_configs",
"mysql_version",
"pkg",
"pkg_md5",
Expand All @@ -2003,7 +2014,7 @@
"description": "安装实例的内存大小,可以不指定,会自动计算",
"type": "integer"
},
"mycnf_configs": {
"myCnfConfigs": {
"description": "map[port]my.cnf",
"type": "array",
"items": {
Expand Down Expand Up @@ -2180,6 +2191,9 @@
"dbm-services_mysql_db-tools_dbactuator_pkg_components_mysql.LocalBackupObj": {
"type": "object",
"properties": {
"backup_consistent_time": {
"type": "string"
},
"backup_dir": {
"description": "备份所在目录",
"type": "string"
Expand Down Expand Up @@ -2229,6 +2243,20 @@
}
}
},
"dbm-services_mysql_db-tools_dbactuator_pkg_components_mysql.MySQLConfigParams": {
"type": "object",
"required": [
"mycnf_configs"
],
"properties": {
"mycnf_configs": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dbm-services_mysql_db-tools_dbactuator_pkg_components_mysql.MycnfChangeComp": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -2701,7 +2729,7 @@
"type": "boolean"
},
"idempotent_mode": {
"description": "是否开启幂等模式, mysql --slave-exec-mode=idempotent or mysqlbinlog --idempotent",
"description": "是否开启幂等模式, mysqlbinlog --idempotent(\u003e=5.7)",
"type": "boolean"
},
"mysql_client_opt": {
Expand Down Expand Up @@ -2730,15 +2758,15 @@
"type": "integer"
},
"start_time": {
"description": "--start-datetime",
"description": "--start-datetime 时间格式\n格式 \"2006-01-02 15:04:05\" 原样传递给 mysqlbinlog\n格式\"2006-01-02T15:04:05Z07:00\"(示例\"2023-12-11T05:03:05+08:00\")按照机器本地时间,解析成 \"2006-01-02 15:04:05\" 再传递给 mysqlbinlog\n在 Init 时会统一把时间字符串转换成 time.RFC3399",
"type": "string"
},
"stop_pos": {
"description": "--stop-position",
"type": "integer"
},
"stop_time": {
"description": "--stop-datetime",
"description": "--stop-datetime 时间格式同 StartTime,可带时区,会转换成机器本地时间",
"type": "string"
},
"tables": {
Expand Down Expand Up @@ -2792,7 +2820,7 @@
}
},
"binlog_start_file": {
"description": "指定要开始应用的第 1 个 binlog。如果指定,一般要设置 start_pos,如果不指定则使用 start_time",
"description": "指定要开始应用的第 1 个 binlog。如果指定,一般要设置 start_pos,如果不指定则使用 start_time\nBinlogStartFile 只能由外部传入,不要内部修改",
"type": "string"
},
"parse_concurrency": {
Expand Down Expand Up @@ -3028,7 +3056,7 @@
"type": "string"
},
"target_time": {
"description": "闪回的目标时间点,对应 recover-binlog 的 start_time, 精确到秒。目标实例的时区",
"description": "闪回的目标时间点,对应 recover-binlog 的 start_time, 精确到秒。目标实例的时区\n可接受格式 ''",
"type": "string"
},
"tgt_instance": {
Expand Down Expand Up @@ -3100,10 +3128,6 @@
},
"dbm-services_mysql_db-tools_dbactuator_pkg_components_spiderctl.CheckObject": {
"type": "object",
"required": [
"dbname",
"tables"
],
"properties": {
"dbname": {
"type": "string"
Expand Down Expand Up @@ -3154,6 +3178,12 @@
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components_spiderctl.InstanceTuple"
}
},
"not_flush_all": {
"type": "boolean"
},
"only_init_ctl": {
"type": "boolean"
},
"port": {
"type": "integer",
"minimum": 3306
Expand All @@ -3164,6 +3194,12 @@
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components_spiderctl.Instance"
}
},
"spider_slave_instances": {
"type": "array",
"items": {
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components_spiderctl.Instance"
}
},
"tdbctl_pass": {
"type": "string"
},
Expand Down Expand Up @@ -3228,11 +3264,14 @@
"dbm-services_mysql_db-tools_dbactuator_pkg_components_spiderctl.TableSchemaCheckParam": {
"type": "object",
"required": [
"check_objects",
"host",
"port"
],
"properties": {
"check_all": {
"description": "检查所有非系统库表",
"type": "boolean"
},
"check_objects": {
"type": "array",
"items": {
Expand All @@ -3242,6 +3281,9 @@
"host": {
"type": "string"
},
"inconsistency_throws_err": {
"type": "boolean"
},
"port": {
"type": "integer",
"minimum": 3306
Expand Down Expand Up @@ -3353,6 +3395,30 @@
},
"dumper_id": {
"type": "string"
},
"kafka_pwd": {
"type": "string"
},
"kafka_user": {
"type": "string"
},
"l5_cmdid": {
"type": "integer"
},
"l5_modid": {
"type": "integer"
},
"protocol_type": {
"type": "string"
},
"server_id": {
"type": "integer"
},
"target_address": {
"type": "string"
},
"target_port": {
"type": "integer"
}
}
},
Expand All @@ -3371,6 +3437,9 @@
"general": {
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components.GeneralParam"
},
"mySQLConfigParams": {
"$ref": "#/definitions/dbm-services_mysql_db-tools_dbactuator_pkg_components_mysql.MySQLConfigParams"
},
"renderConfigs": {
"type": "object",
"additionalProperties": {
Expand Down
Loading

0 comments on commit e08d685

Please sign in to comment.