From a2f7a4702af1682a6011a7c07abba0f81873aedb Mon Sep 17 00:00:00 2001 From: James Date: Thu, 28 Nov 2024 19:19:55 +0800 Subject: [PATCH] Support mysql COM_RESET_CONNECTION command. --- .../src/main/java/org/apache/doris/qe/ConnectProcessor.java | 6 ++++++ .../java/org/apache/doris/qe/MysqlConnectProcessor.java | 3 +++ 2 files changed, 9 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index 2340aa37aebb550..c51a7bdd878c56d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -44,6 +44,7 @@ import org.apache.doris.common.util.SqlUtils; import org.apache.doris.common.util.Util; import org.apache.doris.datasource.CatalogIf; +import org.apache.doris.datasource.InternalCatalog; import org.apache.doris.metric.MetricRepo; import org.apache.doris.mysql.MysqlChannel; import org.apache.doris.mysql.MysqlPacket; @@ -198,6 +199,11 @@ protected void handleDebug() { ctx.getState().setOk(); } + protected void handleResetConnection() { + ctx.changeDefaultCatalog(InternalCatalog.INTERNAL_CATALOG_NAME); + ctx.getState().setOk(); + } + protected void handleStmtReset() { ctx.getState().setOk(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java index 376d4740e632a1d..da3baced5fad78e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MysqlConnectProcessor.java @@ -264,6 +264,9 @@ private void dispatch() throws IOException { case COM_SET_OPTION: handleSetOption(); break; + case COM_RESET_CONNECTION: + handleResetConnection(); + break; default: ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")"); LOG.warn("Unsupported command(" + command + ")");