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

For tables with the same name in different libraries, the field order is not consistent #355

Merged
merged 9 commits into from
Oct 18, 2023

Conversation

Xuxiaotuan
Copy link
Contributor

For tables with the same name in different libraries, the field order is not consistent and there is no constraint.

Question:

     case (EventHeaderV4(EventType.TABLE_MAP, _, offset), TableMapEventData(tableId, name)) =>
          transactionState.schemaMetadata.tables
            .get(name)
            .foreach(transactionState.schemaMetadata.idToTable(tableId) = _)
          (transactionState.copy(offset = offset), None)

The result is that different ids have the same table name and field order but are not consistent

企业微信截图_2b9a2d8d-cf27-407d-8fc9-5bc9b6fa22aa

java.lang.ClassCastException: java.lang.Long cannot be cast to [B
at io.laserdisc.mysql.binlog.stream.TransactionState$.$anonfun$mapRawToMeta$1(TransactionState.scala:364)
at scala.collection.ArrayOps$.map$extension(ArrayOps.scala:929)
at io.laserdisc.mysql.binlog.stream.TransactionState$.recordToJson(TransactionState.scala:353)
at io.laserdisc.mysql.binlog.stream.TransactionState$.convertToJson(TransactionState.scala:301)
at io.laserdisc.mysql.binlog.stream.TransactionState$.$anonfun$handleCreate$3(TransactionState.scala:134)

So I added schema check

xujiawei added 2 commits March 14, 2023 11:42
@barryoneill barryoneill self-requested a review April 10, 2023 02:22
@barryoneill barryoneill added the bug Something isn't working label Apr 10, 2023
@barryoneill
Copy link
Member

Hi @Xuxiaotuan - thank you for this contribution. I've added some test coverage that I believe covers the situation.

@barryoneill barryoneill merged commit e692696 into laserdisc-io:master Oct 18, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants