morningman commented on a change in pull request #6418:
URL: https://github.com/apache/incubator-doris/pull/6418#discussion_r698919562



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/analysis/ChannelDescription.java
##########
@@ -60,6 +60,8 @@
     // column names of source table
     @SerializedName(value = "colNames")
     private final List<String> colNames;
+    @SerializedName(value = "id")

Review comment:
       use same name as variables

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/task/SerialExecutorService.java
##########
@@ -0,0 +1,80 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.task;
+
+import org.apache.doris.common.ThreadPoolManager;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * This executor service ensures that all tasks submitted to
+ * the same slot are executed in the order of submission.
+ */
+public class SerialExecutorService {
+
+    public interface SerialRunnable extends Runnable {
+        int getIndex();
+    }
+
+    private final int numOfSlots;
+    private final ExecutorService taskPool;
+    private final SerialExecutor[] slots;
+
+    private SerialExecutorService(int numOfSlots, ExecutorService taskPool) {
+        this.numOfSlots = numOfSlots;
+        this.slots = new SerialExecutor[numOfSlots];
+        this.taskPool = taskPool;
+        for (int i = 0; i < numOfSlots; i++) {
+            slots[i] = new SerialExecutor(taskPool);
+        }
+    }
+
+    public SerialExecutorService(int numOfSlots) {
+        this(numOfSlots, ThreadPoolManager.newDaemonFixedThreadPool(
+                numOfSlots, 256, "sync-task-pool", true));
+    }
+
+    public void submit(Runnable command) {
+        int index = getIndex(command);
+        if (isSlotIndex(index)) {
+            SerialExecutor serialEx = slots[index];
+            serialEx.execute(command);
+        } else {
+            taskPool.execute(command);

Review comment:
       Do we need to accept task without index in this pool?

##########
File path: fe/fe-core/src/main/java/org/apache/doris/task/SyncTask.java
##########
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.task;
+
+import org.apache.doris.load.sync.SyncChannelCallback;
+import org.apache.doris.task.SerialExecutorService.SerialRunnable;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public abstract class SyncTask implements SerialRunnable {
+    private static final Logger LOG = LogManager.getLogger(SyncTask.class);
+
+    protected long signature;
+    protected int index;

Review comment:
       Add comment to explain the `index`




-- 
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-unsubscr...@doris.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to