Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ABE2BF7EB for ; Wed, 5 Nov 2014 08:29:55 +0000 (UTC) Received: (qmail 81202 invoked by uid 500); 5 Nov 2014 08:29:55 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 81162 invoked by uid 500); 5 Nov 2014 08:29:55 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 81153 invoked by uid 99); 5 Nov 2014 08:29:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Nov 2014 08:29:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 42223986C94; Wed, 5 Nov 2014 08:29:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jamestaylor@apache.org To: commits@phoenix.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: PHOENIX-1406 Use preCompact hook instead of preCompactScannerOpen for stats collection Date: Wed, 5 Nov 2014 08:29:55 +0000 (UTC) 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 Authored: Wed Nov 5 00:27:36 2014 -0800 Committer: James Taylor 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 c, - Store store, List scanners, ScanType scanType, - long earliestPutTs, InternalScanner s) throws IOException { - InternalScanner internalScan = s; + public InternalScanner preCompact(ObserverContext 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 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,