Skip to content

Commit

Permalink
支持InnoDB不同行格式计算RowSize
Browse files Browse the repository at this point in the history
  • Loading branch information
xff committed May 17, 2024
1 parent 6231026 commit b7feb75
Show file tree
Hide file tree
Showing 109 changed files with 296 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ goInsight/goinsight/dist
.DS_Store
goinsight/bin/
goInsight.code-workspace
github.goinsight.code-workspace
2 changes: 1 addition & 1 deletion goinsight/bootstrap/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/14 15:45:43
@Author : lazzyfu
@Author : xff
*/

package bootstrap
Expand Down
6 changes: 4 additions & 2 deletions goinsight/bootstrap/db.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/14 15:53:53
@Author : lazzyfu
@Author : xff
*/

package bootstrap
Expand Down Expand Up @@ -238,12 +238,13 @@ func initializeInspectParams(db *gorm.DB) {
{"params": map[string]bool{"ENABLE_FOREIGN_KEY": false}, "remark": "是否启用外键"},
{"params": map[string]bool{"CHECK_TABLE_AUTOINCREMENT_INIT_VALUE": true}, "remark": "检查建表是自增列初始值是否为1"},
{"params": map[string]bool{"ENABLE_CREATE_VIEW": true}, "remark": "是否支持创建和使用视图"},
{"params": map[string]interface{}{"INNODB_ROW_FORMAT": []string{"DYNAMIC"}}, "remark": "InnoDB表支持的行格式"},
// COLUMN
{"params": map[string]int{"MAX_COLUMN_NAME_LENGTH": 64}, "remark": "列名的长度"},
{"params": map[string]bool{"CHECK_COLUMN_CHARSET": true}, "remark": "是否检查列的字符集"},
{"params": map[string]bool{"CHECK_COLUMN_COMMENT": true}, "remark": "是否检查列的注释"},
{"params": map[string]int{"COLUMN_MAX_CHAR_LENGTH": 64}, "remark": "char长度大于N的时候需要改为varchar"},
{"params": map[string]int{"MAX_VARCHAR_LENGTH": 65535}, "remark": "最大允许定义的varchar长度"},
{"params": map[string]int{"MAX_VARCHAR_LENGTH": 16383}, "remark": "最大允许定义的varchar长度"},
{"params": map[string]bool{"ENABLE_COLUMN_BLOB_TYPE": true}, "remark": "是否允许列的类型为BLOB/TEXT"},
{"params": map[string]bool{"ENABLE_COLUMN_JSON_TYPE": true}, "remark": "是否允许列的类型为JSON"},
{"params": map[string]bool{"ENABLE_COLUMN_BIT_TYPE": true}, "remark": "是否允许列的类型为BIT"},
Expand All @@ -269,6 +270,7 @@ func initializeInspectParams(db *gorm.DB) {
{"params": map[string]int{"PRIMARYKEY_MAX_KEY_PARTS": 1}, "remark": "组成主键索引的列数不能超过指定的个数"},
{"params": map[string]int{"MAX_INDEX_KEYS": 12}, "remark": "最多有N个索引,包括唯一索引/二级索引"},
{"params": map[string]bool{"ENABLE_INDEX_RENAME": false}, "remark": "是否允许rename索引名"},
{"params": map[string]bool{"ENABLE_REDUNDANT_INDEX": false}, "remark": "是否允许冗余索引"},
// ALTER
{"params": map[string]bool{"ENABLE_DROP_COLS": true}, "remark": "是否允许DROP列"},
{"params": map[string]bool{"ENABLE_DROP_INDEXES": true}, "remark": "是否允许DROP索引"},
Expand Down
2 changes: 1 addition & 1 deletion goinsight/bootstrap/log.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/14 15:49:31
@Author : lazzyfu
@Author : xff
*/

package bootstrap
Expand Down
16 changes: 8 additions & 8 deletions goinsight/config.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ database:
driver: "mysql" # 数据库驱动
host: "127.0.0.1" # 数据库主机
port: 3306 # 数据库端口
database: "goInsight" # 数据库名称
username: "goInsight_rw" # 数据库用户名
password: "goInsight@1234.Com" # 数据库密码
database: "goinsight" # 数据库名称
username: "goinsight_rw" # 数据库用户名
password: "goinsight@1234.Com" # 数据库密码
charset: "utf8mb4" # 数据库字符集
max_idle_conns: 64 # 最大空闲连接数
max_open_conns: 64 # 最大打开连接数
Expand All @@ -37,12 +37,12 @@ redis:
# 远程实例DB账号,需要在目标数据库创建
# 请确保通过该账号可以访问远程数据库,该账号用于工单审核、执行、数据查询、库表元信息采集等
# 注意:请保管好此账号,不要泄露,否则可能会导致安全风险
# create user 'goInsight_rw'@'%' identified by '复杂的密码';
# grant select,insert,update,delete,Alter,Create,Create view,Drop,Index,Replication slave on *.* to 'goInsight_rw'@'%';
# create user 'goinsight_admin'@'%' identified by '复杂的密码';
# grant select,insert,update,delete,Alter,Create,Create view,Drop,Index,Replication slave on *.* to 'goinsight_admin'@'%';
# flush privileges;
remotedb:
username: "goInsight_rw"
password: "goInsight@1234.Com" # 建议更换为复杂的密码
username: "goinsight_admin"
password: "goinsight@1234.Com" # 建议更换为复杂的密码

# 数据查询配置
das:
Expand Down Expand Up @@ -84,7 +84,7 @@ notify:
dingtalk:
enable: false
webhook: "https://oapi.dingtalk.com/robot/send?access_token=1234"
keywords: "goInsight"
keywords: "goinsight"
mail:
enable: false
username: "xxx@163.com"
Expand Down
2 changes: 1 addition & 1 deletion goinsight/configs/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/14 15:48:49
@Author : lazzyfu
@Author : xff
*/

package config
Expand Down
2 changes: 1 addition & 1 deletion goinsight/global/app.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/14 15:46:37
@Author : lazzyfu
@Author : xff
*/

package global
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/models/base.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/09/19 15:50:47
@Author : lazzyfu
@Author : xff
*/

package models
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/models/time.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/09/19 15:51:05
@Author : lazzyfu
@Author : xff
*/

package models
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/services/dbconfig.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/31 15:19:46
@Author : lazzyfu
@Author : xff
*/

package services
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/services/environment.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/31 15:19:46
@Author : lazzyfu
@Author : xff
*/

package services
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/tasks/tasks.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/17 09:53:21
@Author : zongfei.fu
@Author : xff
@Desc : 从用户定义的远程数据库实例同步库信息
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/views/dbconfig.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
@Author : lazzyfu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/common/views/environment.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
@Author : lazzyfu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/dao/clickhouse.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/11 11:27:36
@Author : zongfei.fu
@Author : xff
@Desc : 如果clickhouse版本大于22.3,请使用高版本的clickhouse-go
参考:https://github.com/ClickHouse/clickhouse-go/blob/v2.8.3/resources/meta.yml
*/
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/dao/db.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/25 09:38:32
@Author : zongfei.fu
@Author : xff
@Desc : http://go-database-sql.org/varcols.html
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/dao/db_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/06/27 16:02:55
@Author : zongfei.fu
@Author : xff
@Desc : 测试用例
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/forms/execute.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/21 14:20:29
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/forms/history.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/08 14:54:37
@Author : zongfei.fu
@Author : xff
*/

package forms
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/forms/list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/08 14:54:37
@Author : zongfei.fu
@Author : xff
*/

package forms
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/forms/order.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/02 17:49:29
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/limit.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/11 15:20:32
@Author : zongfei.fu
@Author : xff
@Desc : 提取limit
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/parser.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/21 14:53:21
@Author : zongfei.fu
@Author : xff
@Desc : 语法解析
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/rewrite.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/24 10:06:56
@Author : zongfei.fu
@Author : xff
@Desc : 重写sql
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/rewrite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/06/21 10:45:58
@Author : zongfei.fu
@Author : xff
@Desc : 测试用例
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/statement_type.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/11 15:21:19
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/parser/statement_type_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/06/27 11:02:07
@Author : zongfei.fu
@Author : xff
@Desc : 测试用例
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/environment.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/03 16:05:17
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/execute.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/11 16:04:55
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/execute_clickhouse.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/17 14:50:56
@Author : zongfei.fu
@Author : xff
@Desc : ClickHouse逻辑层,复用MySQL/TiDB
拆分的原因主要2点,一是form传参Params结构不一致,二是后续clickhouse逻辑可单独调整
*/
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/execute_mysql.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/17 14:50:56
@Author : zongfei.fu
@Author : xff
@Desc : MySQL/TiDB逻辑层
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/order_schema.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/02 17:47:51
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/order_tables.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/08/03 11:27:25
@Author : zongfei.fu
@Author : xff
@Desc :
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/permission.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/23 16:45:28
@Author : zongfei.fu
@Author : xff
@Desc : 检查用户的库表权限
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/schemas.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/17 14:50:56
@Author : zongfei.fu
@Author : xff
@Desc : 获取用户有权限的库
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/tablemeta.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/05/10 17:03:25
@Author : zongfei.fu
@Author : xff
@Desc : 获取表的元信息
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/services/tables.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/03/17 14:50:56
@Author : zongfei.fu
@Author : xff
@Desc : 获取用户有权限的表
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/tasks/kill.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/26 10:12:19
@Author : zongfei.fu
@Author : xff
@Desc : 检查TiDB异常的连接是否被释放,如果没有,触发kill操作。
原因是TiDB不支持DB接口上下文超时自动结束会话
已测试不支持版本:TiDB5.x/TiDB6.x
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/views/execute.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/04/03 18:13:42
@Author : zongfei.fu
@Author : xff
@Desc : 类似于view
*/

Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/views/favorites.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/06/09 14:26:16
@Author : zongfei.fu
@Author : xff
*/

package views
Expand Down
2 changes: 1 addition & 1 deletion goinsight/internal/apps/das/views/list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
@Time : 2023/06/09 14:26:16
@Author : zongfei.fu
@Author : xff
*/

package views
Expand Down
Loading

0 comments on commit b7feb75

Please sign in to comment.