[minor](stats) Report error with more friendly meesage when timeout (#27197)

This commit is contained in:
AKIRA
2023-11-22 19:50:09 +09:00
committed by GitHub
parent cfb6af295f
commit c7e3d74ffc

View File

@ -92,7 +92,7 @@ import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
@ -678,7 +678,7 @@ public class AnalysisManager implements Writable {
return new ThreadPoolExecutor(0,
ConnectContext.get().getSessionVariable().parallelSyncAnalyzeTaskNum,
0, TimeUnit.SECONDS,
new SynchronousQueue(),
new LinkedBlockingQueue<>(),
new ThreadFactoryBuilder().setDaemon(true).setNameFormat("SYNC ANALYZE" + "-%d")
.build(), new BlockedPolicy(poolName,
StatisticsUtil.getAnalyzeTimeout()));
@ -832,6 +832,9 @@ public class AnalysisManager implements Writable {
LOG.warn("Thread got interrupted when waiting sync analyze task execution finished", t);
}
if (!colNames.isEmpty()) {
if (cancelled) {
throw new RuntimeException("Cancelled");
}
throw new RuntimeException("Failed to analyze following columns:[" + String.join(",", colNames)
+ "] Reasons: " + String.join(",", errorMessages));
}