Skip to content

fix(canal): do not ignore events with LogPos=0, use timestamp to distinguish fake rotate events #894

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

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

mefcorvi
Copy link
Contributor

@mefcorvi mefcorvi commented Jun 24, 2024

After upgrading to MariaDB 11.4.1, the canal module stopped detecting row updates within transactions due to incorrect handling of fake rotate events. MariaDB 11.4.1 does not set LogPos for certain events, causing these events to be ignored. This fix modifies the handling to consider fake rotate events only for ROTATE_EVENTs with timestamp = 0, aligning with MariaDB and MySQL documentation.

Consequences of this change:

  • Events with LogPos=0 that are not of type ROTATE_EVENT will no longer be ignored.
  • If a database does not set timestamp=0 for fake rotate events, these events will be processed as real rotate events.

For MariaDB 11.4, I have confirmed that the timestamp for fake rotate events is set to 0. Based on the MariaDB and MySQL source code and documentation, I believe we can rely on this behavior.

I am not aware of any other events with LogPos=0 that should be ignored. Originally, this code was intended exclusively for handling fake rotate events and was not meant to ignore other events. Therefore, I believe this change is safe and will not negatively impact the processing of other binlog events.

Fixes #893

@lintanghui @csuzhangxc @gaojijun

After upgrading to MariaDB 11.4, the canal module stopped detecting row
updates within transactions due to incorrect handling of fake rotate events.
MariaDB 11.4 does not set LogPos for certain events, causing these events
to be ignored. This fix modifies the handling to consider fake rotate events
only for ROTATE_EVENTs with timestamp = 0, aligning with MariaDB and MySQL
documentation.
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll review my application using this library and double check how to handle it soon.

@mefcorvi mefcorvi changed the title fix(canal): handle fake rotate events correctly for MariaDB 11.4 fix(canal): do not ignore events with LogPos=0, use timestamp to distinguish fake rotate events Jun 25, 2024
@lance6716 lance6716 merged commit 3b1dd0e into go-mysql-org:master Jun 27, 2024
13 checks passed
dvilaverde pushed a commit to dvilaverde/go-mysql that referenced this pull request Jul 24, 2024
…mysql-org#894)

After upgrading to MariaDB 11.4, the canal module stopped detecting row
updates within transactions due to incorrect handling of fake rotate events.
MariaDB 11.4 does not set LogPos for certain events, causing these events
to be ignored. This fix modifies the handling to consider fake rotate events
only for ROTATE_EVENTs with timestamp = 0, aligning with MariaDB and MySQL
documentation.
lance6716 pushed a commit that referenced this pull request Jul 25, 2024
* allow disabling the default golang database retry behavior

* fixing comment

* fixing comment

* fix(canal): handle fake rotate events correctly for MariaDB 11.4 (#894)

After upgrading to MariaDB 11.4, the canal module stopped detecting row
updates within transactions due to incorrect handling of fake rotate events.
MariaDB 11.4 does not set LogPos for certain events, causing these events
to be ignored. This fix modifies the handling to consider fake rotate events
only for ROTATE_EVENTs with timestamp = 0, aligning with MariaDB and MySQL
documentation.

* incorporating PR feedback

---------

Co-authored-by: Bulat Aikaev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canal module does not detect row updates in transactions after upgrading MariaDB to 11.4.1
2 participants