Skip to content

Commit

Permalink
[BugFix] Use a separate thread pool for dictionary collection (backport
Browse files Browse the repository at this point in the history
#54454) (#54513)

Signed-off-by: stdpain <[email protected]>
Co-authored-by: stdpain <[email protected]>
  • Loading branch information
mergify[bot] and stdpain authored Dec 31, 2024
1 parent e77747f commit 8b431fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,9 @@ public class Config extends ConfigBase {
@ConfField
public static long statistic_dict_columns = 100000;

@ConfField
public static int dict_collect_thread_pool_size = 16;

/**
* The column statistic cache update interval
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.starrocks.common.Config;
import com.starrocks.common.Pair;
import com.starrocks.common.Status;
import com.starrocks.common.ThreadPoolManager;
import com.starrocks.memory.MemoryTrackable;
import com.starrocks.qe.ConnectContext;
import com.starrocks.server.GlobalStateMgr;
Expand Down Expand Up @@ -53,7 +54,7 @@ public class CacheDictManager implements IDictManager, MemoryTrackable {

public static final Integer LOW_CARDINALITY_THRESHOLD = 255;

private CacheDictManager() {
public CacheDictManager() {
}

private static final CacheDictManager INSTANCE = new CacheDictManager();
Expand Down Expand Up @@ -106,6 +107,8 @@ public CompletableFuture<Optional<ColumnDict>> asyncReload(

private final AsyncLoadingCache<ColumnIdentifier, Optional<ColumnDict>> dictStatistics = Caffeine.newBuilder()
.maximumSize(Config.statistic_dict_columns)
.executor(ThreadPoolManager.newDaemonCacheThreadPool(Config.dict_collect_thread_pool_size, "cache-dict",
false))
.buildAsync(dictLoader);

private Optional<ColumnDict> deserializeColumnDict(long tableId, String columnName, TStatisticData statisticData) {
Expand Down

0 comments on commit 8b431fe

Please sign in to comment.