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/04/13 02:19:02 UTC

[shardingsphere] branch master updated: Recover log.isDebugEnabled() for now (#16783)

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

zhangliang 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 8d20f8c26b0 Recover log.isDebugEnabled() for now (#16783)
8d20f8c26b0 is described below

commit 8d20f8c26b05880e1b4f01757a758a02bf59a765
Author: Hongsheng Zhong <sa...@126.com>
AuthorDate: Wed Apr 13 10:18:57 2022 +0800

    Recover log.isDebugEnabled() for now (#16783)
---
 .../org/apache/shardingsphere/db/protocol/codec/PacketCodec.java  | 8 ++++++--
 .../mysql/ingest/client/netty/MySQLBinlogEventPacketDecoder.java  | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
index 36a0274c567..0a3e356f89f 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-core/src/main/java/org/apache/shardingsphere/db/protocol/codec/PacketCodec.java
@@ -42,7 +42,9 @@ public final class PacketCodec extends ByteToMessageCodec<DatabasePacket<?>> {
         if (!databasePacketCodecEngine.isValidHeader(readableBytes)) {
             return;
         }
-        log.debug("Read from client {} :\n{}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(in));
+        if (log.isDebugEnabled()) {
+            log.debug("Read from client {} :\n{}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(in));
+        }
         databasePacketCodecEngine.decode(context, in, out);
     }
     
@@ -50,6 +52,8 @@ public final class PacketCodec extends ByteToMessageCodec<DatabasePacket<?>> {
     @Override
     protected void encode(final ChannelHandlerContext context, final DatabasePacket<?> message, final ByteBuf out) {
         databasePacketCodecEngine.encode(context, message, out);
-        log.debug("Write to client {} :\n{}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(out));
+        if (log.isDebugEnabled()) {
+            log.debug("Write to client {} :\n{}", context.channel().id().asShortText(), ByteBufUtil.prettyHexDump(out));
+        }
     }
 }
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 a979734dee3..d11ed31bf0a 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
@@ -102,7 +102,9 @@ public final class MySQLBinlogEventPacketDecoder extends ByteToMessageDecoder {
             String sqlState = payload.readStringFix(5);
             throw new RuntimeException(String.format("Decode binlog event failed, errorCode: %d, sqlState: %s, errorMessage: %s", errorNo, sqlState, payload.readStringEOF()));
         } else if (0 != statusCode) {
-            log.debug("Illegal binlog status code {}, remaining packet \n{}", statusCode, readRemainPacket(payload));
+            if (log.isDebugEnabled()) {
+                log.debug("Illegal binlog status code {}, remaining packet \n{}", statusCode, readRemainPacket(payload));
+            }
         }
     }