This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a04e30d087 [Fix](Job)Fix Job schedule calculation start time (#22707)
a04e30d087 is described below
commit a04e30d087cc91da86e4d25fabf315e435375503
Author: Calvin Kirs <[email protected]>
AuthorDate: Tue Aug 8 18:30:38 2023 +0800
[Fix](Job)Fix Job schedule calculation start time (#22707)
Since we use division calculation, when the start time is not specified,
it may have a wrong deviation from our expected time.
For example, if it is the 7th minute now, the cycle is executed every two
minutes.
Then it is calculated that the first execution is 8 minutes Because 7/2=3
3+1=4
But ideally we think it should be executed at the 9th minute
---
.../apache/doris/scheduler/manager/AsyncJobManager.java | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/scheduler/manager/AsyncJobManager.java
b/fe/fe-core/src/main/java/org/apache/doris/scheduler/manager/AsyncJobManager.java
index c2d2ab4151..c85631718c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/scheduler/manager/AsyncJobManager.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/scheduler/manager/AsyncJobManager.java
@@ -156,19 +156,20 @@ public class AsyncJobManager implements Closeable,
Writable {
}
private Long findFistExecuteTime(Long currentTimeMs, Long startTimeMs,
Long intervalMs, boolean isCycleJob) {
+ // if job not delay, first execute time is start time
if (startTimeMs != 0L && startTimeMs > currentTimeMs) {
return startTimeMs;
}
- // if it's not cycle job and already delay, next execute time is
current time
- if (!isCycleJob) {
+ // if job already delay, first execute time is current time
+ if (startTimeMs != 0L && startTimeMs < currentTimeMs) {
return currentTimeMs;
}
-
- long cycle = (currentTimeMs - startTimeMs) / intervalMs;
- if ((currentTimeMs - startTimeMs) % intervalMs > 0) {
- cycle += 1;
+ // if it's cycle job and not set start tine, first execute time is
current time + interval
+ if (isCycleJob && startTimeMs == 0L) {
+ return currentTimeMs + intervalMs;
}
- return startTimeMs + cycle * intervalMs;
+ // if it's not cycle job and already delay, first execute time is
current time
+ return currentTimeMs;
}
public void unregisterJob(Long jobId) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]