You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/13 14:27:34 UTC

[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #3082: [Hotfix][ST-Engine] Add master node switch test and fix bug

hailin0 commented on code in PR #3082:
URL: https://github.com/apache/incubator-seatunnel/pull/3082#discussion_r994719263


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:
##########
@@ -181,12 +193,18 @@ private void restoreJobFromMasterActiveSwitch(@NonNull Long jobId, @NonNull Runn
             throw new SeaTunnelEngineException(String.format("Job id %s init JobMaster failed", jobId));
         }
 
+        String jobFullName = jobMaster.getPhysicalPlan().getJobFullName();
         if (jobStatus.isEndState()) {
+            logger.info(String.format(
+                "The restore %s is in an end state %s, store the job info to JobHistory and clear the job running time info",
+                jobFullName, jobStatus));

Review Comment:
   as above



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/SeaTunnelServer.java:
##########
@@ -159,19 +165,24 @@ public LiveOperationRegistry getLiveOperationRegistry() {
     @SuppressWarnings("checkstyle:MagicNumber")
     public CoordinatorService getCoordinatorService() {
         int retryCount = 0;
-        while (coordinatorService.isMasterNode() && !coordinatorService.isCoordinatorActive() && retryCount < 20) {
-            try {
-                logger.warning("Waiting this node become the active master node");
-                Thread.sleep(1000);
-                retryCount++;
-            } catch (InterruptedException e) {
-                throw new RuntimeException(e);
+        if (isMasterNode()) {
+            while (!coordinatorService.isCoordinatorActive() && retryCount < 20000 && isRunning) {

Review Comment:
   extract `20000` as a constant field?



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java:
##########
@@ -146,8 +155,11 @@ private void initCoordinatorService() {
         ownedSlotProfilesIMap = nodeEngine.getHazelcastInstance().getMap(Constant.IMAP_OWNED_SLOT_PROFILES);
 
         List<CompletableFuture<Void>> collect = runningJobInfoIMap.entrySet().stream().map(entry -> {
-            return CompletableFuture.runAsync(() -> restoreJobFromMasterActiveSwitch(entry.getKey(), entry.getValue()),
-                executorService);
+            return CompletableFuture.runAsync(() -> {
+                logger.info(String.format("begin restore job (%s) from master active switch", entry.getKey()));

Review Comment:
   Use `{}` instead of String.format
   
   https://stackoverflow.com/questions/41532840/log4j2-using-against-using-d-or-s



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org