You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2019/04/23 13:32:28 UTC

[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #1003: Support kafka routine load

EmmyMiao87 commented on a change in pull request #1003: Support kafka routine load
URL: https://github.com/apache/incubator-doris/pull/1003#discussion_r277677864
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/load/routineload/RoutineLoadScheduler.java
 ##########
 @@ -30,58 +35,96 @@
 public class RoutineLoadScheduler extends Daemon {
 
     private static final Logger LOG = LogManager.getLogger(RoutineLoadScheduler.class);
+    private static final int DEFAULT_INTERVAL_SECONDS = 10;
+
+    private RoutineLoadManager routineLoadManager;
 
-    private RoutineLoadManager routineLoadManager = Catalog.getInstance().getRoutineLoadManager();
+    @VisibleForTesting
+    public RoutineLoadScheduler() {
+        super();
+        routineLoadManager = Catalog.getInstance().getRoutineLoadManager();
+    }
+
+    public RoutineLoadScheduler(RoutineLoadManager routineLoadManager) {
+        super("Routine load", DEFAULT_INTERVAL_SECONDS * 1000);
+        this.routineLoadManager = routineLoadManager;
+    }
 
     @Override
     protected void runOneCycle() {
         try {
             process();
         } catch (Throwable e) {
-            LOG.error("failed to schedule jobs with error massage {}", e.getMessage(), e);
+            LOG.warn("Failed to process one round of RoutineLoadScheduler with error message {}", e.getMessage(), e);
         }
     }
 
-    private void process() {
+    private void process() throws UserException {
         // update
-        routineLoadManager.rescheduleRoutineLoadJob();
+        routineLoadManager.updateRoutineLoadJob();
         // get need schedule routine jobs
         List<RoutineLoadJob> routineLoadJobList = null;
         try {
             routineLoadJobList = getNeedScheduleRoutineJobs();
         } catch (LoadException e) {
-            LOG.error("failed to get need schedule routine jobs");
+            LOG.warn("failed to get need schedule routine jobs", e);
 
 Review comment:
   I use the function warn(String, Throwable). It can print warn log and throwable at the same time

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org