phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject git commit: PHOENIX-1406 Use preCompact hook instead of preCompactScannerOpen for stats collection
Date Wed, 05 Nov 2014 08:29:55 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 86dff2cc4 -> 1fb89e4ab


PHOENIX-1406 Use preCompact hook instead of preCompactScannerOpen for stats collection


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

Branch: refs/heads/master
Commit: 1fb89e4ab1bcecfc542526b9bf608c09388ced7a
Parents: 86dff2c
Author: James Taylor <jtaylor@salesforce.com>
Authored: Wed Nov 5 00:27:36 2014 -0800
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Wed Nov 5 00:29:47 2014 -0800

----------------------------------------------------------------------
 .../UngroupedAggregateRegionObserver.java       | 16 ++++++------
 .../schema/stats/StatisticsCollector.java       | 26 +++-----------------
 2 files changed, 11 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1fb89e4a/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 5131bbc..fcc744a 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
@@ -452,13 +452,12 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver{
     }
     
     @Override
-    public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment>
c,
-            Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,
-            long earliestPutTs, InternalScanner s) throws IOException {
-        InternalScanner internalScan = s;
+    public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment>
c,
+        final Store store, InternalScanner scanner, final ScanType scanType)
+        throws IOException {
         TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
-        if (!table.getNameAsString().equals(PhoenixDatabaseMetaData.SYSTEM_STATS_NAME)
-                && scanType.equals(ScanType.COMPACT_DROP_DELETES)) {
+        InternalScanner internalScanner = scanner;
+        if (scanType.equals(ScanType.COMPACT_DROP_DELETES)) {
             try {
                 boolean useCurrentTime = 
                         c.getEnvironment().getConfiguration().getBoolean(QueryServices.STATS_USE_CURRENT_TIME_ATTRIB,

@@ -468,8 +467,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver{
                 // the cells and use that.
                 long clientTimeStamp = useCurrentTime ? TimeKeeper.SYSTEM.getCurrentTime()
: StatisticsCollector.NO_TIMESTAMP;
                 StatisticsCollector stats = new StatisticsCollector(c.getEnvironment(), table.getNameAsString(),
clientTimeStamp);
-                internalScan =
-                        stats.createCompactionScanner(c.getEnvironment().getRegion(), store,
scanners, scanType, earliestPutTs, s);
+                internalScanner = stats.createCompactionScanner(c.getEnvironment().getRegion(),
store, scanner);
             } catch (IOException e) {
                 // If we can't reach the stats table, don't interrupt the normal
                 // compaction operation, just log a warning.
@@ -478,7 +476,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver{
                 }
             }
         }
-        return internalScan;
+        return internalScanner;
     }
     
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1fb89e4a/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 3511d12..0c22790 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
@@ -193,30 +193,12 @@ public class StatisticsCollector {
         }
     }
 
-    public InternalScanner createCompactionScanner(HRegion region, Store store,
-            List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs,
InternalScanner s) throws IOException {
+    public InternalScanner createCompactionScanner(HRegion region, Store store, InternalScanner
s) throws IOException {
         // See if this is for Major compaction
-        InternalScanner internalScan = s;
-        if (scanType.equals(ScanType.COMPACT_DROP_DELETES)) {
-            // this is the first CP accessed, so we need to just create a major
-            // compaction scanner, just
-            // like in the compactor
-            if (s == null) {
-                Scan scan = new Scan();
-                scan.setMaxVersions(store.getFamily().getMaxVersions());
-                long smallestReadPoint = store.getSmallestReadPoint();
-                internalScan = new StoreScanner(store, store.getScanInfo(), scan, scanners,
scanType,
-                        smallestReadPoint, earliestPutTs);
-            }
-            if (logger.isDebugEnabled()) {
-                logger.debug("Compaction scanner created for stats");
-            }
-            InternalScanner scanner = getInternalScanner(region, store, internalScan, store.getColumnFamilyName());
-            if (scanner != null) {
-                internalScan = scanner;
-            }
+        if (logger.isDebugEnabled()) {
+            logger.debug("Compaction scanner created for stats");
         }
-        return internalScan;
+        return getInternalScanner(region, store, s, store.getColumnFamilyName());
     }
 
     public void collectStatsDuringSplit(Configuration conf, HRegion l, HRegion r,


Mime
View raw message