Hisoka-X commented on code in PR #4615:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4615#discussion_r1174497570


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointPlan.java:
##########
@@ -61,12 +61,12 @@ public class CheckpointPlan {
     private final Map<TaskLocation, Set<Tuple2<ActionStateKey, Integer>>> 
subtaskActions;
 
     public static final class Builder {
-        private final Set<TaskLocation> pipelineSubtasks = new HashSet<>();
-        private final Set<TaskLocation> startingSubtasks = new HashSet<>();
-        private final Map<ActionStateKey, Integer> pipelineActions = new 
HashMap<>();
+        private final Set<TaskLocation> pipelineSubtasks = new 
CopyOnWriteArraySet<>();

Review Comment:
   Note: make sure Set::Stream doesn't have concurrency issues



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java:
##########
@@ -397,7 +397,7 @@ private void startTriggerPendingCheckpoint(
                     LOG.info("wait checkpoint completed: " + 
pendingCheckpoint.getCheckpointId());
                     PassiveCompletableFuture<CompletedCheckpoint> 
completableFuture =
                             pendingCheckpoint.getCompletableFuture();
-                    completableFuture.whenComplete(
+                    completableFuture.whenCompleteAsync(

Review Comment:
   Note: make sure the `TaskAcknowledgeOperation` thread will be release after 
operation called.



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java:
##########
@@ -335,15 +343,15 @@ public Set<URL> getJarsUrl() {
     @Override
     public void notifyCheckpointComplete(long checkpointId) throws Exception {
         getEnumerator().notifyCheckpointComplete(checkpointId);
-        if (currState == PREPARE_CLOSE && prepareCloseBarrierId.get() == 
checkpointId) {
+        if (prepareCloseBarrierId.get() == checkpointId) {

Review Comment:
   Note: Unecessary check



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java:
##########
@@ -133,7 +135,7 @@ public ProgressState call() throws Exception {
     public void triggerBarrier(Barrier barrier) throws Exception {
         log.debug("split enumer trigger barrier [{}]", barrier);
         if (barrier.prepareClose()) {
-            this.currState = PREPARE_CLOSE;

Review Comment:
   Note: The state machine state cannot be changed outside the state machine. 
Just should send event.



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/SourceSplitEnumeratorTask.java:
##########
@@ -262,12 +264,16 @@ private void stateProcess() throws Exception {
                 if (restoreComplete.isDone()) {
                     currState = READY_START;
                     reportTaskStatus(READY_START);
+                } else {
+                    Thread.sleep(100);

Review Comment:
   Avoid CPU cost too high.



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/NodeEngineUtil.java:
##########
@@ -37,7 +37,8 @@ public static <E> InvocationFuture<E> 
sendOperationToMasterNode(
                         .createInvocationBuilder(
                                 SeaTunnelServer.SERVICE_NAME,
                                 operation,
-                                nodeEngine.getMasterAddress());
+                                nodeEngine.getMasterAddress())
+                        .setAsync();

Review Comment:
   In task our all opeartion should be async as default .



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

Reply via email to