Gabriel39 commented on code in PR #67053:
URL: https://github.com/apache/doris/pull/67053#discussion_r3848927661


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadschedpolicy/WorkloadRuntimeStatusMgr.java:
##########
@@ -185,54 +211,128 @@ public void 
updateBeQueryStats(TReportWorkloadRuntimeStatusParams params) {
             LOG.warn("be report workload runtime status but without query 
stats map");
             return;
         }
+        if (!params.isSetBackendStartTime()) {
+            LOG.warn("be report workload runtime status without backend start 
time");
+            return;
+        }
         long beId = params.backend_id;
-        // NOTE(wb) one be sends update request one by one,
-        // so there is no need a global lock for beToQueryStatsMap here,
-        // just keep one be's put/remove/get is atomic operation is enough
+        long backendStartTime = params.backend_start_time;
+        long currentBackendStartTime = getBackendStartTime(beId);
+        if (currentBackendStartTime > 0 && currentBackendStartTime != 
backendStartTime) {

Review Comment:
   Fixed with an explicit workload_runtime_status_accepted response. FE rejects 
heartbeat mismatches, including a heartbeat change during a large merge, and BE 
removes a finished ResourceContext only after true acceptance; otherwise it 
retries. Added FE acceptance, heartbeat-race, and catch-up coverage.



##########
be/src/runtime/runtime_query_statistics_mgr.cpp:
##########
@@ -347,7 +370,8 @@ void 
RuntimeQueryStatisticsMgr::report_runtime_query_statistics() {
         for (auto iter = _resource_contexts_map.begin(); iter != 
_resource_contexts_map.end();) {
             std::string query_id = iter->first;
             auto resource_ctx = iter->second;
-            bool is_query_finished = 
resource_ctx->task_controller()->is_finished();
+            TQueryStatisticsResult stats_result = 
create_query_statistics_result(resource_ctx);

Review Comment:
   Fixed by checking query type and completion before creating a statistics 
snapshot. Active EXTERNAL contexts no longer serialize counters or advance 
their report sequence under the registry lock; finished EXTERNAL contexts are 
erased directly. Added a sequence regression test.



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