Copilot commented on code in PR #66136:
URL: https://github.com/apache/doris/pull/66136#discussion_r3664315886


##########
be/src/cloud/cloud_warm_up_manager.cpp:
##########
@@ -93,6 +93,10 @@ bvar::Status<int64_t> 
g_file_cache_warm_up_rowset_last_call_unix_ts(
         "file_cache_warm_up_rowset_last_call_unix_ts", 0);
 bvar::Adder<uint64_t> file_cache_warm_up_failed_task_num("file_cache_warm_up", 
"failed_task_num");
 bvar::Adder<uint64_t> 
g_balance_tablet_be_mapping_size("balance_tablet_be_mapping_size");
+// Number of warm up jobs currently held in this BE's memory.
+// Incremented when FE dispatches a new job to this BE (SET_JOB / SET_BATCH / 
event SET_JOB),
+// decremented when the job is cleared (CLEAR_JOB / event CLEAR_JOB).
+bvar::Adder<int64_t> 
g_file_cache_warm_up_job_num("file_cache_warm_up_job_num");

Review Comment:
   The comment refers to “event SET_JOB / event CLEAR_JOB”, but the code path 
is actually `SET_JOB`/`CLEAR_JOB` requests that carry a warm-up `event` (e.g., 
`TWarmUpEventType::LOAD`). Rewording avoids confusion between request type vs 
event type.



##########
be/src/cloud/cloud_warm_up_manager.cpp:
##########
@@ -404,6 +408,7 @@ Status CloudWarmUpManager::check_and_set_job_id(int64_t 
job_id) {
     std::lock_guard lock(_mtx);
     if (_cur_job_id == 0) {
         _cur_job_id = job_id;
+        g_file_cache_warm_up_job_num << 1;
     }

Review Comment:
   `g_file_cache_warm_up_job_num` is incremented even if `job_id` is 0. Since 
`_cur_job_id == 0` is used as the sentinel for “no job/cancelled”, a malformed 
request with `job_id == 0` would permanently skew the gauge (it would increment 
here but never decrement in `clear_job()` because that path guards on 
`_cur_job_id != 0`). Guard the metric update against `job_id == 0` (or reject 0 
as invalid).
   
   This issue also appears in the following locations of the same file:
   - line 428
   - line 501
   - line 506
   - line 645



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