Skip to content

Commit

Permalink
branch-3.0: [improvement](mysql)Support mysql COM_RESET_CONNECTION co…
Browse files Browse the repository at this point in the history
…mmand. #44747 (#44787)

Cherry-picked from #44747

Co-authored-by: James <[email protected]>
  • Loading branch information
github-actions[bot] and Jibing-Li authored Dec 2, 2024
1 parent 88926d2 commit 7780dda
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ public String removeLastDBOfCatalog(String catalog) {
return lastDBOfCatalog.get(catalog);
}

// Used by COM_RESET_CONNECTION
public void clearLastDBOfCatalog() {
lastDBOfCatalog.clear();
}

public void setNotEvalNondeterministicFunction(boolean notEvalNondeterministicFunction) {
this.notEvalNondeterministicFunction = notEvalNondeterministicFunction;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -198,6 +199,12 @@ protected void handleDebug() {
ctx.getState().setOk();
}

protected void handleResetConnection() {
ctx.changeDefaultCatalog(InternalCatalog.INTERNAL_CATALOG_NAME);
ctx.clearLastDBOfCatalog();
ctx.getState().setOk();
}

protected void handleStmtReset() {
ctx.getState().setOk();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")");
Expand Down

0 comments on commit 7780dda

Please sign in to comment.