github-actions[bot] commented on code in PR #66173:
URL: https://github.com/apache/doris/pull/66173#discussion_r3840386207


##########
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java:
##########
@@ -1943,8 +1945,15 @@ public boolean isExpired() {
         if (!isFinal()) {
             return false;
         }
-        Preconditions.checkState(endTimestamp != -1, endTimestamp);
-        return (System.currentTimeMillis() - endTimestamp) > 
Config.label_keep_max_second * 1000;
+        try {
+            Preconditions.checkState(endTimestamp != -1, endTimestamp);
+            return (System.currentTimeMillis() - endTimestamp) > 
Config.label_keep_max_second * 1000;
+        } catch (Exception e) {
+            LOG.warn("routine load job {} is in final state {} but has no 
endTimestamp, "
+                    + "skip expiring it this round (may race with an 
in-progress cancel/stop).",
+                    id, state, e);
+            return false;

Review Comment:
   [P1] Synchronize the count-based cleanup path too
   
   Returning false here protects only `cleanOldRoutineLoadJobs()`. In the same 
scheduler round, default-enabled `cleanOverLimitRoutineLoadJobs()` filters on 
unlocked `isFinal()`, sorts on the raw `endTimestamp`, and logs REMOVE without 
calling `isExpired()`. If a user STOP or task-scheduler CANCEL publishes the 
final state while holding the job lock but is preempted before 
`unprotectUpdateState()` logs CHANGE, the count cleaner can remove that job 
(and `-1` sorts it first), after which the transition logs CHANGE for an absent 
job. This is distinct from r3710171342 because it is the separate count-limit 
path. Make that path wait on a job-locked snapshot so CHANGE is durable before 
removal, and add a threshold-exceeded latch 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