You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "jackylee-ch (via GitHub)" <gi...@apache.org> on 2026/10/04 03:11:44 UTC

[PR] [cdc] Pair canal UPDATE rows by position instead of by content [paimon]

jackylee-ch opened a new pull request, #10370:
URL: https://github.com/apache/paimon/pull/10370

   ### Purpose
   
   `CanalRecordParser` matched each new row image in a canal `UPDATE` event to its old image
   through a `Collectors.toMap` keyed by the row `JsonNode`. A single `UPDATE` batch can
   legitimately carry two equal row images — a table without a primary key, or a bulk
   `UPDATE ... SET col = const` that leaves several rows with identical values — and the
   duplicate key then made `toMap` throw `IllegalStateException: Duplicate key`, failing the
   whole sync job. The map was also rebuilt once per row (O(n^2)).
   
   New and old images are positional in canal, so this pairs the i-th new row with the i-th
   old row directly. The result is identical for distinct rows and no longer crashes on equal
   ones.
   
   ### Tests
   
   `CanalRecordParserTest#testUpdateWithDuplicateRowImagesPairsByPosition` feeds an `UPDATE`
   with two equal `data` rows and asserts a DELETE + INSERT per row (4 records); it threw
   `Duplicate key` before the change.
   
   ### API and Format
   
   No change.
   
   ### Documentation
   
   No change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [cdc] Pair canal UPDATE rows by position instead of by content [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #10370:
URL: https://github.com/apache/paimon/pull/10370


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [cdc] Pair canal UPDATE rows by position instead of by content [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #10370:
URL: https://github.com/apache/paimon/pull/10370#issuecomment-5994708844

   +1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org