Skip to content

Commit 99ceea5

Browse files
committed
Add TRANSACTION_PAYLOAD_EVENT and handle unknown event types gracefully
MySQL 8.0.20 introduced TRANSACTION_PAYLOAD_EVENT (type 39) for binlog transaction compression. This event type is missing from ConstEventType, causing a ValueError on MySQL 8.0.20+ / 8.4 servers. Changes: - Add TRANSACTION_PAYLOAD_EVENT = 39 to ConstEventType enum - Use tryFrom() instead of from() in EventInfo to gracefully handle any unrecognized event types instead of crashing Ref: https://dev.mysql.com/doc/refman/8.4/en/binary-log-transaction-compression.html
1 parent 2cb76cd commit 99ceea5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/MySQLReplication/Definitions/ConstEventType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum ConstEventType: int
5656
case INTVAR_EVENT = 5;
5757
case MARIA_UPDATE_ROWS_COMPRESSED_EVENT = 170;
5858
case MARIA_GTID_EVENT = 162;
59+
case TRANSACTION_PAYLOAD_EVENT = 39;
5960

6061
//Transaction ID for 2PC, written whenever a COMMIT is expected.
6162

src/MySQLReplication/Event/EventInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(
2828
$this->binLogCurrent->setBinLogPosition($pos);
2929
}
3030
$this->sizeNoHeader = $this->dateTime = null;
31-
$this->typeName = ConstEventType::from($this->type)->name;
31+
$this->typeName = ConstEventType::tryFrom($this->type)?->name;
3232
}
3333

3434
public function getTypeName(): ?string

0 commit comments

Comments
 (0)