sunxiaojian commented on code in PR #4683:
URL:
https://github.com/apache/incubator-seatunnel/pull/4683#discussion_r1191168509
##########
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:
> 1、"Why is it necessary for all nodes to be STARTED? Isn't it enough to
just judge if the ClusterState is ACTIVE?" 2、"The getLifecycleService should
obtain the LifecycleListener of the current instance, which should only receive
the status change of the current node. In a cluster mode, shouldn't the
waitClusterStarted.getCount() always be non-zero?"
>
> <img alt="image" width="667"
src="https://user-images.githubusercontent.com/83933160/237607445-6a09f69b-450b-429c-a17f-ab6b7a9f9a75.png">
@ic4y Just judging that ClusterState=ACTIVE will still throw the same
exception. Let me reconsider how to solve it
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]