GithubHelp home page GithubHelp logo

hanchuanchuan / goinception Goto Github PK

View Code? Open in Web Editor NEW
1.6K 47.0 542.0 19.08 MB

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具

Home Page: https://hanchuanchuan.github.io/goInception/

License: GNU General Public License v3.0

Go 93.15% Dockerfile 0.03% Makefile 0.14% Shell 0.16% Yacc 2.14% Perl 4.37% JavaScript 0.02%
go inception tidb

goinception's Introduction

goInception

travis-ci CircleCI Status GitHub release codecov TiDB

[English] [Chinese]

goInception is a MySQL maintenance tool, which can be used to review, implement, backup, and generate SQL statements for rollback. It parses SQL syntax and returns the result of the review based on custom rules.

Documentation: [Document] [中文文档]

[Changelog]


Quick start

Binary

goInception Download

Docker Image

docker pull hanchuanchuan/goinception

Source code compilation

go version 1.14+ (go mod)

git clone https://github.com/hanchuanchuan/goInception.git
cd goInception
go build -o goInception tidb-server/main.go

./goInception -config=config/config.toml

Associated SQL audit platform

  • Archery Query support (MySQL/MsSQL/Redis/PostgreSQL), MySQL optimization (SQLAdvisor|SOAR|SQLTuning), slow log management, table structure comparison, session management, Alibaba Cloud RDS management, etc.

Acknowledgments

GoInception reconstructs from the Inception which is a well-known MySQL auditing tool and uses TiDB SQL parser.

Sponsorship and support

Contact

QQ group talk: 499262190 e-mail: [email protected]

Contributing

Welcome and thank you very much for your contribution. For the process of submitting PR, please refer to CONTRIBUTING.md

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

goinception's People

Contributors

bigchaochao avatar chhan-coupang avatar dependabot[bot] avatar dravening avatar hanchuanchuan avatar hhyo avatar hjweddie avatar honor100 avatar jianhaiqing avatar jincong8973 avatar leoquote avatar linyue515 avatar liuqian1990 avatar magmongoing avatar monkeywithacupcake avatar nwsuafzq avatar romberli avatar shengminjie avatar soul-f avatar testwill avatar thinkdb avatar whhe avatar xiyangxixian avatar yywwann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goinception's Issues

备份库名过长导致回滚语句生成失败

描述
通过archery提交上线工单时无法生产回滚语句,提示如下:
Backup: 备份库名 'rm-hp3oyau9st72lxxxxxx.mysql.huhehaote.rds.aliyuncs.com-3306-xxxxxxx' 过长. Incorrect database name ''. Incorrect database name ''.

kill 操作支持

准备添加kill操作,该issue用以讨论其具体实现。

kill操作在:

  • 检查阶段时,则直接中止整个操作
  • 执行阶段时,中止后续执行操作,并备份已执行的数据
  • 备份阶段时,不允许kill

阿里云rds执行ddl调用gh-ost报错

描述
goinception-v0.8.2执行如下ddl报错如下:
alter table saas_system_config ADD (
conventional_curing_cycle1 int ( 3 ) NOT NULL DEFAULT '30' COMMENT '常规养护周期 单位天',
critical_curing_period1 int ( 3 ) NOT NULL DEFAULT '15' COMMENT '重点养护周期 单位天',
advance_warning_curing1 int ( 3 ) NOT NULL DEFAULT '3' COMMENT '养护提前预警天数',
routine_inspection_cycle1 int ( 3 ) NOT NULL DEFAULT '30' COMMENT '常规检查周期 单位天',
critical_inspection_cycle1 int ( 3 ) NOT NULL DEFAULT '15' COMMENT '重点检查周期 单位天',
advance_warning_inspection1 int ( 3) NOT NULL DEFAULT '3' COMMENT '检查提前预警天数',
early_warning_days1 int ( 3) NOT NULL DEFAULT '5' COMMENT '近效期提前预警天数 默认5天')
image

重现
模拟重现的步骤

环境

  • 数据库: 阿里云rds mysql
  • 版本: 5.7

参数
可能与问题相关的设置参数
image

返回的审核信息

描述您想要的功能:
我在部署archery时使用了goinception,但是审核信息反人类,与inception相比,差太多了,例如当新建表时,我使用了关键字,
会提示如下报错
line 3 column 9 near " varchar(20) not null,primary key(id) ) ENGINE=InnoDB" (total length 151)

另外好多报错类似于total length xxx

添加删除外键都会报错Not supported statement type.

描述
确认enable_foreign_key=true已打开
执行alter table xxx add constraint FK_xxx foreign key (xxx) references xxx(xxx); 或者 ALTER TABLE xxx DROP FOREIGN KEY xxx;都会报错Not supported statement type.

重现
模拟重现的步骤

环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 5.7.21]

参数
enable_foreign_key

通过gh-ost执行包含``的语句,提示语法错误

描述
v0.8.3 通过gh-ost执行包含``的语句,提示语法错误,去除`后正常
旧版本执行是正常的,不确定是哪个版本,docker镜像id:04ec51bc001f,构建于4 weeks ago

重现
配置开启ghost

osc_min_table_size = 0
ghost_on = true

执行语句

ALTER TABLE `archer_test`.`osc_test` DROP COLUMN `xx`;

结果

Execute: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\`xx\`' at line 1.

日志


time="2019/05/26 10:04:51.635" level=info msg="con:73 new connection 172.18.0.5:55140" file=server.go line=319
[2019/05/26 10:04:51] [info] binlogsyncer.go:133 create BinlogSyncer with config {99999 mysql mysql 3306 inception    false false <nil> false UTC true 0 0s 0s 0 false}
[2019/05/26 10:04:51] [info] binlogsyncer.go:354 begin to sync binlog from position (mysql-bin.000002, 101139950)
[2019/05/26 10:04:51] [info] binlogsyncer.go:203 register slave for master server mysql:3306
[2019/05/26 10:04:51] [info] binlogsyncer.go:723 rotate to (mysql-bin.000002, 101139950)
2019-05-26 10:04:51 ERROR Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\`xx\`' at line 1
2019-05-26 10:04:51 ERROR Unable to ALTER ghost table, see further error details. Bailing out
time="2019/05/26 10:04:51.886" level=error msg="Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\\`xx\\`' at line 1" file=osc.go line=532
time="2019/05/26 10:04:51.898" level=info msg="con:73 close connection" file=server.go line=321

去除`再次执行

ALTER TABLE `archer_test`.`osc_test` DROP COLUMN xx;

正常执行

环境

  • goInception: [v0.8.3] docker环境
[root@VM_0_15_centos ~]# docker images|grep goinception
hanchuanchuan/goinception   latest              12571ec1bcef        2 days ago          46.6MB
hanchuanchuan/goinception   <none>              04ec51bc001f        4 weeks ago         46.4MB
  • 数据库: [mysql]
  • 版本: [5.7.25-log]

参数

osc_min_table_size = 0
ghost_on = true

DML 预估受影响行数不准确

描述
对问题简单清晰的描述
配置了 max_update_rows 参数, 实际操作DML语句受影响行数预估不准确,
导致在正常受限update 行数的sql执行报错.

重现
模拟重现的步骤

环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 5.7.21]

参数
可能与问题相关的设置参数
max_update_rows 参数

不支持创建数据库的同时创建表

描述
希望可以在创建库的同时创建表以及执行其他语句,虽然场景很少

重现

-- 语句
create database test_db;
use test_db;
create table t(int);

结果
image

环境

  • 数据库: mysql
  • 版本: 5.7.25-log
  • goInception:v1.0.5

和mycat之类的分布式数据库中间件打通

描述您想要的功能:
希望能和mycat之类的分布式数据库中间件打通,这样在配置数据源的时候可以直接连接mycat,数据库分库后,上线SQL,就可以直接一次性将其路由到所有分库去执行相同的SQL。

描述您考虑过的解决/替代方案:

可参考文档,资料,引用等:

set names charset不支持

描述
set names charset不支持

重现
image

环境

  • 数据库: [mysql]
  • 版本: [例如 5.7.21]

参数
enable_set_charset=true

执行go build报错

构建二进制包

go build -o goInception tidb-server/main.go

go: downloading github.com/coreos/etcd v3.3.10+incompatible
go: downloading golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
go: downloading github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65
go: downloading github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef
go: downloading github.com/gorilla/mux v1.6.2
go: downloading github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/uber/jaeger-client-go v2.15.0+incompatible
go: downloading github.com/BurntSushi/toml v0.3.1
go: downloading github.com/pkg/errors v0.8.0
go: downloading github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5
go: downloading github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5
go: downloading golang.org/x/text v0.3.0
go: downloading github.com/spf13/cast v1.3.0
go: downloading gopkg.in/yaml.v2 v2.2.2
go: verifying github.com/coreos/[email protected]+incompatible: checksum mismatch
downloaded: h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04=
go.sum: h1:KjVWqrZ5U0wa3CxY2AxlH6/UcB+PK2td1DcsYhA+HRs=

没有生成build文件

配置backup等参数不生效

描述
配置以下参数后,启动不生效:
backup_host = "10.1.3.100"
backup_port = 3306
backup_user = "xxx"
backup_password = "xxxxx"

重现
模拟重现的步骤
1,修改config/config.toml.template为config/config.toml
2,在lower-case-table-names = 2下面,加入以下备份参数:
backup_host = "10.1.3.100"
backup_port = 3306
backup_user = "xxx"
backup_password = "xxxxx"
3,启动:
nohup ./goInception -config=config/config.toml &
4,登录到inception,查看参数:
mysql> inception show variables like "backup%";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| backup_host | |
| backup_password | |
| backup_port | 0 |
| backup_user | |
+-----------------+-------+
4 rows in set (0.00 sec)
环境

  • goInception版本: goInception-linux-amd64-v0.8.1.tar.gz
  • goInception -V显示的内容:
    Release Version: None
    Git Commit Hash: None
    Git Branch: None
    UTC Build Time: None
    GoVersion: None
    Race Enabled: false
    TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
    Check Table Before Drop: false
  • go的版本:
    go version go1.12.5 linux/amd64
  • linux版本:
    CentOS Linux release 7.6.1810 (Core)
    Linux conf122 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

add操作无法命中merge_alter_table检测

描述
对同一表的alter操作,如果是ADD 则无法检测出来,modify和change都正常检测

重现

  • 语句
create table visitor1 (id int not null comment 'xxx',createtime datetime(6) default current_timestamp() comment 'xxx',primary key(id)) comment 'xxxxx';
alter table visitor1 add create_at datetime(6) default current_timestamp() comment 'xxx';
alter table visitor1 add update_at datetime(6) default current_timestamp() comment 'xxx';


create table visitor2 (id int not null comment 'xxx',createtime datetime(6) default current_timestamp() comment 'xxx',primary key(id)) comment 'xxxxx';
alter table visitor2 modify createtime datetime(6) default current_timestamp() comment 'xxx';
alter table visitor2 modify createtime datetime(6) default current_timestamp() comment 'xxx';
  • 结果
    image

环境

  • 数据库: [mysql/mariadb]
  • 版本: 5.7.21
  • goInception:v1.0.5

参数


mysql> inception get variables like '%merge_alter_table%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| merge_alter_table | true  |
+-------------------+-------+
1 row in set (0.00 sec)

建议在检测语句没有delimiter结尾时给出友好提示

描述您想要的功能:
希望在检测语句时,如果语句没有以delimiter结尾,可以给出比较友好的提示

  • 语句
INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1);
INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1)
  • 结果
    image

  • log

time="2019/05/10 03:42:29.037" level=error msg="解析失败! line 2 column 51 near \"\" (total length 103)" file=session_inception.go line=311
time="2019/05/10 03:42:29.037" level=error msg="INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1)\n                            inception_magic_commit" file=session_inception.go line=312

描述您考虑的解决/替代方案:
使用更友好文案

可参考文档,资料,引用等:

  • Inception的结果
    image

update语句提示语法错误

描述
使用Archery审核平台,操作sql上线时,SQL检测报错,提示语法错误,但是语法正确,
在另一个测试库里,建相同表,插入相同数据,检测同样的update语句没有问题。
线上数据库是percona mysql 5.5.61,测试环境是percona mysql 5.7.26。
怀疑是goinception对版本mysql的语法解析问题?

重现
image
image

环境

  • 数据库: mysql
  • 版本: 5.5.61有问题,5.7.26没问题

语句在执行过程中被MySQL KILL以后,执行结果仍返回执行和备份成功

描述
语句在执行过程中被MySQL KILL以后,执行结果仍返回执行和备份成功,但实际上没有执行成功
仅测试了DDL语句,DML语句未做验证

重现
执行语句

ALTER TABLE `archer_test`.`osc_test` DROP COLUMN `xx`;

在MySQL中KILL掉对应的进程,执行结果返回

{
	"id": 2,
	"stage": "EXECUTED",
	"errlevel": 2,
	"stagestatus": "Execute Successfully\nBackup Successfully",
	"errormessage": "Execute: invalid connection.",
	"sql": "ALTER TABLE `archer_test`.`osc_test` DROP COLUMN `xx`",
	"affected_rows": 0,
	"sequence": "1558865236_624_00000001",
	"backup_dbname": "mysql_3306_archer_test",
	"execute_time": "4.115",
	"sqlsha1": "",
	"backup_time": "0",
	"actual_affected_rows": ""
}

日志

time="2019/05/26 10:07:12.058" level=info msg="con:80 new connection 172.18.0.5:55452" file=server.go line=319
[mysql] 2019/05/26 10:07:16 packets.go:36: unexpected EOF
time="2019/05/26 10:07:16.174" level=error msg="invalid connection" file=conn.go line=97
time="2019/05/26 10:07:16.183" level=info msg="数据库断开重连" file=conn.go line=152
time="2019/05/26 10:07:16.193" level=error msg="invalid connection" file=session_inception.go line=1252
time="2019/05/26 10:07:16.313" level=info msg="con:80 close connection" file=server.go line=321
time="2019/05/26 10:10:30.456" level=info msg="con:81 new connection 172.18.0.5:55732" file=server.go line=319
time="2019/05/26 10:10:31.206" level=info msg="con:81 close connection" file=server.go line=321

环境

  • goInception: [v0.8.3] docker环境
[root@VM_0_15_centos ~]# docker images|grep goinception
hanchuanchuan/goinception   latest              12571ec1bcef        2 days ago          46.6MB
  • 数据库: [mysql]
  • 版本: [5.7.25-log]

参数

我建分区表的时候审核报错

描述
建分区表审核报错
image
sql语句
CREATE TABLE entity_cms_mirrordata (
id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
topic_id bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '知识点id',
subject_id int(11) unsigned NOT NULL DEFAULT 0 COMMENT '学科id',
system_id bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '学生id',
sourcefrom tinyint(4) unsigned NOT NULL DEFAULT 1 COMMENT '来源: 1 cms后台;2 okay+ ;3 学生端;4 系统推荐',
status tinyint(4) NOT NULL DEFAULT 1 COMMENT '当前状态1正常2删除',
studied_status tinyint(4) NOT NULL DEFAULT 0 COMMENT '学习状态: 0 未学完; 1 学完了',
operator_id int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建人id',
create_time datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '创建时间',
update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
is_firstscreen tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否是首屏 1是0否',
topic_type tinyint(4) NOT NULL DEFAULT 1 COMMENT '知识点类型 1 知识点 2 章节',
sourcefrom_type tinyint(4) NOT NULL DEFAULT 0 COMMENT '来源类型 0系统 1 手动',
is_mirror tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否在魔镜 1是0否',
first_create_time datetime NOT NULL DEFAULT '1900-01-01 00:00:00' COMMENT '创建时间',
mirror_update_time datetime NOT NULL DEFAULT '1900-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT '魔镜修改时间',
stage_id int(11) unsigned NOT NULL DEFAULT 1 COMMENT '学段',
directory_id bigint(20) NOT NULL DEFAULT 0 COMMENT '教材版本体系id',
kidtype bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT 'kid及类型',
PRIMARY KEY (id, system_id) USING BTREE,
UNIQUE KEY uniq_system_type_topic (system_id, topic_type, topic_id) USING BTREE COMMENT '知识点',
KEY idx_system_subject (
system_id,
studied_status,
status,
subject_id,
is_mirror
) USING BTREE
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = 'Cms魔镜数据表'
/*!50100 PARTITION BY HASH (system_id)
PARTITIONS 100 */;

重现
模拟重现的步骤

环境

  • 数据库: [mysql]
  • 版本: [例如 5.7.24]

参数
可能与问题相关的设置参数
max_key_parts | 0
max_keys | 0
enable_identifer_keyword | true
enable_partition_table | true

可以支持字段类型修改吗?

线上用goinception做审核,在提交修改列类型时报错:
Error Type conversion warning for column 'table_name' bigint(20) unsigned -> varchar(64)

我们现在有参数支持修改字段的类型吗?

ddl Not supported statement type

add table test auto_increament 20000 comment 'add';
提示:
Not supported statement type.
原生的inception可以支持。

Not supported statement type

描述
不支持alter table test auto_increament 20000 comment 'test'
原生的inception支持。
重现
alter table test auto_increament 20000 comment 'test'
提示:
Not supported statement type

环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 5.7.21]

参数

变更主键生成的回滚语句有误

描述
修改表主键时,生成的回滚语句有误

重现

-- 执行语句
alter table `users` drop PRIMARY KEY, modify `id` bigint(20) unsigned NOT NULL COMMENT 'id', add new_id bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'new_id', add PRIMARY KEY(new_id)

-- 回滚语句
ALTER TABLE `archer_test`.`users` ADD PRIMARY KEY(`id`),MODIFY COLUMN `id` bigint(20) unsigned NOT NULL COMMENT 'id',DROP COLUMN `new_id`,DROP PRIMARY KEY;

-- 正确回滚语句
ALTER TABLE `archer_test`.`users` DROP PRIMARY KEY,MODIFY COLUMN `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',DROP COLUMN `new_id`,ADD PRIMARY KEY(`id`);

环境

  • 数据库: mysql
  • 版本: 5.7.25-log
  • goInception:v1.0.5

建议添加修改字段类型的审核开关

描述您想要的功能:
想忽略修改字段类型时的警告

描述您考虑过的替代方案:
添加一个审核开关,控制是否审核字段类型的变更

可参考文档,资料,引用等:

Identifier 'user' is keyword in MySQL

描述
�语法树无法解析包含 mysql关键字的sql语句。

重现
select * from user;

环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 5.7.21]

参数
可能与问题相关的设置参数

多个timestamp列 default检查

mysql的5.7版本对timestamp的限制取消了很多,所以准备移除对timestamp的部分限制:
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

提供语法树打印功能

是否可以提供类似于Inception的语法树打印功能

  • 支持打印完整的语法树
  • 支持直接获取SQL涉及的真实库、表名

环境搭建错误

执行 make parser时报以下错误,网络是正常的,也可以翻墙。

go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: google.golang.org/[email protected]: unrecognized import path "google.golang.org/genproto" (https fetch: Get https://google.golang.org/genproto?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
go: finding gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce
go: gopkg.in/[email protected]: git fetch -f https://gopkg.in/mgo.v2 refs/heads/:refs/heads/ refs/tags/:refs/tags/ in /Users/ouyangbin/Workspace/dev/golang/pkg/mod/cache/vcs/71c6fba555fd7b185c93dcad3ed507d63007e825cf56a4a329b0e102990a7036: exit status 128:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
go: error loading module requirements

[bug] 不支持json类型

描述
alter table wb_today_baby add column self_like_s3 json DEFAULT null COMMENT '自定义点赞场景3';
添加json类型字段的时候goinception报错:
不允许使用json类型(列'self_like_s3').

环境

  • 数据库: [mysql/mariadb]
  • 版本: [例如 8.01]

语句在执行过程中被MySQL KILL以后,执行结果仍返回执行和备份成功

描述
语句在执行过程中被MySQL KILL以后,执行结果仍返回执行和备份成功,并且回滚语句确实已经生成
但实际上没有执行成功,此时MySQL已经回滚

仅测试了DDL语句,DML语句未做验证

重现
执行语句

ALTER TABLE `archer_test`.`osc_test` DROP COLUMN `xx`;

在MySQL中KILL掉对应的进程,执行结果返回

{
	"id": 2,
	"stage": "EXECUTED",
	"errlevel": 2,
	"stagestatus": "Execute Successfully\nBackup Successfully",
	"errormessage": "Execute: invalid connection.",
	"sql": "ALTER TABLE `archer_test`.`osc_test` DROP COLUMN `xx`",
	"affected_rows": 0,
	"sequence": "1558865236_624_00000001",
	"backup_dbname": "mysql_3306_archer_test",
	"execute_time": "4.115",
	"sqlsha1": "",
	"backup_time": "0",
	"actual_affected_rows": ""
}

日志

time="2019/05/26 10:07:12.058" level=info msg="con:80 new connection 172.18.0.5:55452" file=server.go line=319
[mysql] 2019/05/26 10:07:16 packets.go:36: unexpected EOF
time="2019/05/26 10:07:16.174" level=error msg="invalid connection" file=conn.go line=97
time="2019/05/26 10:07:16.183" level=info msg="数据库断开重连" file=conn.go line=152
time="2019/05/26 10:07:16.193" level=error msg="invalid connection" file=session_inception.go line=1252
time="2019/05/26 10:07:16.313" level=info msg="con:80 close connection" file=server.go line=321
time="2019/05/26 10:10:30.456" level=info msg="con:81 new connection 172.18.0.5:55732" file=server.go line=319
time="2019/05/26 10:10:31.206" level=info msg="con:81 close connection" file=server.go line=321

环境

  • goInception: [v0.8.3] docker环境
[root@VM_0_15_centos ~]# docker images|grep goinception
hanchuanchuan/goinception   latest              12571ec1bcef        2 days ago          46.6MB
  • 数据库: [mysql]
  • 版本: [5.7.25-log]

参数

delete 语句不支持别名

描述
delete 语句不支持别名

重现

use test;
delete t1 from abc as t1 where t1.id = 1;

审核时会出现 Table 'test.t1' doesn't exist.

原来的 inception 中就有这个 issue: arkdb/inception#72

环境

  • 数据库: [mysql]
  • 版本: [例如 5.7.21]

make parser 报错

因为无法翻墙
mv go.mod go.mod_bak
cp go.mod_wall go.mod

make parser
报错如下:
Parse table entries: 824515 of 2072063, x 16 bits == 1649030 bytes
bin/goyacc -o parser/parser.go parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; exit 1;}}'
rm -f y.output

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.