wenzhenghu commented on code in PR #68694:
URL: https://github.com/apache/doris/pull/68694#discussion_r4267295676


##########
be/src/util/brpc_closure.h:
##########
@@ -127,6 +129,7 @@ class AutoReleaseClosure : public google::protobuf::Closure 
{
 
     // Releases per-RPC resources, invokes the callback if it is still alive, 
and then deletes itself.
     void Run() override {
+        ScopedQueryLogContext query_log_scope(query_log_identity_);

Review Comment:
   Added direct `common/query_log_context.h` includes to all six named files in 
[e8c944b9cb66](https://github.com/apache/doris/commit/e8c944b9cb668c580b1854979a0225a04d80ef76).
 The C++ build, header-hygiene gate, and changed-line clang-tidy checks passed; 
these users no longer rely on the transitive `thread_context.h` include.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java:
##########
@@ -1327,6 +1341,16 @@ public void cancelQuery(Status cancelReason) {
     }
 
     public void checkTimeout(long now) {
+        // Idle connections and metadata commands can retain an ID from the 
preceding query.
+        boolean executingQuery = command == MysqlCommand.COM_QUERY || command 
== MysqlCommand.COM_STMT_PREPARE
+                || command == MysqlCommand.COM_STMT_EXECUTE;
+        TUniqueId currentQueryId = executingQuery ? queryId : null;
+        try (QueryLogContext ignored = QueryLogContext.open(currentQueryId)) {

Review Comment:
   Addressed in 
[e8c944b9cb66](https://github.com/apache/doris/commit/e8c944b9cb668c580b1854979a0225a04d80ef76)
 with a narrower fast path: skip the scope only when `currentQueryId == null` 
**and** the checker worker's MDC is already empty. If the worker carries 
another identity, the null scope is still necessary to avoid attributing this 
connection's timeout to that identity and to restore the caller afterward.
   
   This avoids idle-worker allocation without weakening stale-context handling. 
Timeout binding/restoration tests passed.



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