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

otter同步set类型出错 #617

Closed
l-dandelion opened this issue Oct 3, 2018 · 6 comments
Closed

otter同步set类型出错 #617

l-dandelion opened this issue Oct 3, 2018 · 6 comments
Assignees
Labels
Milestone

Comments

@l-dandelion
Copy link

pid:3 nid:1 exception:setl:com.alibaba.otter.node.etl.load.exception.LoadException: java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [update jz.jz_videos set category = ? where ( video_id = ? )]; Data truncated for column 'category' at row 1; nested exception is java.sql.SQLException: Data truncated for column 'category' at row 1

---Pks
EventColumn[index=0,columnType=-5,columnName=video_id,columnValue=3280,isNull=false,isKey=true,isUpdate=true]
---oldPks

---Columns
EventColumn[index=47,columnType=1,columnName=category,columnValue=-124,isNull=false,isKey=false,isUpdate=true]
---Sql
update jz.jz_videos set category = ? where ( video_id = ? )

@l-dandelion
Copy link
Author

l-dandelion commented Oct 6, 2018

原因:category字段总共有8个成员,当用到最高位时,该字段的value为一个负数,mysql执行时会提示warning,但是能成功执行,但是jdbc会抛异常导致同步停止。
请问有没有什么好的解决办法,不太了解java,源码看得头有点大,呜呜

@l-dandelion
Copy link
Author

image
为什么这里要用getInt8,而不用getUint8?如果使用getUint8是不是就不会出现set字段的value<0,jdbc就不会报异常了?

@agapple
Copy link
Member

agapple commented Oct 22, 2018

getInt8不会出现负数的情况,因为int是32位的。 估计是同步时sql_mode没设置正确吧,对应的otter版本有升级到最新么? 我印象中修复过一次sql_mode问题

@l-dandelion
Copy link
Author

使用的是4.2.14版本,数据库sql_mode = NO_ENGINE_SUBSTITUTION,之前把这里改成getUint8之后可以正常同步。

@agapple
Copy link
Member

agapple commented Oct 23, 2018

测试的表结构和sql给我

@agapple
Copy link
Member

agapple commented Oct 24, 2018

canal解析已修复,alibaba/canal@575dd59

@agapple agapple closed this as completed Oct 24, 2018
@agapple agapple added the bug label Oct 24, 2018
@agapple agapple self-assigned this Oct 24, 2018
@agapple agapple added this to the v4.2.16 milestone Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants