zstan commented on code in PR #6593:
URL: https://github.com/apache/ignite-3/pull/6593#discussion_r2392266050
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/PrepareServiceImpl.java:
##########
@@ -858,6 +1046,149 @@ private static ParameterMetadata
createParameterMetadata(RelDataType parameterRo
return new ParameterMetadata(parameterTypes);
}
+ public void statisticsChanged(int tableId) {
+ planUpdater.statisticsChanged(tableId);
+ }
+
+ private static class PlanUpdater {
+ private final ClockService clockService;
+
+ private final ScheduledExecutorService planUpdater;
+
+ private final AtomicReference<CompletableFuture<PlanInfo>>
rePlanningFut = new AtomicReference<>(nullCompletedFuture());
+
+ private volatile boolean recalculatePlans;
+
+ private final Cache<CacheKey, CompletableFuture<PlanInfo>> cache;
+
+ private final SqlSchemaManager schemaManager;
+
+ private final long plannerTimeout;
+
+ private final PlanPrepare prepare;
+
+ PlanUpdater(
+ ClockService clockService,
+ ScheduledExecutorService planUpdater,
+ Cache<CacheKey, CompletableFuture<PlanInfo>> cache,
+ SqlSchemaManager schemaManager,
+ long plannerTimeout,
+ PlanPrepare prepare
+ ) {
+ this.clockService = clockService;
+ this.planUpdater = planUpdater;
+ this.cache = cache;
+ this.schemaManager = schemaManager;
+ this.plannerTimeout = plannerTimeout;
+ this.prepare = prepare;
+ }
+
+ /**
+ * Reacts to the changed statistic.
+ *
+ * @param tableId Table Id statistic changed for.
+ */
+ void statisticsChanged(int tableId) {
+ Set<Entry<CacheKey, CompletableFuture<PlanInfo>>> cachedEntries =
cache.entrySet();
+
+ int currentCatalogVersion =
schemaManager.catalogVersion(clockService.now().longValue());
+
+ boolean statChanged = false;
+
+ for (Map.Entry<CacheKey, CompletableFuture<PlanInfo>> ent :
cachedEntries) {
Review Comment:
i rework this test, seems now it correct
--
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]