xy720 commented on a change in pull request #6418: URL: https://github.com/apache/incubator-doris/pull/6418#discussion_r698446514
########## File path: fe/fe-core/src/main/java/org/apache/doris/task/SyncTaskPool.java ########## @@ -0,0 +1,35 @@ +// 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 java.util.concurrent.ExecutorService; + +public class SyncTaskPool { + + private static final ExecutorService executor = new StripedTaskExecutor(); + + public SyncTaskPool() { Review comment: Fixed ########## File path: fe/fe-core/src/main/java/org/apache/doris/common/Config.java ########## @@ -634,6 +634,11 @@ */ @ConfField public static int sync_checker_interval_second = 5; + /** + * max num of thread to handle sync task in sync task thread-pool. + */ + @ConfField public static int max_sync_task_threads_num = 1024; Review comment: Now is 10. ########## 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: done ########## 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: It‘s for compatibility with general thread pools ########## 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: done -- 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