englefly commented on code in PR #69322:
URL: https://github.com/apache/doris/pull/69322#discussion_r4347411322


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/stats/HboPlanInfoProvider.java:
##########
@@ -147,35 +315,62 @@ public void handle(Field field, String confVal) throws 
Exception {
     }
 
     /**
-     * Reference the above UpdateConfig comments.
+     * Reference the above UpdateConfig comments. Every per-query cache of 
this provider is rebuilt
+     * (they are all sized and expired by the same two configs), and the 
entries of a running query
+     * are carried over so that a runtime change cannot drop the plan info of 
a query which is still
+     * in flight.
      */
     public static synchronized void updateConfig() {
         HboPlanStatisticsManager hboManger = 
Env.getCurrentEnv().getHboPlanStatisticsManager();
         if (hboManger == null) {
             return;
         }
-        HboPlanInfoProvider planInfoProvider = 
hboManger.getHboPlanInfoProvider();
-        if (planInfoProvider == null) {
+        HboPlanInfoProvider provider = hboManger.getHboPlanInfoProvider();
+        if (provider == null) {
             return;
         }
+        int cacheNum = Config.hbo_plan_info_cache_num;
+        int pinnedCacheNum = Config.hbo_pinned_stats_cache_num;
+        long expireSeconds = Config.expire_hbo_plan_info_cache_in_fe_second;
 
-        Cache<String, Map<Integer, PhysicalPlan>> idToPlanCache = 
buildHboIdToPlanCache(
-                Config.hbo_plan_info_cache_num,
-                Config.expire_hbo_plan_info_cache_in_fe_second
-        );
-        Cache<String, Map<PhysicalPlan, Integer>> planToIdCache = 
buildHboPlanToIdCache(
-                Config.hbo_plan_info_cache_num,
-                Config.expire_hbo_plan_info_cache_in_fe_second
-        );
-        Cache<String, Map<RelationId, Set<Expression>>> scanToFilterCache = 
buildHboScanToFilterCache(
-                Config.hbo_plan_info_cache_num,
-                Config.expire_hbo_plan_info_cache_in_fe_second
-        );
-        idToPlanCache.putAll(planInfoProvider.idToPlanCache.asMap());
-        planInfoProvider.idToPlanCache = idToPlanCache;
-        planToIdCache.putAll(planInfoProvider.planToIdCache.asMap());
-        planInfoProvider.planToIdCache = planToIdCache;
-        scanToFilterCache.putAll(planInfoProvider.scanToFilterCache.asMap());
-        planInfoProvider.scanToFilterCache = scanToFilterCache;
+        Cache<String, Map<Integer, PhysicalPlan>> idToPlanCache =
+                buildHboIdToPlanCache(cacheNum, expireSeconds);
+        idToPlanCache.putAll(provider.idToPlanCache.asMap());
+        provider.idToPlanCache = idToPlanCache;
+
+        Cache<String, Map<PhysicalPlan, Integer>> planToIdCache =
+                buildHboPlanToIdCache(cacheNum, expireSeconds);
+        planToIdCache.putAll(provider.planToIdCache.asMap());
+        provider.planToIdCache = planToIdCache;
+
+        Cache<String, Map<RelationId, Set<Expression>>> scanToFilterCache =
+                buildHboScanToFilterCache(cacheNum, expireSeconds);
+        scanToFilterCache.putAll(provider.scanToFilterCache.asMap());
+        provider.scanToFilterCache = scanToFilterCache;

Review Comment:
   这是learned hbo 专属的成员. learned hbo 后续pr要完全重做, 采用pinned 的处理方式替代 relatoinId的作用. 
不在这个pr里实现



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to