BinShi-SecularBird commented on a change in pull request #425: PHOENIX-5069 Use 
asynchronous refresh to provide non-blocking Phoenix Stats Client Cache
URL: https://github.com/apache/phoenix/pull/425#discussion_r248832558
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
 ##########
 @@ -85,39 +106,54 @@ public GuidePostsCache(ConnectionQueryServices 
queryServices, Configuration conf
                 })
                 // Log removals at TRACE for debugging
                 .removalListener(new PhoenixStatsCacheRemovalListener())
-                // Automatically load the cache when entries are missing
-                .build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
+                // Automatically load the cache when entries need to be 
refreshed
+                .build(cacheLoader);
     }
 
     /**
-     * {@link CacheLoader} implementation for the Phoenix Table Stats cache.
+     * {@link PhoenixStatsLoader} implementation for the Stats Loader.
      */
-    protected class StatsLoader extends CacheLoader<GuidePostsKey, 
GuidePostsInfo> {
+    protected class StatsLoaderImpl implements PhoenixStatsLoader {
         @Override
-        public GuidePostsInfo load(GuidePostsKey statsKey) throws Exception {
+        public boolean needsLoad() {
+            // Whenever it's called, we try to load stats from stats table
+            // no matter it has been updated or not.
+            // TODO:
 
 Review comment:
   I'll remove this TODO because here I just want to point out the possible 
optimizations we can do here which haven't been formalized as the solutions we 
must do in the future.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to