From 00349ea398e55dfd1f3a9198402a3ecbf360f949 Mon Sep 17 00:00:00 2001 From: wenyh <44251917+wenyh1@users.noreply.github.com> Date: Tue, 8 Aug 2023 10:54:58 +0800 Subject: [PATCH] [inner-2321] fix: explain statement contained in multiple-sql appears lost connection... (cherry picked from commit 02f9ee6b60c90810543ab38b144ce95f87b8fa0e) --- .../dble/server/handler/ExplainHandler.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/actiontech/dble/server/handler/ExplainHandler.java b/src/main/java/com/actiontech/dble/server/handler/ExplainHandler.java index abbeaa86d3..3f5b8ccadc 100644 --- a/src/main/java/com/actiontech/dble/server/handler/ExplainHandler.java +++ b/src/main/java/com/actiontech/dble/server/handler/ExplainHandler.java @@ -203,25 +203,25 @@ public static void writeOutHeadAndEof(ShardingService service, RouteResultset rr ByteBuffer buffer = service.allocate(); // writeDirectly header ResultSetHeaderPacket header = PacketUtil.getHeader(FIELD_COUNT); - byte packetId = header.getPacketId(); + header.setPacketId(service.nextPacketId()); buffer = header.write(buffer, service, true); // writeDirectly fields for (FieldPacket field : FIELDS) { - field.setPacketId(++packetId); + field.setPacketId(service.nextPacketId()); buffer = field.write(buffer, service, true); } // writeDirectly eof EOFPacket eof = new EOFPacket(); - eof.setPacketId(++packetId); + eof.setPacketId(service.nextPacketId()); buffer = eof.write(buffer, service, true); if (!rrs.isNeedOptimizer()) { // writeDirectly rows for (RouteResultsetNode node : rrs.getNodes()) { RowDataPacket row = getRow(node, service.getCharset().getResults()); - row.setPacketId(++packetId); + row.setPacketId(service.nextPacketId()); buffer = row.write(buffer, service, true); } } else { @@ -232,13 +232,13 @@ public static void writeOutHeadAndEof(ShardingService service, RouteResultset rr row.add(StringUtil.encode(result.getName(), service.getCharset().getResults())); row.add(StringUtil.encode(result.getType(), service.getCharset().getResults())); row.add(StringUtil.encode(result.getRefOrSQL(), service.getCharset().getResults())); - row.setPacketId(++packetId); + row.setPacketId(service.nextPacketId()); buffer = row.write(buffer, service, true); } } // writeDirectly last eof EOFRowPacket lastEof = new EOFRowPacket(); - lastEof.setPacketId(++packetId); + lastEof.setPacketId(service.nextPacketId()); lastEof.write(buffer, service); } }