yujun777 commented on code in PR #63884:
URL: https://github.com/apache/doris/pull/63884#discussion_r3338062991
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -155,9 +154,15 @@ protected void handleDebug() {
}
protected void handleResetConnection() {
- ctx.changeDefaultCatalog(InternalCatalog.INTERNAL_CATALOG_NAME);
- ctx.clearLastDBOfCatalog();
- ctx.getState().setOk();
+ try {
+ ctx.resetConnection();
+ if (ctx.getSessionVariable().autoCommit) {
+ ctx.getState().serverStatus |=
MysqlServerStatusFlag.SERVER_STATUS_AUTOCOMMIT;
+ }
Review Comment:
Removed the autocommit server status update from COM_RESET_CONNECTION. Doris
currently does not set this flag on the initial OK packet either, so reset now
keeps the OK packet status behavior consistent with the existing connection
path.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java:
##########
@@ -155,9 +154,15 @@ protected void handleDebug() {
}
protected void handleResetConnection() {
- ctx.changeDefaultCatalog(InternalCatalog.INTERNAL_CATALOG_NAME);
- ctx.clearLastDBOfCatalog();
- ctx.getState().setOk();
+ try {
+ ctx.resetConnection();
Review Comment:
Fixed. COM_STMT_RESET now parses the statement id in the MySQL packet path
and returns ERR_UNKNOWN_STMT_HANDLER when the prepared statement context is
missing, using mysqld_stmt_reset in the error message.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java:
##########
@@ -369,6 +370,45 @@ public void clearLastDBOfCatalog() {
lastDBOfCatalog.clear();
}
+ public void resetConnection() throws UserException {
+ closeTxnForConnectionReset();
+ if (!dbToTempTableNamesMap.isEmpty()) {
+ cleanupTemporaryTables(true);
+ }
+ dbToTempTableNamesMap.clear();
+ resetSessionVariable();
+ userVars = new HashMap<>();
+ preparedQuerys.clear();
+ preparedStatementContextMap.clear();
+ preparedStmtId = Integer.MIN_VALUE;
+ runningQuery = null;
Review Comment:
Fixed. resetConnection() now clears the current query id by calling
resetQueryId(), so a reset idle connection no longer exposes the previous
statement query id in processlist or connection profile APIs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]