AMashenkov commented on code in PR #6593:
URL: https://github.com/apache/ignite-3/pull/6593#discussion_r2351700259


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/PrepareServiceImpl.java:
##########
@@ -231,12 +262,67 @@ public void start() {
         metricManager.enable(PLANNING_EXECUTOR_SOURCE_NAME);
 
         IgnitePlanner.warmup();
+
+        ScheduledExecutorService planUpdater = 
Executors.newSingleThreadScheduledExecutor(
+                IgniteThreadFactory.create(nodeName, "sql-query-plan-refresh", 
true, LOG)
+        );
+
+        planUpdater.scheduleAtFixedRate(() -> {
+            for (CacheKey key : weakCache.asMap().keySet()) {
+                CompletableFuture<PlanInfo> fut = cache.get(key);
+
+                // can be evicted
+                if (fut != null) {
+                    PlanInfo info = fut.join();
+                    assert info.context != null && info.statement != null;
+
+                    assert isCompletedSuccessfully(fut);
+
+                    int currentCatalogVersion = 
schemaManager.catalogVersion(clockService.now().longValue());
+
+                    if (currentCatalogVersion == key.catalogVersion()) {
+                        SqlQueryType queryType = 
key.parsedResult().queryType();
+
+                        if (queryType == SqlQueryType.QUERY || queryType == 
SqlQueryType.DML) {

Review Comment:
   Let's replace with assert and do not allow adding other query types instead.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to