Skip to content

Commit

Permalink
[log](mysql command)Log packet when receive COM_SLEEP (apache#47879)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

This p2 case test_group_commit_insert_into_lineitem_normal.groovy:111) -
got exception:java.sql.SQLNonTransientConnectionException: Unsupported
command(Sleep)
Don't know why JDBC may send COM_SLEEP to Doris, add log to help
investigate.
  • Loading branch information
Jibing-Li authored Feb 13, 2025
1 parent fc689e3 commit 736b65e
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void handleStmtClose() {
handleStmtClose(stmtId);
}

private void debugPacket() {
private String getPacket() {
byte[] bytes = packetBuf.array();
StringBuilder printB = new StringBuilder();
for (byte b : bytes) {
Expand All @@ -95,8 +95,12 @@ private void debugPacket() {
}
printB.append(" ");
}
return printB.toString().substring(0, 200);
}

private void debugPacket() {
if (LOG.isDebugEnabled()) {
LOG.debug("debug packet {}", printB.toString().substring(0, 200));
LOG.debug("debug packet {}", getPacket());
}
}

Expand Down Expand Up @@ -270,6 +274,9 @@ private void dispatch() throws IOException {
default:
ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")");
LOG.warn("Unsupported command(" + command + ")");
if (command.equals(MysqlCommand.COM_SLEEP)) {
LOG.warn("COM_SLEEP packet: [{}]", getPacket());
}
break;
}
}
Expand Down

0 comments on commit 736b65e

Please sign in to comment.