Vladsz83 commented on code in PR #12595:
URL: https://github.com/apache/ignite/pull/12595#discussion_r2640697482


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java:
##########
@@ -315,6 +319,28 @@ public CalciteQueryProcessor(GridKernalContext ctx) {
         }
 
         distrCfg = new DistributedCalciteConfiguration(ctx, log);
+
+        // A listener to clean the plans cache if a rule was disabled.
+        
ctx.internalSubscriptionProcessor().registerDistributedConfigurationListener(new
 DistributedConfigurationLifecycleListener() {
+            @Override public void 
onReadyToRegister(DistributedPropertyDispatcher dispatcher) {
+                // No-op.
+            }
+
+            @Override public void onReadyToWrite() {
+                assert distrCfg.disabledRulesProperty() != null;
+
+                distrCfg.disabledRulesProperty().addListener(new 
DistributePropertyListener<>() {
+                    @Override public void onUpdate(String name, String[] 
oldVal, String[] newVal) {
+                        if (oldVal != null && F.compareArrays(oldVal, newVal) 
!= 0) {
+                            log.warning("Cleaning Calcite's cache plan by 
setting changing of the property '"
+                                + distrCfg.disabledRulesProperty().getName() + 
"'.");
+
+                            qryPlanCache.clear();
+                        }
+                    }
+                });

Review Comment:
   I don't like how `LifecycleAware` is implemented here. IMHO, it's something 
that should be registered in `IgniteKernal` and invoked from there. And how the 
services are traversed to call `onStart`. Also, the configuration doesn't seem 
to be a service or something that requires start/stop events.



-- 
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]

Reply via email to