Skip to content

Commit

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

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 a8a86f8 commit abf1d5f
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 @@ -338,6 +338,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 @@ -43,6 +43,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.MysqlCommand;
Expand Down Expand Up @@ -186,6 +187,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 @@ -340,6 +340,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 abf1d5f

Please sign in to comment.