-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(canal): fix mysql unsigned medium int #399
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
fix(canal): fix mysql unsigned medium int #399
Conversation
canal/rows.go
Outdated
@@ -57,7 +58,14 @@ func (r *RowsEvent) handleUnsigned() { | |||
case int16: | |||
r.Rows[i][index] = uint16(t) | |||
case int32: | |||
r.Rows[i][index] = uint32(t) | |||
if strings.Contains(strings.ToLower(r.Table.Columns[i].RawType), "mediumint") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting, can you add some comments here?
maybe it is better to add a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the implementation from gh-ost is better and more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siddontang added comments and test.
@NearTan I think so, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can do more, to add a similar MediumIntColumnType.
I worry that comparing string every time can reduce the performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
591d64f
to
7a090e8
Compare
CI failed |
fixed |
this is port from moiot/gravity#182.
the problem is we use int32 to receive mysql medium int value, which is 3 bytes. When it's unsigned, simply do a type cast is not sufficient.