phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [2/2] phoenix git commit: PHOENIX-2680 stats table timestamp incorrectly used as table timestamp
Date Wed, 17 Feb 2016 01:29:35 GMT
PHOENIX-2680 stats table timestamp incorrectly used as table timestamp

Conflicts:

	phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 4e990c93d55f26b196767c3d46efb2c9a4e81549
Parents: d94afb8
Author: James Taylor <jamestaylor@apache.org>
Authored: Tue Feb 16 17:17:54 2016 -0800
Committer: James Taylor <jamestaylor@apache.org>
Committed: Tue Feb 16 17:27:58 2016 -0800

----------------------------------------------------------------------
 .../UngroupedAggregateRegionObserver.java           | 16 ++++------------
 .../phoenix/schema/stats/StatisticsCollector.java   | 16 ++++++++++------
 2 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e990c93/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
index 9e681ab..6e90e22 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionObserver.java
@@ -79,7 +79,6 @@ import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.index.PhoenixIndexCodec;
 import org.apache.phoenix.join.HashJoinInfo;
 import org.apache.phoenix.query.QueryConstants;
-import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.ConstraintViolationException;
 import org.apache.phoenix.schema.PColumn;
@@ -111,12 +110,12 @@ import org.apache.phoenix.util.TimeKeeper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import co.cask.tephra.TxConstants;
+
 import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
-import co.cask.tephra.TxConstants;
-
 
 /**
  * Region observer that aggregates ungrouped rows(i.e. SQL query with aggregation function
and no GROUP BY).
@@ -610,21 +609,14 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
         InternalScanner internalScanner = scanner;
         if (scanType.equals(ScanType.COMPACT_DROP_DELETES)) {
             try {
-                boolean useCurrentTime = 
-                        c.getEnvironment().getConfiguration().getBoolean(QueryServices.STATS_USE_CURRENT_TIME_ATTRIB,

-                                QueryServicesOptions.DEFAULT_STATS_USE_CURRENT_TIME);
                 Pair<HRegionInfo, HRegionInfo> mergeRegions = null;
                 if (store.hasReferences()) {
                     mergeRegions = MetaReader.getRegionsFromMergeQualifier(
                             c.getEnvironment().getRegionServerServices().getCatalogTracker(),
                             c.getEnvironment().getRegion().getRegionInfo().getRegionName());
                 }
-                // Provides a means of clients controlling their timestamps to not use current
time
-                // when background tasks are updating stats. Instead we track the max timestamp
of
-                // the cells and use that.
-                long clientTimeStamp = useCurrentTime ? TimeKeeper.SYSTEM.getCurrentTime()
: StatisticsCollector.NO_TIMESTAMP;
-                StatisticsCollector stats = new StatisticsCollector(
-                        c.getEnvironment(), table.getNameAsString(),
+                long clientTimeStamp = TimeKeeper.SYSTEM.getCurrentTime();
+                StatisticsCollector stats = new StatisticsCollector(c.getEnvironment(), table.getNameAsString(),
                         clientTimeStamp, store.getFamily().getName());
                 internalScanner = stats.createCompactionScanner(c.getEnvironment(), store,
scanner, mergeRegions);
             } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4e990c93/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
index 97de270..51e80fa 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsCollector.java
@@ -63,11 +63,6 @@ public class StatisticsCollector {
     protected StatisticsWriter statsTable;
     private Pair<Long, GuidePostsInfoBuilder> cachedGps = null;
 
-    public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp)
-            throws IOException {
-        this(env, tableName, clientTimeStamp, null, null, null);
-    }
-
     public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp,
             byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException {
         this(env, tableName, clientTimeStamp, null, gp_width_bytes, gp_per_region_bytes);
@@ -78,7 +73,7 @@ public class StatisticsCollector {
         this(env, tableName, clientTimeStamp, family, null, null);
     }
 
-    public StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp,
byte[] family,
+    private StatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long
clientTimeStamp, byte[] family,
             byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException {
         Configuration config = env.getConfiguration();
         int guidepostPerRegion = gp_per_region_bytes == null
@@ -91,6 +86,15 @@ public class StatisticsCollector {
                 : PLong.INSTANCE.getCodec().decodeInt(gp_width_bytes, 0, SortOrder.getDefault());
         this.guidepostDepth = StatisticsUtil.getGuidePostDepth(guidepostPerRegion, guidepostWidth,
                 env.getRegion().getTableDesc());
+        // Provides a means of clients controlling their timestamps to not use current time
+        // when background tasks are updating stats. Instead we track the max timestamp of
+        // the cells and use that.
+        boolean useCurrentTime = env.getConfiguration().getBoolean(
+                QueryServices.STATS_USE_CURRENT_TIME_ATTRIB,
+                QueryServicesOptions.DEFAULT_STATS_USE_CURRENT_TIME);
+        if (!useCurrentTime) {
+            clientTimeStamp = StatisticsCollector.NO_TIMESTAMP;
+        }
         // Get the stats table associated with the current table on which the CP is
         // triggered
         this.statsTable = StatisticsWriter.newWriter(env, tableName, clientTimeStamp);


Mime
View raw message