hanchuanchuan / goInception

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具
https://hanchuanchuan.github.io/goInception/
GNU General Public License v3.0
1.59k stars 545 forks source link

执行存储过程报错 #642

Open YangLiuMZ opened 2 months ago

YangLiuMZ commented 2 months ago

执行存储过程报错: err: line 1 column 186 near "CALL sp_count;; inception_magic_commit" 日志: time="2024/04/22 11:10:16.936" level=error msg="con: 13801 parsing failed! Line 1 column 186 near \" call sp_count \ n; "File=session insertion. go fun=executeInc line=219" Time="2024/04/22 11:10:16.936" level=error msg="/ -- user=mysql; -- password=024; -- host=10.5.1.3; -- port=3306; -- db=yl; -- enable check;; -- sleep=-1; -- sleep_rows=-1; /nception_mgic_start; use yl; call sp_count \ n; inception_mgic_commit" file=session insertion. go fun=executeInc line=220 Time="2024/04/22 11:10:16.936" level=info msg="[GENERAL-LOG] con: 13801 user: root@10.46.56.227 SQL:/ -- user=mysql-- Password=024-- Host=10.5.1.3-- Port=3306-- Db=yl-- Enable check-- Sleep=-1-- Sleep rows=-1/ Inception_magicstart; Use yl; Call sp_count; Inception_magic.commit; "File=session. go fun=logQuery line=1606" Time="2024/04/22 11:10:16.975" level=info msg="con: 13801 close connection" file=server. go fun=fun 1 line=321 使用"skip_sqls" 跳过CALL语句没有生效,请问这个skip_sqls参数可以控制不审核call语句吗,或者其他方式,可以直接执行call CALL sp_count;

zmix999 commented 2 months ago

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

YangLiuMZ commented 2 months ago

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

好的,非常感谢,我下载安装一下

YangLiuMZ commented 2 months ago

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

check的时候成功,execute执行的时候还是没有成功: time="2024/04/23 18:15:40.083" level=warning msg="无匹配类型: ast.CallStmt\n" file=session_inception.go func=executeRemoteCommand line=1256 time="2024/04/23 18:15:40.083" level=info msg="[GENERAL_LOG] con:3 user:root@10.249.104.205 sql:/--user=root;--password=63a9f0ea7bb980;--host=10.249.152.36;--execute=1;--port=11815;*/ inception_magic_start; use yl; call sp_update; inception_magic_commit;" file=session.go func=logQuery line=1612 time="2024/04/23 18:15:40.085" level=info msg="con:3 close connection" file=server.go func=func1 line=321

YangLiuMZ commented 2 months ago

+----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+ | order_id | stage | error_level | stage_status | error_message | sql | affected_rows | sequence | backup_dbname | execute_time | sqlsha1 | backup_time | +----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+ | 1 | EXECUTED | 0 | Execute Successfully | None | use yl | 0 | 1713867558_8093741_00000000 | None | 0.001 | None | 0 | | 2 | EXECUTED | 2 | Audit Completed | Execute: Not supported statement type. | call sp_update | 0 | 0_0_00000001 | None | 0 | None | 0 | +----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+

zmix999 commented 2 months ago

image 可以下载新的版本试下

YangLiuMZ commented 2 months ago

image 可以下载新的版本试下

👍 已经可以执行存储过程了! 还有个问题:如果同时执行几十万条update语句,check的时候可能需要一两分钟的时间,请问这个有没有优化方式呢?比如修改哪个参数或者修改代码的方式

zmix999 commented 2 months ago

和数据库原理一样的,每条SQL都会检查语法语义,所以量大会比较慢,这种情况建议合并SQL语句