yujun777 commented on code in PR #63884:
URL: https://github.com/apache/doris/pull/63884#discussion_r3340867225


##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java:
##########
@@ -369,6 +371,46 @@ 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 = INITIAL_PREPARED_STMT_ID;
+        runningQuery = null;
+        resetQueryId();
+        insertResult = null;

Review Comment:
   Fixed in f5a8c578286. COM_RESET_CONNECTION now calls setTraceId(null) after 
clearing query ids, so the derived trace id is cleared and the old scheduler 
trace mapping is removed. Added ConnectContextTest coverage for clearing 
traceId and invoking removeOldTraceId during reset.
   
   Validation:
   - tools/fast-compile-fe.sh ConnectContext.java
   - tools/fast-compile-fe.sh --test ConnectContextTest.java
   - MAVEN_OPTS="-Djdk.attach.allowAttachSelf=true" ./run-fe-ut.sh --run 
ConnectContextTest



-- 
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]

Reply via email to