-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[mysql-cdc] Fix table metadata field type 0 when parsing binlog event #2785
Conversation
Thanks @EchoLee5 for the contribution, the analysis looks good to me, could you fix the CI failure firstly ? |
.../com/github/shyiko/mysql/binlog/event/deserialization/TableMapEventMetadataDeserializer.java
Outdated
Show resolved
Hide resolved
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.
Thanks for the contribution. Could you please add some tests to cover this?
I've solved it, thank you. |
You need add a suppression[1] when override a class to let check style pass |
I have added unit tests. |
Yes, I revised it again, I hope it passes |
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.
Thanks for the contribution. Left some comments.
* packed. | ||
* | ||
* <p>Line 123: The length of the {@link TableMapEventMetadataDeserializer#readBooleanList} is | ||
* determined by the length * of the packet header. |
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.
Please correct this description. There is a useless *
in it.
TableMapEventMetadata tableMapEventMetadata = | ||
metadataDeserializer.deserialize(new ByteArrayInputStream(data), 10, 8); | ||
|
||
assertThat(tableMapEventMetadata.getSignedness().get(1)); |
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.
The result is not checked here.
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.
Could you please add some ITCase to reproduce the problem?
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.
@ruanhang1993 thank you for your review, I've modified the description and unit tests, the bytes used in my test case can be reproduced before modifying the code. I also mentioned the conditions for reproduction in #2784
Duplicate to #2682 |
@EchoLee5 Thanks for your contribution. |
As described by #2784, in specific scenarios will appear table metadata field type 0 when parsing binlog event
When reading the sign bit of a numerical type, use the packed to determine the number of bytes to read to avoid the possibility of misreading due to errors in calculations.