wenzhenghu opened a new issue, #60454:
URL: https://github.com/apache/doris/issues/60454

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   branch 4.0 and master
   
   ### What's Wrong?
   
   ```
   void finish() {
       if (!is_finished_) {
           is_finished_ = true;
           finish_time_ = MonotonicMillis();
       }
       finish_impl();
   }
   ```
   finish_time_ is updated in finish(), but before that ,  it will be used in 
   ```
      int64_t running_time() const { return finish_time() - start_time(); }
      int64_t finish_time() const { return finish_time_; } // finish_time_ 
inited value is  0
   ```
   when query is running , it will be checked if match the workload policy by 
   ```
   bool WorkloadSchedPolicy::is_match(WorkloadAction::RuntimeContext* 
action_runtime_ctx) const {
   ...
           switch (cond->get_workload_metric_type()) {
           case WorkloadMetricType::QUERY_TIME: {
               val = std::to_string(
                       
action_runtime_ctx->resource_ctx->task_controller()->running_time());
               break;
           }
   ...
           if (!cond->eval(val)) {
               return false;
           } 
   ...
   }
   
   bool WorkloadConditionQueryTime::eval(std::string str_val) {
       int64_t query_time_args = std::stol(str_val);
       return WorkloadCompareUtils::compare_signed_integer(_op, 
query_time_args, _query_time);
   }
   ```
   
   
   ### What You Expected?
   
   fix it
   
   ### How to Reproduce?
   
   create a workload policy like this
   
   ```
   create workload Policy test_cancel_Policy
   Conditions(query_time > 3000)
   Actions(cancel_query) 
   properties('enabled'='true'); 
   ```
   and run tpcds/tpch100, query will not killed by query time exceed. what 
expectd is 
   `cancelled by workload policy: test_cancel_3s_query, id:1770025926146, 
query_time:3491(3000)`
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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