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

struct结构迁移兼容性 #337

Open
cy420426 opened this issue Mar 4, 2025 · 1 comment
Open

struct结构迁移兼容性 #337

cy420426 opened this issue Mar 4, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@cy420426
Copy link

cy420426 commented Mar 4, 2025

called Result::unwrap()on anErr value: sqlx error: error returned from database: 1071 (42000): Specified key was too long; max key length is 3072 bytes Caused by: 0: error returned from database: 1071 (42000): Specified key was too long; max key length is 3072 bytes 1: 1071 (42000): Specified key was too long; max key length is 3072 bytes

source mysql5.7->sink msyql8.4

结构迁移时,源库表结构历史遗留原因设计表字段长度过大,索引过长,在mysql5.7下可自行配置innodb_large_prefix参数自动截取索引前缀,不会报错

但在目标库中,mysql8移除了该参数,因此struct建议最好能够抓取索引长度,以避免此错误,增加容错性。
或增加一个用户选项来可选的控制容错:

例如: Index_exceeds_truncation_length:768(索引超长截取长度)
实际执行:ADD INDEX (index(768))

@cy420426 cy420426 added the enhancement New feature or request label Mar 4, 2025
@qianyiwen2019
Copy link
Collaborator

Image

Image

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants