-
Notifications
You must be signed in to change notification settings - Fork 839
Open
Description
I went over the history issues and discovered some similiar issues. I am using v0.25.3, and the error message was:
Caused by: com.github.shyiko.mysql.binlog.event.deserialization.EventDataDeserializationException: Failed to deserialize data of EventHeaderV4{timestamp=1699588796000, eventType=TABLE_MAP, serverId=1, headerLength=19, dataLength=196, nextPosition=16345945, flags=0}
Unsupported table metadata field type 0.
I debugged the program and grabbed all the bytes of event header:
# remaining bytes:
[1, 5, -74, -39, -101, 97, 0, 3, 32, 33, 33, 63, 33, 63, 63, 63, 63, -4, -1, 0, -4, -1, 0, -4, -1, 0, -4, -1, 0, -4, -1, 0, -4, -1, 0, -4, -1, 0, -4, -1, 0]
nColumns = 59
nNumericColumns = 32
It first read the byte 1 for signedness type, which is 1, and after that the length of signedness bytes, which is 5.
// SIGNEDNESS
1,
5, // should read 5 bytes
-74, -39, -101, 97, 0,
However, the readBooleanList
method actually read 4 bytes instead of 5, missing the 0
as in [...74, -39, -101, 97, 0...]
, causing the exception when the program tries to read the next type.
private static BitSet readBooleanList(ByteArrayInputStream inputStream, int length) throws IOException {
BitSet result = new BitSet();
byte[] bytes = inputStream.read(length + 7 >> 3);
for(int i = 0; i < length; ++i) {
if ((bytes[i >> 3] & 1 << 7 - i % 8) != 0) {
result.set(i);
}
}
return result;
}
actually read: 32+7>>3=4 bytes. missed the 0 byte
Possible fixes
Single line fix:
case SIGNEDNESS:
result.setSignedness(readBooleanList(inputStream, nNumericColumns));
to
case SIGNEDNESS:
result.setSignedness(readBooleanList(inputStream, fieldLength));
or simply call skipToEndOfTheBlock after reading each metadata
Metadata
Metadata
Assignees
Labels
No labels