Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Mybatis Scanner 扫描的 xml 内包含大 SQL 报错 #60

Closed
sjjian opened this issue Nov 4, 2021 · 3 comments
Closed

使用 Mybatis Scanner 扫描的 xml 内包含大 SQL 报错 #60

sjjian opened this issue Nov 4, 2021 · 3 comments
Assignees
Labels
bug Something isn't working not_compatible not compatible old version verified the issue all pr is verified
Milestone

Comments

@sjjian
Copy link
Member

sjjian commented Nov 4, 2021

SQLe Version
v1.2110.pre1

Describe the bug
使用 Mybatis Scanner 扫描的 xml 内包含大 SQL 报错,如图所示
E2 R4_Z_CJZ%VL9_BI}XG C
通过抓包发发现报错如下:
image

Expected behavior

  1. 期望能够提交成功

Suggestion

  1. 能够友好的查看报错信息
@sjjian sjjian added the bug Something isn't working label Nov 4, 2021
@sjjian sjjian added this to the v1.2111.0 milestone Nov 4, 2021
drivebyer added a commit that referenced this issue Nov 23, 2021
Add unique index on fingerprint and audit_plan_id by AutoMigrate()
because gorm can't create index on TEXT column directly by tag.

#60
@sjjian sjjian added the not_compatible not compatible old version label Nov 24, 2021
@sjjian sjjian closed this as completed Nov 24, 2021
@drivebyer
Copy link
Contributor

drivebyer commented Nov 24, 2021

缺陷原因:

audit_plan_sqls 的 fingerprint 字段长度为 varchar(255),SQL 文本长度超过 255 后报错。

修复方案:

将 audit_plan_sqls 的 fingerprint 与 last_sql 字段变更为 text 类型。

audit_plan_sqls 表上有一个 fingerprint 与 audit_plan_id 的联合唯一索引。当 fingerprint 变更为 text 类型后(text 类型不支持对全字段建立索引),需要在 fingerprint 字段上指定索引前缀。

升级方案:

在SQLE 存储库执行下述 SQL:

  1. alter table audit_plan_sqls change fingerprint fingerprint text;
  2. alter table audit_plan_sqls change last_sql last_sql text;
  3. alter table audit_plan_sqls drop index idx_audit_plan_sqls_audit_plan_id_fingerprint;
  4. alter table audit_plan_sqls add index idx_audit_plan_sqls_audit_plan_id_fingerprint(audit_plan_id, fingerprint(255));

@Marcus9530
Copy link
Collaborator

复现版本
sqle-1.2109.0_6a6de329f50bba5d61a880e1
复现步骤:
1.创建审核计划,配置jenkins
2.gitlab上写一个sql语句内字符超过255个的,然后提交触发变更
3.jenkins上构建任务失败,有异常报错抛出
image

@Marcus9530
Copy link
Collaborator

验证版本sqle-5d24144eb56b6202d030ac935897053b7#
验证步骤:
1.创建审核计划,配置jenkins
2.gitlab上写一个sql语句内字符超过255个的,然后提交触发变更
3.jenkins上构建任务成功,且sqle对应的审核计划也有过该sql语句信息

image
image

@Marcus9530 Marcus9530 added the verified the issue all pr is verified label Nov 26, 2021
taolx0 pushed a commit that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not_compatible not compatible old version verified the issue all pr is verified
Projects
None yet
Development

No branches or pull requests

3 participants