[fix](mtmv)fix thread local reference to checkpoint's Env, causing Env to be unable to be reclaimed, resulting in excessive memory usage by FE (#28723)

when replay addTaskResult log,will create one ConnectContext,and set Env.getCurrentEnv,then store this ctx in ConnectContext.threadLocalInfo,threadLocalInfo is static,so this ctx can not be recycling,Env of replay thread also can not be recycling
This commit is contained in:
zhangdong
2023-12-20 19:46:58 +08:00
committed by GitHub
parent 7b96730e87
commit ea646c6682

View File

@ -153,11 +153,13 @@ public class MTMV extends OlapTable {
this.status.setSchemaChangeDetail(null);
this.status.setRefreshState(MTMVRefreshState.SUCCESS);
this.relation = relation;
try {
this.cache = MTMVCache.from(this, MTMVPlanUtil.createMTMVContext(this));
} catch (Throwable e) {
this.cache = null;
LOG.warn("generate cache failed", e);
if (!Env.isCheckpointThread()) {
try {
this.cache = MTMVCache.from(this, MTMVPlanUtil.createMTMVContext(this));
} catch (Throwable e) {
this.cache = null;
LOG.warn("generate cache failed", e);
}
}
} else {
this.status.setRefreshState(MTMVRefreshState.FAIL);