PHOENIX-2696 Delete stale stats for a region if in later run no guidePosts 
found for that region(Ankit Singhal)


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

Branch: refs/heads/calcite
Commit: 9dd6babd86186242b55d01afcb857aa02497ea95
Parents: c2cc1be
Author: Ankit Singhal <ankitsingha...@gmail.com>
Authored: Fri Feb 19 22:28:07 2016 +0530
Committer: Ankit Singhal <ankitsingha...@gmail.com>
Committed: Fri Feb 19 22:28:07 2016 +0530

----------------------------------------------------------------------
 .../phoenix/schema/stats/DefaultStatisticsCollector.java     | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9dd6babd/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
index 96b35f1..cb6f5d4 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java
@@ -126,6 +126,14 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
             throws IOException {
         try {
             // update the statistics table
+            // Delete statistics for a region if no guidepost is collected for 
that region during UPDATE STATISTICS
+            // This will not impact a stats collection of single column family 
during compaction as
+            // guidePostsInfoWriterMap cannot be empty in this case.
+            if (guidePostsInfoWriterMap.keySet().isEmpty()) {
+                for (Store store : region.getStores()) {
+                    statsTable.deleteStats(region, this, new 
ImmutableBytesPtr(store.getFamily().getName()), mutations);
+                }
+            }
             for (ImmutableBytesPtr fam : guidePostsInfoWriterMap.keySet()) {
                 if (delete) {
                     if (logger.isDebugEnabled()) {

Reply via email to