You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "sunxiaojian (via GitHub)" <gi...@apache.org> on 2023/05/12 02:42:03 UTC

[GitHub] [incubator-seatunnel] sunxiaojian commented on a diff in pull request #4683: [Feature][SeaTunnel Engine IMap Storage] Add OSS support for Imap storage to cluster-mode type

sunxiaojian commented on code in PR #4683:
URL: https://github.com/apache/incubator-seatunnel/pull/4683#discussion_r1191853123


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/TaskExecutionService.java:
##########
@@ -455,6 +459,37 @@ private synchronized void updateMetricsContextInImap() {
         contextMap.putAll(finishedExecutionContexts);
         contextMap.putAll(executionContexts);
         try {
+            ClusterState clusterState =
+                    nodeEngine.getHazelcastInstance().getCluster().getClusterState();
+            if (clusterState != ClusterState.ACTIVE) {
+                logger.warning(
+                        String.format(
+                                "The cluster is not ready yet, cluster state [%s], looking forward to the next "
+                                        + "scheduling",
+                                clusterState));
+                return;
+            }
+            // Waiting for cluster startup to complete
+            if (waitClusterStarted == null) {
+                waitClusterStarted =
+                        new CountDownLatch(
+                                nodeEngine.getHazelcastInstance().getCluster().getMembers().size());
+                nodeEngine
+                        .getHazelcastInstance()
+                        .getLifecycleService()
+                        .addLifecycleListener(
+                                event -> {
+                                    if (event.getState() == LifecycleEvent.LifecycleState.STARTED) {
+                                        waitClusterStarted.countDown();
+                                    }
+                                });
+            }
+            if (waitClusterStarted.getCount() > 0) {
+                logger.warning(
+                        "The cluster is not ready yet, looking forward to the next scheduling");
+                return;
+            }
+

Review Comment:
   > I've reviewed the code, and the exception might be thrown because the current Node hasn't finished initializing. Try using nodeEngine.getNode().getState().equals(NodeState.ACTIVE) and see how it goes.
   
   @ic4y I have determined the cause of the null pointer, let me verify it first



-- 
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