fix(canal): do not ignore events with LogPos=0, use timestamp to distinguish fake rotate events #894
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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