morningman commented on a change in pull request #368: Add a frontend interface 
for committing RoutineLoadTask
URL: https://github.com/apache/incubator-doris/pull/368#discussion_r238517116
 
 

 ##########
 File path: 
fe/src/main/java/org/apache/doris/load/routineload/RoutineLoadJob.java
 ##########
 @@ -195,25 +221,35 @@ public void processTimeoutTasks() {
                 if ((System.currentTimeMillis() - 
routineLoadTaskInfo.getLoadStartTimeMs())
                         > DEFAULT_TASK_TIMEOUT_SECONDS * 1000) {
                     String oldSignature = routineLoadTaskInfo.getId();
-                    if (routineLoadTaskInfo instanceof KafkaTaskInfo) {
-                        // remove old task
-                        routineLoadTaskInfoList.remove(routineLoadTaskInfo);
-                        // add new task
-                        KafkaTaskInfo kafkaTaskInfo = new 
KafkaTaskInfo((KafkaTaskInfo) routineLoadTaskInfo);
-                        routineLoadTaskInfoList.add(kafkaTaskInfo);
-                        needSchedulerTaskInfoList.add(kafkaTaskInfo);
+                    // abort txn if not committed
+                    try {
+                        Catalog.getCurrentGlobalTransactionMgr()
+                                
.abortTransaction(routineLoadTaskInfo.getTxnId(), "routine load task of txn was 
timeout");
+                    } catch (UserException e) {
+                        if (e.getMessage().contains("committed")) {
+                            LOG.debug("txn of task {} has been committed, 
timeout task has been ignored", oldSignature);
+                            continue;
+                        }
+                    }
+
+                    try {
+                        result.add(reNewTask(routineLoadTaskInfo));
+                        LOG.debug("Task {} was ran more then {} minutes. It 
was removed and rescheduled",
+                                oldSignature, DEFAULT_TASK_TIMEOUT_SECONDS);
+                    } catch (UserException e) {
+                        state = JobState.CANCELLED;
+                        // TODO(ml): edit log
 
 Review comment:
   do you need to make some clean tasks when job is being cancelled?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to