[13/28] phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-27 Thread pboado
PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/21c3a7c2
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/21c3a7c2
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/21c3a7c2

Branch: refs/heads/4.x-cdh5.15
Commit: 21c3a7c2e9cd4d4f59623dd987c6602304ac9335
Parents: a0e9859
Author: Ankit Singhal 
Authored: Tue Nov 13 19:36:26 2018 +
Committer: Pedro Boado 
Committed: Tue Nov 27 15:11:41 2018 +

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/21c3a7c2/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



[1/6] phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-14 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/omid2 28b9dd576 -> ddf73283c


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8cd7898a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8cd7898a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8cd7898a

Branch: refs/heads/omid2
Commit: 8cd7898a1acf1368a05a2e893253cecc53416080
Parents: 169270d
Author: Ankit Singhal 
Authored: Tue Nov 13 11:39:58 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:39:58 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8cd7898a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-13 Thread ankit
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 f6e860dc9 -> 64afc405a


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/64afc405
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/64afc405
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/64afc405

Branch: refs/heads/4.x-HBase-1.1
Commit: 64afc405a64200780bc0e6ff6d0087591f71f815
Parents: f6e860d
Author: Ankit Singhal 
Authored: Tue Nov 13 11:36:26 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:43:16 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/64afc405/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-13 Thread ankit
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 526de5336 -> 798aaeedb


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/798aaeed
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/798aaeed
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/798aaeed

Branch: refs/heads/4.x-HBase-1.2
Commit: 798aaeedb6ab4a52019bd32443397f8c1dcd08bf
Parents: 526de53
Author: Ankit Singhal 
Authored: Tue Nov 13 11:36:26 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:41:50 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/798aaeed/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-13 Thread ankit
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 169270daa -> 8cd7898a1


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8cd7898a
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8cd7898a
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8cd7898a

Branch: refs/heads/4.x-HBase-1.3
Commit: 8cd7898a1acf1368a05a2e893253cecc53416080
Parents: 169270d
Author: Ankit Singhal 
Authored: Tue Nov 13 11:39:58 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:39:58 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/8cd7898a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-13 Thread ankit
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.4 70a699e30 -> ce89c2c1d


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ce89c2c1
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ce89c2c1
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ce89c2c1

Branch: refs/heads/4.x-HBase-1.4
Commit: ce89c2c1da6e9d81570b18d7b252b0cc24afbcd8
Parents: 70a699e
Author: Ankit Singhal 
Authored: Tue Nov 13 11:36:26 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:37:35 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ce89c2c1/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index d27be1b..1d9fa36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */



phoenix git commit: PHOENIX-5010 Don't build client guidepost cache when phoenix.stats.collection.enabled is disabled

2018-11-13 Thread ankit
Repository: phoenix
Updated Branches:
  refs/heads/master d9d8fd0c4 -> 4b4466f9b


PHOENIX-5010 Don't build client guidepost cache when 
phoenix.stats.collection.enabled is disabled


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4b4466f9
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4b4466f9
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4b4466f9

Branch: refs/heads/master
Commit: 4b4466f9bfdddac7c3e9c70b213da1a42ed2d93e
Parents: d9d8fd0
Author: Ankit Singhal 
Authored: Tue Nov 13 11:36:26 2018 -0800
Committer: Ankit Singhal 
Committed: Tue Nov 13 11:36:26 2018 -0800

--
 .../org/apache/phoenix/query/GuidePostsCache.java | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4b4466f9/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java 
b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
index 7c57122..b78879b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/GuidePostsCache.java
@@ -16,6 +16,10 @@
  */
 package org.apache.phoenix.query;
 
+import static org.apache.phoenix.query.QueryServices.STATS_COLLECTION_ENABLED;
+import static org.apache.phoenix.query.QueryServices.STATS_ENABLED_ATTRIB;
+import static 
org.apache.phoenix.query.QueryServicesOptions.DEFAULT_STATS_COLLECTION_ENABLED;
+
 import java.io.IOException;
 import java.util.List;
 import java.util.Objects;
@@ -66,6 +70,8 @@ public class GuidePostsCache {
 final long maxTableStatsCacheSize = config.getLong(
 QueryServices.STATS_MAX_CACHE_SIZE,
 QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE);
+   final boolean isStatsEnabled = 
config.getBoolean(STATS_COLLECTION_ENABLED, DEFAULT_STATS_COLLECTION_ENABLED)
+   && config.getBoolean(STATS_ENABLED_ATTRIB, 
true);
 cache = CacheBuilder.newBuilder()
 // Expire entries a given amount of time after they were 
written
 .expireAfterWrite(statsUpdateFrequency, TimeUnit.MILLISECONDS)
@@ -80,7 +86,7 @@ public class GuidePostsCache {
 // Log removals at TRACE for debugging
 .removalListener(new PhoenixStatsCacheRemovalListener())
 // Automatically load the cache when entries are missing
-.build(new StatsLoader());
+.build(isStatsEnabled ? new StatsLoader() : new 
EmptyStatsLoader());
 }
 
 /**
@@ -129,6 +135,16 @@ public class GuidePostsCache {
 }
 
 /**
+ * Empty stats loader if stats are disabled
+ */
+   protected class EmptyStatsLoader extends CacheLoader {
+   @Override
+   public GuidePostsInfo load(GuidePostsKey statsKey) throws 
Exception {
+   return GuidePostsInfo.NO_GUIDEPOST;
+   }
+   }
+
+/**
  * Returns the underlying cache. Try to use the provided methods instead 
of accessing the cache
  * directly.
  */