Add missing MySQL 8.0+ binlog event types (36-42)#143
Merged
krowinski merged 1 commit intokrowinski:masterfrom Feb 25, 2026
Merged
Add missing MySQL 8.0+ binlog event types (36-42)#143krowinski merged 1 commit intokrowinski:masterfrom
krowinski merged 1 commit intokrowinski:masterfrom
Conversation
…acefully The ConstEventType enum is missing all event types added in MySQL 8.0+ (types 36-42), causing a ValueError crash when the library encounters any of them. The most commonly triggered one is PARTIAL_UPDATE_ROWS_EVENT (type 39), emitted when binlog_row_value_options=PARTIAL_JSON is enabled. Changes: - Add all missing MySQL 8.0+ event types to ConstEventType: - TRANSACTION_CONTEXT_EVENT (36) - VIEW_CHANGE_EVENT (37) - XA_PREPARE_LOG_EVENT (38) - PARTIAL_UPDATE_ROWS_EVENT (39) - TRANSACTION_PAYLOAD_EVENT (40) - HEARTBEAT_LOG_EVENT_V2 (41) - GTID_TAGGED_LOG_EVENT (42) - Use tryFrom() instead of from() in EventInfo to gracefully handle any future unrecognized event types instead of crashing Ref: https://github.com/mysql/mysql-server/blob/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4/libs/mysql/binlog/event/binlog_event.h#L285
99ceea5 to
625c483
Compare
Owner
|
tx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
ConstEventTypeenum is missing all event types added in MySQL 8.0+ (types 36–42), causing aValueErrorcrash when the library encounters any of them:The most commonly triggered one is
PARTIAL_UPDATE_ROWS_EVENT(type 39), which MySQL emits whenbinlog_row_value_options=PARTIAL_JSONis enabled — a common optimization for tables with JSON columns.Another likely trigger is
TRANSACTION_PAYLOAD_EVENT(type 40), emitted whenbinlog_transaction_compressionis enabled.The crash occurs in
EventInfo::__construct()whereConstEventType::from()is called with an unrecognized type value.Current workaround (lossy)
Users can disable the MySQL settings that emit these events (
binlog_row_value_options=andbinlog_transaction_compression=OFF), but this means MySQL falls back to writing full row images — losing the binlog space savings these features provide. More importantly, without this fix there is no way to use these MySQL features with this library at all.Changes
Added all missing MySQL 8.0+ event types to
ConstEventType, perbinlog_event.h:TRANSACTION_CONTEXT_EVENTVIEW_CHANGE_EVENTXA_PREPARE_LOG_EVENTPARTIAL_UPDATE_ROWS_EVENTbinlog_row_value_options=PARTIAL_JSONTRANSACTION_PAYLOAD_EVENTbinlog_transaction_compression=ONHEARTBEAT_LOG_EVENT_V2GTID_TAGGED_LOG_EVENTChanged
from()totryFrom()inEventInfo— so any future unrecognized event types are handled gracefully instead of crashing. The event will be silently skipped byEvent::makeEvent()which already returnsnullfor unhandled types.Why CI doesn't catch this
The test workflow's
my-cnfonly setsbinlog_format=rowandbinlog_rows_query_log_events=ON. It does not enablebinlog_row_value_options=PARTIAL_JSONorbinlog_transaction_compression=ON, so MySQL never emits event types 39/40 during CI. These are common production settings.