[fix](statistics) remove statistical task multiple times in one loop cycle (#12741)

There is a problem with StatisticsTaskScheduler. The peek() method obtains a reference to the same task object, but the for-loop executes multiple removes.
This commit is contained in:
ElvinWei
2022-09-19 19:28:51 +08:00
committed by GitHub
parent 4b5cc62348
commit 1339eef33c

View File

@ -68,7 +68,6 @@ public class StatisticsTaskScheduler extends MasterDaemon {
Map<Long, List<Map<Long, Future<StatisticsTaskResult>>>> resultMap = Maps.newLinkedHashMap();
for (StatisticsTask task : tasks) {
queue.remove();
long jobId = task.getJobId();
if (checkJobIsValid(jobId)) {
@ -100,7 +99,7 @@ public class StatisticsTaskScheduler extends MasterDaemon {
List<StatisticsTask> tasks = Lists.newArrayList();
int i = Config.cbo_concurrency_statistics_task_num;
while (i > 0) {
StatisticsTask task = queue.peek();
StatisticsTask task = queue.poll();
if (task == null) {
break;
}