Giter Site home page Giter Site logo

arkdb / inception Goto Github PK

View Code? Open in Web Editor NEW
1.8K 217.0 1.3K 17.41 MB

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

License: GNU General Public License v2.0

Shell 0.96% CMake 0.83% C 50.21% C++ 43.13% Perl 1.92% Roff 0.22% CSS 0.02% HTML 0.01% Batchfile 0.02% Pascal 0.20% Makefile 0.01% Python 0.11% Objective-C 1.08% Yacc 1.23% DTrace 0.04% M4 0.01% JavaScript 0.02%
mysql inception mariadb

inception's People

Contributors

mysql-inception avatar netroby avatar tan-chao avatar xiaokunkung 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  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

inception's Issues

inception统计信息不准确的问题

在做update变更时,常常会出现实际只更新了10多行,但是在SQL check阶段,警告说有超过inception_max_update_rows参数设置值的大量行更新。

经验碰到Backup时报错

Backup: Corrupted replication event was detected. 和 Backup: Got packets out of order,请问这个是哪里的报错,需要哪里做调整?

关联删除时 有问题。

DELETE a from balance_log a,tmp_log b where a.type in (20, 95) AND a.ins_tm> '2017-05-19' and a.trade_no= b.trade_no and a.id<> b.id;

关于报错:Backup: Commands out of sync; you can't run this command now

你好,我在测试 Inception 备份功能的时候,遇到了如下的错误:

Backup failed | Backup: Commands out of sync; you can't run this command now。

SQL语句如下:

sql='/*--user=root;--password=123456;--host=192.168.113.130;--enable-execute;--port=3309;*/\
inception_magic_start;\
use test;\
update test set a = "test1" where b = "sdfsdf";\
inception_magic_commit;'

用了文档中的示例程序(python客户端),其它部分一样,备份库指定了同样的端口。
关于这个报错我查了下发现mysql.info中有这样的说明:

If you get `Commands out of sync; you can't run this command now' in
your client code, you are calling client functions in the wrong order.

This can happen, for example, if you are using *Note
mysql_use_result()': mysql-use-result. and try to execute a new query before you have called *Notemysql_free_result()': mysql-free-result.
It can also happen if you try to execute two queries that return data
without calling *Note mysql_use_result()': mysql-use-result. or *Note mysql_store_result()': mysql-store-result. in between.

不知是否有这样的问题,还是我使用不当呢?

ddl时调用osc异常:Execute: Got an error reading communication packets.

Hi,
各位有遇到么,有什么解决办法么!
直接脚本执行,例子很简单,报错如下:
['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']
1 | RERUN | 0 | Execute Successfully | None | 2 | EXECUTED | 2 | Execute failed | Execute: Got an error reading communication packets. |

centos 7 编译报错

Linking CXX executable mysql
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x24): undefined reference to mysql_net__write__start_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x70): undefined reference to mysql_net__write__done_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0xbc): undefined reference to mysql_net__write__done_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x108): undefined reference to mysql_net__write__start_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x154): undefined reference to mysql_net__write__done_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1a0): undefined reference to mysql_net__write__done_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1ec): undefined reference to mysql_net__read__start_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x230): undefined reference to mysql_net__read__done_semaphore'
collect2: error: ld returned 1 exit status
make[2]: *** [client/mysql] Error 1
make[1]: *** [client/CMakeFiles/mysql.dir/all] Error 2
make: *** [all] Error 2

C接口使用inception语法错误

在使用mysql的C API连接到inception做语法审核时,提示语法错误,原因在与无法识别inception_magic_start等语句,请问该如何解决。

INSERT报Access denied

Env
MySQL: 5.6.29-log
Inception: 2.1.50

=====================================
表结构

CREATE TABLE `t2` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT ,
  `menu_name` varchar(64) NOT NULL DEFAULT '' ,
  `menu_url` varchar(128) DEFAULT '' ,
  `pid` int(10) DEFAULT '0' ,
  `mark` varchar(255) NOT NULL DEFAULT '' ,
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
  `create_by` varchar(64) NOT NULL DEFAULT '' ,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `update_by` varchar(64) NOT NULL DEFAULT '' ,
  `is_deleted` char(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

检测执行SQL
INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, '流量监测平台', '', 0, '导航菜单(一级菜单)','0');

检测信息
4 | CHECKED | 0 | Audit completed | None | INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, '流量监测平台', '', 0, '导航菜单(一级菜单)','0') | 1 |

执行信息
EXECUTED | 2 | Execute failed | Execute: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation | INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, '流量监测平台', '', 0, '导航菜单(一级菜单)','0') | 0 |

inception osc信息不准确

一个单子有多条sql语句时, 如果alter表的语句前面有delete,select之类语句 会导致审核与执行过程中,inception出现sqlsha1变化的bug,alter表的审核时的sqlsha1和执行时的sqlsha1不是同一个值,导致无法inception get osc_percent ‘sqlsha1’命令获取信息,必须inception get osc processlist 去看真正的sqlsha1值。

一个单子多条sql,如果delete ,select之类sql语句放在alter语句之后倒是没有影响,审核时与执行中的alter语句的sqlsha1值都相同。

多条SQL一起执行时,是否能支持事物

多条SQL一起执行时,是否能支持事物,如果其中任意一条SQL执行失败,其他已经成功的可以回滚
文档里面看到相关配置只有这个:--enable-force,遇到错误是否继续执行

image

sql语句无法审核,抛出Incorrect database name '' 错误

下面语句中直接在解释器执行是没问题的, 但是使用inception检查的时候,机会抛出
Incorrect database name '', 不知道,是哪里的原因,能帮忙看下吗?
sql 语句为:
USE test ;

UPDATE
test1 as t1,
(SELECT
id
FROM
test2
WHERE id = 2) as t2
SET
name = 'lisi'
WHERE t1.id = t2.id ;

数据备份表添加opid_time索引

需要在数据备份表上面添加opid_time的索引,以帮助提速当查询数据量大之后发生缓慢的情况。
最好可以兼容以前的版本,在新版中给历史表自动添加上这个索引。

ubuntu 14.04 安装后无法启动

显示如下
Warning: World-writable config file '/home/yangyanbin/inc.cnf' is ignored
2015-09-08 15:44:08 0 [Note] Welcome to use Inception2.0.18-beta
2015-09-08 15:44:08 11147 [Note] Server hostname (bind-address): '*'; port: 3306
2015-09-08 15:44:08 11147 [Note] IPv6 is available.
2015-09-08 15:44:08 11147 [Note] - '::' resolves to '::';
2015-09-08 15:44:08 11147 [Note] Server socket created on IP: '::'.
2015-09-08 15:44:08 11147 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2015-09-08 15:44:08 11147 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2015-09-08 15:44:08 11147 [ERROR] Aborting

语法树返回json值在使用如下SQL时有问题

inception版本:Server version: Inception2.1.50 1

在使用语法解析树功能时,有两条SQL解析出来的json值不合法,需要作者检查下,过程如下:

新建表并插入数据
CREATE TABLE t1 (
id int(11) DEFAULT NULL,
name varchar(32) DEFAULT NULL COMMENT 't1.name column',
no varchar(20) DEFAULT NULL,
remark varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into t1 values (1,10,'n1','432fdsa','{"addressContacts":"张三","addressDetail":"**浙江","addressPhone":"0571-89012766"}');

场景一
update t1 set remark='{"addressContacts":"李四","addressDetail":"**上海","addressPhone":"0571-89012766"}' where id=1;

语法树解析出的json值第15行有问题,不是合法的json格式
{
"command": "update",
"set_fields": {
"fields": [
{
"type": "FIELD_ITEM",
"db": "dbzza",
"table": "t1",
"field": "remark"
}
],
"values": [
{
"type": "STRING_ITEM",
"value": "{"addressContacts":"李四","addressDetail":"**上海","addressPhone":"0571-89012766"}"
}
]
},
"table_ref": [
{
"db": "dbzza",
"table": "t1"
}
],
"where": [
{
"type": "FUNC_ITEM",
"func": "=",
"args": [
{
"type": "FIELD_ITEM",
"db": "dbzza",
"table": "t1",
"field": "id"
},
{
"type": "INT_ITEM",
"value": "1"
}
]
}
]
}

场景二
update t1 set num = -1 where id = 1;
语法树解析出的json值第14行出错,不是合法的json格式
{
"command": "update",
"set_fields": {
"fields": [
{
"type": "FIELD_ITEM",
"db": "dbzza",
"table": "t1",
"field": "num"
}
],
"values": [
{
"type": "FUNC_ITEM",

        }
    ]
},
"table_ref": [
    {
        "db": "dbzza",
        "table": "t1"
    }
],
"where": [
    {
        "type": "FUNC_ITEM",
        "func": "=",
        "args": [
            {
                "type": "FIELD_ITEM",
                "db": "dbzza",
                "table": "t1",
                "field": "id"
            },
            {
                "type": "INT_ITEM",
                "value": "1"
            }
        ]
    }
]

}

使用nohup启动,默认监听IPV6问题

先赞一个~_~

Evn
OS: CentOS 6.x
Inception: 2.1.49

启动方式
nohup Inception --defaults-file=/etc/inc.cnf &

启动日志
2017-02-13 10:09:47 0 [Note] Welcome to use Inception2.1.49 /usr/bin/Inception, Version: Inception2.1.49 (Source distribution). started with: Tcp port: 16669 Unix socket: /tmp/inc.socket Time Id Command Argument 2017-02-13 10:09:47 6748 [Note] Server hostname (bind-address): '*'; port: 16669 2017-02-13 10:09:47 6748 [Note] Server hostname (bind-address): '*'; port: 16669 2017-02-13 10:09:47 6748 [Note] IPv6 is available. 2017-02-13 10:09:47 6748 [Note] - '::' resolves to '::'; 2017-02-13 10:09:47 6748 [Note] Server socket created on IP: '::'.

问题
在使用execute的时候,会报错:

['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']
1 | RERUN | 0 | Execute Successfully | None | 2 | RERUN | 0 | Execute Successfully | None | 3 | EXECUTED | 2 | Execute Successfully
Backup failed | Backup: Access denied for user 'inception'@'::1' (using password: YES)
Backup: Access denied for user 'inception'@'::1' (using password: YES) |

1.可以使用/etc/inc.cnf中的backup用户密码通过mysql登录;
2.backup用户授权使用了@'localhost‘;
3.从报错信息及日志看,大概是inception默认使用了 'inception'@'::1'验证。

求解决方式,有没有办法禁用监听IPV6?
为了相对保障backup用户安全,只允许从本机运行。
tks.

character_set_client 字符集不支持

hi,我安装Inception后,ERROR 2585 (HY000): Unknown system variable 'character_set_client'.
执行语句如果涉及到character_set_client都会报错
后来发现是安装后不支持character_set_client,请问有什么办法解决

mysql> status

mysql Ver 14.14 Distrib 5.5.23, for Linux (x86_64) using readline 5.1

Connection id: 2
Current database: 1
Current user: NONE
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: Inception2.1.23 1
Protocol version: 10
Connection: 127.0.0.1 via TCP/IP
ERROR 2585 (HY000): Unknown system variable 'character_set_client'.
Client characterset: utf8
Server characterset: utf8

TCP port: 6669

没有备份

inception 的备份信息已经配置如下:
inception_remote_system_password=inception_web
inception_remote_system_user=inception_web
inception_remote_backup_port=8801
inception_remote_backup_host=10.10.xx.xx

通过python 执行命令返回如下。
但是在对应的备份数据库上没有看到 192_168_27_54_3331_DB_CAMPUS_V2这个备份数据库

['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']
((1L, 'RERUN', 0L, 'Execute Successfully', 'None', 'use DB_CAMPUS_V2', 0L, "'1511160402_12233_0'", 'None', '0.010', ''), (2L, 'EXECUTED', 0L, 'Execute Successfully', 'None', 'insert into tmp_table(resume_id,wish_id,CR_RESUME_ID) values(211,223,223)', 1L, "'1511160402_12233_1'", '192_168_27_54_3331_DB_CAMPUS_V2', '0.030', ''))
[Finished in 1.2s]

aliyun centos7.3 变异报错

Linking CXX executable mysql
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x24): undefined reference to mysql_net__write__start_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x70): undefined reference to mysql_net__write__done_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0xbc): undefined reference to mysql_net__write__done_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x108): undefined reference to mysql_net__write__start_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x154): undefined reference to mysql_net__write__done_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1a0): undefined reference to mysql_net__write__done_semaphore'
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1ec): undefined reference to mysql_net__read__start_semaphore' ../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x230): undefined reference to mysql_net__read__done_semaphore'
collect2: error: ld returned 1 exit status
make[2]: *** [client/mysql] Error 1
make[1]: *** [client/CMakeFiles/mysql.dir/all] Error 2
make: *** [all] Error 2

The backup dbname is too long.

因为备份数据库的库名是ip+端口+库名的,mysql库名有限制最长64字符,阿里云RDS的ip是一个长串的域名,太长了会报错。
The backup dbname 'rdsskjsdjwiqjsmq113aaa222.mysql.rds.aliyuncs.com-3306-business_business' is too long.

inception_max_update_rows 参数限制

默认 inception_max_update_rows=10000
执行了一个update语句,根据条件select 实际只有两行,报more than 10000.
语句加了limit 2,结果还是一样

Centos 7.0 编译报错

[ 62%] Built target symlink_libmysqlclient_r.so.18.0.0
Linking CXX executable mysql
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x24):对‘mysql_net__write__start_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x70):对‘mysql_net__write__done_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0xbc):对‘mysql_net__write__done_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x108):对‘mysql_net__write__start_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x154):对‘mysql_net__write__done_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1a0):对‘mysql_net__write__done_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x1ec):对‘mysql_net__read__start_semaphore’未定义的引用
../libmysql/libmysqlclient.a(net_serv.cc.o):(.note.stapsdt+0x230):对‘mysql_net__read__done_semaphore’未定义的引用

使用云数据库无法拿到dml的回滚语句

hi~我这边使用云数据库无法拿到回滚语句,但是使用自建数据库可以拿到被修改数据的回滚语句(账号权限设置和云数据库一样),不知是哪个环节导致拿不到数据,请指教。
具体现象是在$$inception_backup_information$$中能拿到binlog的位置,但是rollback_statement是空的。
image

image

查询osc进度时,inception core dump

在执行例如inception get osc_percent '*7ED4A8DA0B6686B71BD1371223319D8B97D924D8'命令时,inception进度core dump。以下是gdb输出:

gdb ./mysql/bin/Inception core.11117

GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /app/inception/mysql/bin/Inception...(no debugging symbols found)...done.
[New Thread 46959]
[New Thread 11117]
[New Thread 46951]
Missing separate debuginfo for
Try: yum --disablerepo='' --enablerepo='-debug*' install /usr/lib/debug/.build-id/ff/4cbaae51a93124ed31c2b1386ce92ff24aebc3
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /lib64/libcrypt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libcrypt.so.1
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /usr/lib64/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libfreebl3.so...(no debugging symbols found)...done.
Loaded symbols for /lib64/libfreebl3.so
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /lib64/libnss_dns.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_dns.so.2
Reading symbols from /lib64/libresolv.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libresolv.so.2
Core was generated by `./mysql/bin/Inception --defaults-file=inc.cnf'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000000006128ba in mysql_execute_inception_osc_show(THD*) ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.x86_64 libgcc-4.4.7-4.el6.x86_64 libstdc++-4.4.7-4.el6.x86_64 nss-softokn-freebl-3.14.3-9.el6.x86_64
(gdb)

centos 7 编译报错

#define YYTHD ((THD *)yythd)
^
/opt/inception/sql/sql_yacc.yy:39:14: 附注:in expansion of macro ‘YYTHD’
#define Lex (YYTHD->lex)
^
/opt/inception/sql/sql_yacc.yy:16324:7: 附注:in expansion of macro ‘Lex’
{ Lex->xa_opt=XA_NONE; }
^
/opt/inception/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
#define YYTHD ((THD *)yythd)
^
/opt/inception/sql/sql_yacc.yy:39:14: 附注:in expansion of macro ‘YYTHD’
#define Lex (YYTHD->lex)
^
/opt/inception/sql/sql_yacc.yy:16326:7: 附注:in expansion of macro ‘Lex’
{ Lex->xa_opt=XA_SUSPEND; }
^
/opt/inception/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
#define YYTHD ((THD *)yythd)
^
/opt/inception/sql/sql_yacc.yy:39:14: 附注:in expansion of macro ‘YYTHD’
#define Lex (YYTHD->lex)
^
/opt/inception/sql/sql_yacc.yy:16332:7: 附注:in expansion of macro ‘Lex’
| FOR_SYM MIGRATE_SYM { Lex->xa_opt=XA_FOR_MIGRATE; }
^
/opt/inception/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
#define YYTHD ((THD *)yythd)
^
/opt/inception/sql/sql_yacc.yy:39:14: 附注:in expansion of macro ‘YYTHD’
#define Lex (YYTHD->lex)
^
/opt/inception/sql/sql_yacc.yy:16338:23: 附注:in expansion of macro ‘Lex’
LEX *lex= Lex;
^
/opt/inception/sql/sql_yacc.yy:31:23: 错误:‘yythd’在此作用域中尚未声明
#define YYTHD ((THD *)yythd)
^
/opt/inception/sql/sql_yacc.yy:39:14: 附注:in expansion of macro ‘YYTHD’
#define Lex (YYTHD->lex)
^
/opt/inception/sql/sql_yacc.yy:16348:23: 附注:in expansion of macro ‘Lex’
LEX *lex= Lex;
^
make[2]: *** [sql/CMakeFiles/sql.dir/sql_yacc.cc.o] 错误 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] 错误 2

INSERT语句主键冲突不能检测出来

Env
MySQL: 5.6.29-log
Inception: 2.1.50

=====================================
表结构

CREATE TABLE `t2` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT ,
  `menu_name` varchar(64) NOT NULL DEFAULT '' ,
  `menu_url` varchar(128) DEFAULT '' ,
  `pid` int(10) DEFAULT '0' ,
  `mark` varchar(255) NOT NULL DEFAULT '' ,
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
  `create_by` varchar(64) NOT NULL DEFAULT '' ,
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `update_by` varchar(64) NOT NULL DEFAULT '' ,
  `is_deleted` char(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

INSERT语句主键冲突不能检测
测试SQL
INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, 'test1', '', 0, 'test2','0');
1.正常执行一次INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, 'test1', '', 0, 'test2','0');
2.第二次,同一条SQL。
2.1先check

EXECUTED | 0 | Execute Successfully
Backup successfully | None | INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, 'test1', '', 0, 'test2','0')

2.2 执行,这时候才提示主键冲突。
EXECUTED | 2 | Execute failed | Execute: Duplicate entry '1' for key 'PRIMARY' | INSERT INTO t2 (id,menu_name,menu_url,pId,mark,is_deleted) VALUES (1, 'test1', '', 0, 'test2','0')

需求
不知道能不能在check的时候实现提示主键冲突?

mysql5.6.16 + centos6.5 异常

OS:Red Hat Enterprise Linux Server release 6.5 (Santiago)
MySQL:5.6.16-log MySQL Community Server (GPL)

正常启动服务后,连接inception服务,报 Segmentation fault 异常(直连mysqld,正常):
tcp 0 0 :::6669 :::* LISTEN 39931/Inception

mysql -uroot -h10.10.10.42 -P6669

......
Server version: Inception2.1.50
......
Segmentation fault (core dumped)

回滚记录没有写入

image

image

配置里配了备份服务器, 执行时也有sequencebackup_dbname的信息,但是为啥信息没有写入呢?

该怎么查看原因,查inception的log里面没有这方面的信息。

INT类型字段default ''检测问题

Env
MySQL: 5.6.29-log
Inception: 2.1.50

表结构
CREATE TABLE t1(id INT (10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键', PRIMARY KEY (id) ) ENGINE = INNODB DEFAULT CHARSET = utf8 COMMENT = '测试表';

检测语句
ALTER TABLE t1 ADD COLUMN STATUS INT (11) NULL DEFAULT '' COMMENT '状态';

检测结果
通过。
4 | CHECKED | 0 | Audit completed | None | ALTER TABLE t1 ADD COLUMN STATUS INT (11) NULL DEFAULT '' COMMENT '状态' | 2 | '0_0_3' | 192_168_62_218_63306_test | 0 |

执行结果
失败。
4 | EXECUTED | 2 | Execute failed | Execute: Invalid default value for 'STATUS' | ALTER TABLE t1 ADD COLUMN STATUS INT (11) NULL DEFAULT '' COMMENT '状态' | 0 | '0_0_3' | 192_168_62_218_63306_test | 0.000 |

需求
能否检测不让通过,直接报错。

安装时报libmysql/libmysqlclient.so.18.0.0错误

[ 61%] Building CXX object libmysql/CMakeFiles/libmysql.dir/libmysql_exports_file.cc.o
Linking CXX shared library libmysqlclient.so
libclientlib.a(net_serv.cc.o): In function my_net_write': net_serv.cc:(.text+0x605): undefined reference to __dtrace_mysql___net__write__start'
net_serv.cc:(.text+0x74d): undefined reference to __dtrace_mysql___net__write__done' net_serv.cc:(.text+0x786): undefined reference to __dtrace_mysql___net__write__done'
libclientlib.a(net_serv.cc.o): In function net_write_command': net_serv.cc:(.text+0x813): undefined reference to __dtrace_mysql___net__write__start'
net_serv.cc:(.text+0x92e): undefined reference to __dtrace_mysql___net__write__done' net_serv.cc:(.text+0xbae): undefined reference to __dtrace_mysql___net__write__done'
libclientlib.a(net_serv.cc.o): In function my_net_read': net_serv.cc:(.text+0xc1e): undefined reference to __dtrace_mysql___net__read__start'
net_serv.cc:(.text+0xc77): undefined reference to `__dtrace_mysql___net__read__done'
collect2: error: ld returned 1 exit status
make[2]: *** [libmysql/libmysqlclient.so.18.0.0] Error 1
make[1]: *** [libmysql/CMakeFiles/libmysql.dir/all] Error 2
make: *** [all] Error 2

联合索引报Specified key 'xx' was too long

Env
MySQL: 5.6.29-log
Inception: 2.1.50

=====================================
表结构
CREATE TABLE t1(idint(10) unsigned NOT NULL,c1varchar(64) DEFAULT NULL,c2varchar(255) DEFAULT NULL,c3varchar(64) DEFAULT NULL,c4 varchar(128) DEFAULT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

检测语句
alter table t1 add index idx_c1_c2_c3_c4 (c1, c2,c3,c4)

报错信息
4 | CHECKED | 2 | Audit completed | Specified key 'idx_c1_c2_c3_c4' was too long; max key length is 767 bytes.

客户端可以执行。

英文提示语法不对,但也能看懂。

['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']
1 | CHECKED | 0 | Audit completed | None | 2 | CHECKED | 1 | Audit completed | Set engine to innodb for table 'adaptive_office'.
Set charset to one of 'utf8mb4' for table 'adaptive_office'.
Set comments for table 'adaptive_office'.
Column 'id' in table 'adaptive_office' have no comments.
Column 'id' in table 'adaptive_office' is not allowed to been nullable.
Set Default value for column 'id' in table 'adaptive_office'
Set a primary key for table 'adaptive_office'. |

若要国际化,建议找个英文编辑,好好校对一下!

编译的时候 报错/home/hujun/inception-master/sql/sql_locale.cc:1: 错误:程序中有游离的‘\357’

从git下载下来到linux服务器,版本:
SUSE Linux Enterprise Server 11 SP2 (x86_64)

按照教程里面编译,结果报错,如下:
/home/hujun/inception-master/sql/sql_locale.cc:1: 错误:程序中有游离的‘\357’
/home/hujun/inception-master/sql/sql_locale.cc:1: 错误:程序中有游离的‘\273’
/home/hujun/inception-master/sql/sql_locale.cc:1: 错误:程序中有游离的‘\277’
make[2]: *** [sql/CMakeFiles/sql.dir/sql_locale.cc.o] 错误 1
make[1]: *** [sql/CMakeFiles/sql.dir/all] 错误 2
make: *** [all] 错误 2

inception drop一个表和create一个表放在同一个单子里面执行导致inception进程挂掉

drop table good_course_channel_source          
  CREATE TABLE good_course_channel_source ( id int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', course_number bigint(20) NOT NULL DEFAULT '0' COMMENT '课程number', date datetime DEFAULT NULL COMMENT '日期', source_lv1 varchar(40) NOT NULL DEFAULT '' COMMENT '一级渠道', source varchar(40) NOT NULL DEFAULT '' COMMENT '渠道', client_id tinyint(2) NOT NULL DEFAULT '0' COMMENT '终端 1:PC, 2:ANDROID, 3:IPHONE, 4:IPAD, 5:WAP, 6:APP', count int(10) DEFAULT '0' COMMENT '报名数', PRIMARY KEY (id), UNIQUE KEY course_number_date (course_number,date,source_lv1,source,client_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='精品课渠道来源'

这两条sql分开给inception去执行都没问题,写在一起提交给inception执行就导致inception进程挂掉,去掉了inception的自动merge后仍然不行。

SQL语法错误,导致inception core dump

我用Inception执行了alter table t1 comment ='xxx'; 其生成的回滚语句是alter table t1;
然后我用回滚语句alter table t1;去审核,能够审核通过。但是执行时,就导致Inception core dump。
这里分2种情况,如果表小于inception_osc_min_table_size,则不会core dump;否则会100% core dump。
Server version: Inception2.1.50 1

以下是gdb输出
#0 __strlen_sse2 () at ../sysdeps/x86_64/strlen.S:32
#1 0x000000394ec81166 in __strdup (s=0x0) at strdup.c:42
#2 0x00000000006daaef in mysql_execute_alter_table_osc (thd=0x28f4c40, mysql=0x28f8060, statement=0x7f23ac007410 "ALTER TABLE t1", sql_cache_node=0x7f23ac014960)
at /app/inception_source_code/inception/sql/sql_parse.cc:10466
#3 0x00000000006db7e3 in mysql_execute_statement (thd=0x28f4c40, mysql=0x28f8060, statement=0x7f23ac007410 "ALTER TABLE t1", sql_cache_node=0x7f23ac014960)
at /app/inception_source_code/inception/sql/sql_parse.cc:10676
#4 0x00000000006dbe8c in mysql_remote_execute_command (thd=0x28f4c40, mysql=0x28f8060, sql_cache_node=0x7f23ac014960) at /app/inception_source_code/inception/sql/sql_parse.cc:10799
#5 0x00000000006dc211 in mysql_execute_all_statement (thd=0x28f4c40) at /app/inception_source_code/inception/sql/sql_parse.cc:10867
#6 0x00000000006dc6f5 in mysql_execute_commit (thd=0x28f4c40) at /app/inception_source_code/inception/sql/sql_parse.cc:10997
#7 0x00000000006ddfaa in mysql_show_print_and_execute_simple (thd=0x28f4c40) at /app/inception_source_code/inception/sql/sql_parse.cc:11522
#8 0x00000000006de40c in mysql_process_command (thd=0x28f4c40, parser_state=0x7f23b2e4cbd0) at /app/inception_source_code/inception/sql/sql_parse.cc:11627
#9 0x00000000006de53d in mysql_parse (thd=0x28f4c40, length=22, parser_state=0x7f23b2e4cbd0) at /app/inception_source_code/inception/sql/sql_parse.cc:11664
#10 0x00000000006be8dd in dispatch_command (command=COM_QUERY, thd=0x28f4c40,
packet=0x28f91d1 "/--user=root;--password=123;--host=192.168.1.42;--enable-execute;--port=3306; --enable-ignore-warnings;--disable-remote-backup;/", ' ' <repeats 20 times>, "inception_magic_start;", ' ' <repeats 20 times>, "use"..., packet_length=281) at /app/inception_source_code/inception/sql/sql_parse.cc:1077
#11 0x00000000006bc29b in do_command (thd=0x28f4c40) at /app/inception_source_code/inception/sql/sql_parse.cc:489
#12 0x0000000000694c19 in do_handle_one_connection (thd_arg=0x28f4c40) at /app/inception_source_code/inception/sql/sql_connect.cc:926
#13 0x00000000006949ba in handle_one_connection (arg=0x28f4c40) at /app/inception_source_code/inception/sql/sql_connect.cc:842
#14 0x000000394f0079d1 in start_thread (arg=0x7f23b2e4d700) at pthread_create.c:301
#15 0x000000394ece8b6d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

执行python接口脚本返回Access denied for user 'repl'@'192.168.1.28' (using password: YES)

部署inception后使用python测试环境,但是返回以下:
['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']
1 | NONE | 2 | None | Access denied for user 'repl'@'192.168.1.28' (using password: YES) | Global environment | 0 | None | None | 0 | None

但是远程通过mysql登陆是没有问题的,换其他帐号也是同样报这个没权限

脚本如下:
#!/usr/bin/python
#-*-coding: utf-8-*-
import MySQLdb

sql='/--user=repl;--password=repl123456;--host=192.168.1.99;--port=3306;--enable-check;/
inception_magic_start;
user test;
create table t1(id int);
inception_magic_commit;'

try:
conn=MySQLdb.connect(host='127.0.0.1',port=6669)
cur=conn.cursor()
ret=cur.execute(sql)
result=cur.fetchall()
num_fields = len(cur.description)
field_names = [i[0] for i in cur.description]
print field_names
for row in result:
print row[0], "|",row[1],"|",row[2],"|",row[3],"|",row[4],"|",row[5],"|",row[6],"|",row[7],"|",row[8],"|",row[9],"|",row[10]
cur.close()
conn.close()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])

求大神解答,谢谢。。。

inception调osc的时候不支持--set-vars选项?

pt-online-schema-change支持--set-vars选项,可以传一些mysql variables的不同设置,比如--set-vars wait_timeout=500,但是我看文档发现,inception调osc的时候,并不支持该参数。

Inception对于pymysql链接的几个使用反馈

  • Pymysql在链接inception在判断版本时出现value error,pymysql在检测mysql版本时会报错。

  • pymysql模块会自动向inception发送SHOW WARNINGS语句,导致Inception始终反馈"Must start as begin statement"的语法错误

请官方看看是否有方法解决。

Ps.目前采用修改pymysql源码的方式来配合Inception,但这种处理方式会有很大的隐患,比如会忽略所有警告等,希望官方给点建议。(不考虑更换mysqldb的情况)

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.