You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/07/05 03:30:13 UTC

[shardingsphere] branch master updated: Scaling MySQL binlog event compatible with MySQL mgr (#18841)

This is an automated email from the ASF dual-hosted git repository.

zhonghongsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 89e23a8f930 Scaling MySQL binlog event compatible with MySQL mgr (#18841)
89e23a8f930 is described below

commit 89e23a8f9304efef81584e806120c5171480ba0b
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Tue Jul 5 11:30:08 2022 +0800

    Scaling MySQL binlog event compatible with MySQL mgr (#18841)
    
    * Scaling MySQL binlog event compatible with MySQL mgr
    
    * Add log
---
 .../ingest/client/netty/MySQLBinlogEventPacketDecoder.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoder.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoder.java
index b449e164be2..6d5549624d1 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoder.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/netty/MySQLBinlogEventPacketDecoder.java
@@ -80,7 +80,16 @@ public final class MySQLBinlogEventPacketDecoder extends ByteToMessageDecoder {
                 decodeRotateEvent(binlogEventHeader, payload);
                 return null;
             case FORMAT_DESCRIPTION_EVENT:
-                new MySQLBinlogFormatDescriptionEventPacket(binlogEventHeader, payload);
+                MySQLBinlogFormatDescriptionEventPacket formatDescriptionEventPacket = new MySQLBinlogFormatDescriptionEventPacket(binlogEventHeader, payload);
+                // MySQL mgr checksum length is 0, but the event ends up with 4 extra bytes, need to skip them.
+                int readableBytes = payload.getByteBuf().readableBytes();
+                if (binlogEventHeader.getChecksumLength() <= 0 && readableBytes > 0) {
+                    if (readableBytes != 4) {
+                        log.warn("the format description event has extra bytes, readable bytes length={}, binlogEventHeader={}, formatDescriptionEvent={}", readableBytes, binlogEventHeader,
+                                formatDescriptionEventPacket);
+                    }
+                    payload.getByteBuf().skipBytes(readableBytes);
+                }
                 return null;
             case TABLE_MAP_EVENT:
                 decodeTableMapEvent(binlogEventHeader, payload);