[09/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6

2016-02-25 Thread maryannxue
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client 
and server when upgraded from 4.6


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

Branch: refs/heads/calcite
Commit: 29ca38b85a5f2455a007404aaa72c104f20a5afe
Parents: a6de19b
Author: James Taylor 
Authored: Wed Feb 24 17:44:08 2016 -0800
Committer: James Taylor 
Committed: Wed Feb 24 17:44:08 2016 -0800

--
 .../java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/29ca38b8/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 37ebc78..3327861 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2384,7 +2384,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 metaConnection = 
updateSystemCatalogTimestamp(metaConnection, 
 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0);
 
ConnectionQueryServicesImpl.this.removeTable(null, 
PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME, null, 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0);
-logger.warn("Update of SYSTEM.CATALOG 
complete");
+logger.info("Update of SYSTEM.CATALOG 
complete");

clearCache();
 }
 



[10/12] phoenix git commit: Revert changes for PHOENIX-2714

2016-02-25 Thread maryannxue
Revert changes for PHOENIX-2714


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

Branch: refs/heads/calcite
Commit: 87e8f29bb2f93b875c73dce499cf5b95044072c4
Parents: 9ac854a
Author: maryannxue 
Authored: Thu Feb 25 15:23:03 2016 -0500
Committer: maryannxue 
Committed: Thu Feb 25 15:23:03 2016 -0500

--
 .../java/org/apache/phoenix/execute/ScanPlan.java|  5 -
 .../apache/phoenix/iterate/BaseResultIterators.java  | 10 ++
 .../org/apache/phoenix/iterate/ResultIterators.java  |  1 -
 .../apache/phoenix/iterate/UnionResultIterators.java |  5 -
 .../phoenix/iterate/AggregateResultScannerTest.java  |  5 -
 .../phoenix/iterate/ConcatResultIteratorTest.java| 10 --
 .../phoenix/iterate/MergeSortResultIteratorTest.java | 15 ---
 7 files changed, 2 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
index f622e8e..673a641 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
@@ -34,7 +34,6 @@ import org.apache.phoenix.coprocessor.ScanRegionObserver;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.iterate.ChunkedResultIterator;
 import org.apache.phoenix.iterate.ConcatResultIterator;
-import org.apache.phoenix.iterate.DefaultParallelScanGrouper;
 import org.apache.phoenix.iterate.LimitingResultIterator;
 import org.apache.phoenix.iterate.MergeSortRowKeyResultIterator;
 import org.apache.phoenix.iterate.MergeSortTopNResultIterator;
@@ -258,8 +257,4 @@ public class ScanPlan extends BaseQueryPlan {
 }
 }
 
-public long getEstimatedBytes() throws SQLException {
-return new ParallelIterators(this, null, parallelIteratorFactory, 
DefaultParallelScanGrouper.getInstance()).getEstimatedSize();
-}
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
index c3da407..fc3edbe 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java
@@ -560,10 +560,8 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 while (guideIndex < gpsSize && 
(currentGuidePost.compareTo(endKey) <= 0 || endKey.length == 0)) {
 Scan newScan = scanRanges.intersectScan(scan, 
currentKeyBytes, currentGuidePostBytes, keyOffset,
 false);
-if (newScan != null) {
-estimatedRows += gps.getRowCounts().get(guideIndex);
-estimatedSize += gps.getByteCounts().get(guideIndex);
-}
+estimatedRows += gps.getRowCounts().get(guideIndex);
+estimatedSize += gps.getByteCounts().get(guideIndex);
 scans = addNewScan(parallelScans, scans, newScan, 
currentGuidePostBytes, false, regionLocation);
 currentKeyBytes = currentGuidePost.copyBytes();
 currentGuidePost = PrefixByteCodec.decode(decoder, input);
@@ -874,8 +872,4 @@ public abstract class BaseResultIterators extends 
ExplainTable implements Result
 return "ResultIterators [name=" + getName() + ",id=" + scanId + 
",scans=" + scans + "]";
 }
 
-@Override
-public long getEstimatedSize() {
-return estimatedSize;
-}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/87e8f29b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java
index e76db56..16f8b41 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ResultIterators.java
+++ b/phoenix-core/src/main/java/org/apac

[05/12] phoenix git commit: PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts

2016-02-25 Thread maryannxue
PHOENIX-2707 Differentiate between a table+family have zero guideposts from not 
having collected guideposts


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

Branch: refs/heads/calcite
Commit: e3a62026cbfaf1eb7c50a35a8871e0f059d7d668
Parents: c25f887
Author: James Taylor 
Authored: Tue Feb 23 16:52:05 2016 -0800
Committer: James Taylor 
Committed: Tue Feb 23 16:52:05 2016 -0800

--
 .../java/org/apache/phoenix/execute/AggregatePlan.java   |  6 --
 .../java/org/apache/phoenix/execute/BaseQueryPlan.java   | 11 +++
 .../main/java/org/apache/phoenix/execute/ScanPlan.java   |  7 +--
 3 files changed, 20 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index 73a995c..a8a7dc5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -35,6 +35,7 @@ import org.apache.phoenix.expression.OrderByExpression;
 import org.apache.phoenix.expression.RowKeyExpression;
 import org.apache.phoenix.expression.aggregator.Aggregators;
 import org.apache.phoenix.iterate.AggregatingResultIterator;
+import org.apache.phoenix.iterate.BaseResultIterators;
 import org.apache.phoenix.iterate.ConcatResultIterator;
 import org.apache.phoenix.iterate.DistinctAggregatingResultIterator;
 import org.apache.phoenix.iterate.FilterAggregatingResultIterator;
@@ -48,7 +49,6 @@ import org.apache.phoenix.iterate.ParallelIterators;
 import org.apache.phoenix.iterate.ParallelScanGrouper;
 import org.apache.phoenix.iterate.PeekingResultIterator;
 import org.apache.phoenix.iterate.ResultIterator;
-import org.apache.phoenix.iterate.ResultIterators;
 import org.apache.phoenix.iterate.SequenceResultIterator;
 import org.apache.phoenix.iterate.SerialIterators;
 import org.apache.phoenix.iterate.SpoolingResultIterator;
@@ -197,12 +197,14 @@ public class AggregatePlan extends BaseQueryPlan {
 
context.getScan().setAttribute(BaseScannerRegionObserver.GROUP_BY_LIMIT, 
PInteger.INSTANCE.toBytes(limit));
 }
 }
-ResultIterators iterators = 
statement.getHint().hasHint(HintNode.Hint.SERIAL) ?
+BaseResultIterators iterators = 
statement.getHint().hasHint(HintNode.Hint.SERIAL) ?
 new SerialIterators(this, null, wrapParallelIteratorFactory(), 
scanGrouper) :
 new ParallelIterators(this, null, 
wrapParallelIteratorFactory());
 
 splits = iterators.getSplits();
 scans = iterators.getScans();
+estimatedSize = iterators.getEstimatedByteCount();
+estimatedRows = iterators.getEstimatedRowCount();
 
 AggregatingResultIterator aggResultIterator;
 // No need to merge sort for ungrouped aggregation

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 2aef7f7..0ee70ba 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -108,6 +108,9 @@ public abstract class BaseQueryPlan implements QueryPlan {
  * immediately before creating the ResultIterator.
  */
 protected final Expression dynamicFilter;
+protected Long estimatedRows;
+protected Long estimatedSize;
+
 
 protected BaseQueryPlan(
 StatementContext context, FilterableStatement statement, TableRef 
table,
@@ -127,6 +130,14 @@ public abstract class BaseQueryPlan implements QueryPlan {
 this.dynamicFilter = dynamicFilter;
 }
 
+public Long getEstimatedRowCount() {
+return this.estimatedRows;
+}
+
+public Long getEstimatedByteCount() {
+return this.estimatedSize;
+}
+
 
@Override
public Operation getOperation() {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/e3a62026/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
--
diff --git 
a/phoenix-core/src/main/j

[04/12] phoenix git commit: PHOENIX-2707 Differentiate between a table+family have zero guideposts from not having collected guideposts

2016-02-25 Thread maryannxue
PHOENIX-2707 Differentiate between a table+family have zero guideposts from not 
having collected guideposts


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

Branch: refs/heads/calcite
Commit: c25f88791c86cd65ea21810406eec199403d78aa
Parents: dbc9ee9
Author: James Taylor 
Authored: Tue Feb 23 14:53:11 2016 -0800
Committer: James Taylor 
Committed: Tue Feb 23 14:53:11 2016 -0800

--
 .../org/apache/phoenix/end2end/IndexToolIT.java |   3 +-
 .../phoenix/end2end/MutableIndexToolIT.java |   1 +
 .../end2end/StatsCollectionDisabledIT.java  |  21 ++-
 .../phoenix/end2end/StatsCollectorIT.java   |  57 +++-
 .../phoenix/iterate/BaseResultIterators.java| 140 +++
 .../apache/phoenix/query/QueryConstants.java|   2 +-
 .../org/apache/phoenix/query/QueryServices.java |   1 +
 .../phoenix/query/QueryServicesOptions.java |   7 +
 .../stats/DefaultStatisticsCollector.java   |  33 ++---
 .../phoenix/schema/stats/GuidePostsInfo.java|   2 +-
 .../schema/stats/GuidePostsInfoBuilder.java |   6 -
 .../phoenix/schema/stats/PTableStatsImpl.java   |   5 +-
 .../phoenix/schema/stats/StatisticsUtil.java|  23 +--
 .../phoenix/schema/stats/StatisticsWriter.java  |  60 
 .../apache/phoenix/util/PrefixByteCodec.java|  37 ++---
 .../phoenix/query/QueryServicesTestImpl.java|   2 +
 16 files changed, 246 insertions(+), 154 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
index aba9c11..fe95470 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java
@@ -108,7 +108,8 @@ public class IndexToolIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 final String fullTableName = SchemaUtil.getTableName(schemaName, 
dataTable);
 final String indxTable = String.format("%s_%s", dataTable, "INDX");
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-props.setProperty(QueryServices.TRANSACTIONS_ENABLED, "true");
+props.setProperty(QueryServices.TRANSACTIONS_ENABLED, 
Boolean.TRUE.toString());
+props.setProperty(QueryServices.EXPLAIN_ROW_COUNT_ATTRIB, 
Boolean.FALSE.toString());
 Connection conn = DriverManager.getConnection(getUrl(), props);
 Statement stmt = conn.createStatement();
 try {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java
index 0791479..8125007 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MutableIndexToolIT.java
@@ -61,6 +61,7 @@ public class MutableIndexToolIT extends 
BaseOwnClusterHBaseManagedTimeIT {
 final String dataTable = "DATA_TABLE5";
 final String indxTable = String.format("%s_%s",dataTable,"INDX");
 Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+props.setProperty(QueryServices.EXPLAIN_ROW_COUNT_ATTRIB, 
Boolean.FALSE.toString());
 Connection conn = DriverManager.getConnection(getUrl(), props);
 Statement stmt = conn.createStatement();
 try {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c25f8879/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java
index a92a665..54ffa7c 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectionDisabledIT.java
@@ -17,24 +17,26 @@
  */
 package org.apache.phoenix.end2end;
 
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
 import java.sql.Connection;
 import java.sql.DriverManag

[12/12] phoenix git commit: Temporary fix for PHOENIX-2714

2016-02-25 Thread maryannxue
Temporary fix for PHOENIX-2714


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

Branch: refs/heads/calcite
Commit: 36ee23ab7760616394f32f88b2da6b038cfee1e9
Parents: 06fd581
Author: maryannxue 
Authored: Thu Feb 25 15:38:55 2016 -0500
Committer: maryannxue 
Committed: Thu Feb 25 15:38:55 2016 -0500

--
 .../phoenix/calcite/rel/PhoenixTableScan.java   |   4 +-
 .../apache/phoenix/execute/AggregatePlan.java   |   2 -
 .../apache/phoenix/execute/BaseQueryPlan.java   |  11 --
 .../org/apache/phoenix/execute/ScanPlan.java|   2 -
 .../phoenix/iterate/BaseResultIterators.java| 154 ---
 5 files changed, 137 insertions(+), 36 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
index 80c328f..dfdb507 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
@@ -36,6 +36,7 @@ import org.apache.phoenix.execute.ScanPlan;
 import org.apache.phoenix.execute.TupleProjector;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.expression.LiteralExpression;
+import org.apache.phoenix.iterate.BaseResultIterators;
 import org.apache.phoenix.iterate.ParallelIteratorFactory;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.parse.SelectStatement;
@@ -131,8 +132,7 @@ public class PhoenixTableScan extends TableScan implements 
PhoenixRel {
 filterExpr = WhereOptimizer.pushKeyExpressionsToScan(context, 
select, filterExpr);
 WhereCompiler.setScanFilter(context, select, filterExpr, true, 
false);
 scanRanges = context.getScanRanges();
-ScanPlan plan = new ScanPlan(context, select, tableRef, 
RowProjector.EMPTY_PROJECTOR, null, OrderBy.EMPTY_ORDER_BY, null, true, null);
-estimatedSize = plan.getEstimatedBytes();
+estimatedSize = BaseResultIterators.getEstimatedCount(context, 
tableRef.getTable()).getSecond();
 } catch (SQLException e) {
 throw new RuntimeException(e);
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
index f9eca0c..794247b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
@@ -208,8 +208,6 @@ public class AggregatePlan extends BaseQueryPlan {
 
 splits = iterators.getSplits();
 scans = iterators.getScans();
-estimatedSize = iterators.getEstimatedByteCount();
-estimatedRows = iterators.getEstimatedRowCount();
 
 AggregatingResultIterator aggResultIterator;
 // No need to merge sort for ungrouped aggregation

http://git-wip-us.apache.org/repos/asf/phoenix/blob/36ee23ab/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index 0ee70ba..f389fd0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -108,8 +108,6 @@ public abstract class BaseQueryPlan implements QueryPlan {
  * immediately before creating the ResultIterator.
  */
 protected final Expression dynamicFilter;
-protected Long estimatedRows;
-protected Long estimatedSize;
 
 
 protected BaseQueryPlan(
@@ -129,16 +127,7 @@ public abstract class BaseQueryPlan implements QueryPlan {
 this.parallelIteratorFactory = parallelIteratorFactory;
 this.dynamicFilter = dynamicFilter;
 }
-
-public Long getEstimatedRowCount() {
-return this.estimatedRows;
-}
 
-public Long getEstimatedByteCount() {
-return this.estimatedSize;
-}
- 

[02/12] phoenix git commit: LP-2705 Downgrade warn logging in region observer

2016-02-25 Thread maryannxue
LP-2705 Downgrade warn logging in region observer


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

Branch: refs/heads/calcite
Commit: da51f46b2394108f47368e40b5c3abd97dc33714
Parents: a1e6ae4
Author: Gabriel Reid 
Authored: Tue Feb 23 08:42:34 2016 +0100
Committer: Gabriel Reid 
Committed: Tue Feb 23 08:43:02 2016 +0100

--
 .../phoenix/coprocessor/UngroupedAggregateRegionObserver.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/da51f46b/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 7c98be0..91ec20e 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
@@ -152,7 +152,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
   }
   Mutation[] mutationArray = new Mutation[mutations.size()];
   // TODO: should we use the one that is all or none?
-  logger.warn("Committing bactch of " + mutations.size() + " mutations for 
" + region.getRegionInfo().getTable().getNameAsString());
+  logger.debug("Committing bactch of " + mutations.size() + " mutations 
for " + region.getRegionInfo().getTable().getNameAsString());
   region.batchMutate(mutations.toArray(mutationArray), 
HConstants.NO_NONCE, HConstants.NO_NONCE);
 }
 
@@ -209,7 +209,7 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
 byte[] descRowKeyTableBytes = scan.getAttribute(UPGRADE_DESC_ROW_KEY);
 boolean isDescRowKeyOrderUpgrade = descRowKeyTableBytes != null;
 if (isDescRowKeyOrderUpgrade) {
-logger.warn("Upgrading row key for " + 
region.getRegionInfo().getTable().getNameAsString());
+logger.debug("Upgrading row key for " + 
region.getRegionInfo().getTable().getNameAsString());
 projectedTable = deserializeTable(descRowKeyTableBytes);
 try {
 writeToTable = PTableImpl.makePTable(projectedTable, true);



[11/12] phoenix git commit: Merge remote-tracking branch 'origin/master' into calcite

2016-02-25 Thread maryannxue
Merge remote-tracking branch 'origin/master' into calcite


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

Branch: refs/heads/calcite
Commit: 06fd581296bc58390ebf7f8e738af19a6634a66e
Parents: 87e8f29 29ca38b
Author: maryannxue 
Authored: Thu Feb 25 15:23:38 2016 -0500
Committer: maryannxue 
Committed: Thu Feb 25 15:23:38 2016 -0500

--
 phoenix-assembly/src/build/server.xml   |   1 +
 .../org/apache/phoenix/end2end/IndexToolIT.java |   3 +-
 .../phoenix/end2end/MutableIndexToolIT.java |   1 +
 .../end2end/StatsCollectionDisabledIT.java  |  21 ++-
 .../phoenix/end2end/StatsCollectorIT.java   |  57 +++-
 .../phoenix/coprocessor/MetaDataProtocol.java   |   2 +-
 .../UngroupedAggregateRegionObserver.java   |   4 +-
 .../apache/phoenix/execute/AggregatePlan.java   |   6 +-
 .../apache/phoenix/execute/BaseQueryPlan.java   |  11 ++
 .../org/apache/phoenix/execute/ScanPlan.java|   7 +-
 .../phoenix/iterate/BaseResultIterators.java| 140 +++
 .../query/ConnectionQueryServicesImpl.java  |  86 ++--
 .../apache/phoenix/query/QueryConstants.java|   2 +-
 .../org/apache/phoenix/query/QueryServices.java |   1 +
 .../phoenix/query/QueryServicesOptions.java |   7 +
 .../stats/DefaultStatisticsCollector.java   |  33 ++---
 .../phoenix/schema/stats/GuidePostsInfo.java|   2 +-
 .../schema/stats/GuidePostsInfoBuilder.java |   6 -
 .../phoenix/schema/stats/PTableStatsImpl.java   |   5 +-
 .../stats/StatisticsCollectorFactory.java   |  17 ++-
 .../phoenix/schema/stats/StatisticsUtil.java|  23 +--
 .../phoenix/schema/stats/StatisticsWriter.java  |  60 
 .../apache/phoenix/util/PrefixByteCodec.java|  37 ++---
 .../phoenix/query/QueryServicesTestImpl.java|   2 +
 24 files changed, 360 insertions(+), 174 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/execute/AggregatePlan.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsUtil.java
--

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fd5812/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
--



[06/12] phoenix git commit: PHOENIX-2711 Need Thrift included in phoenix-server jar for M/R index (Thomas D'Silva)

2016-02-25 Thread maryannxue
PHOENIX-2711 Need Thrift included in phoenix-server jar for M/R index (Thomas 
D'Silva)


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

Branch: refs/heads/calcite
Commit: 05e6e2a3d67ed5c7c1cace0b2903c35b83ee5ec5
Parents: e3a6202
Author: James Taylor 
Authored: Tue Feb 23 17:13:10 2016 -0800
Committer: James Taylor 
Committed: Tue Feb 23 17:16:58 2016 -0800

--
 phoenix-assembly/src/build/server.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/05e6e2a3/phoenix-assembly/src/build/server.xml
--
diff --git a/phoenix-assembly/src/build/server.xml 
b/phoenix-assembly/src/build/server.xml
index ef79486..e8f9bfb 100644
--- a/phoenix-assembly/src/build/server.xml
+++ b/phoenix-assembly/src/build/server.xml
@@ -46,6 +46,7 @@
com.google.inject.extensions:guice-assistedinject
it.unimi.dsi:fastutil
io.dropwizard.metrics:metrics-core
+   org.apache.thrift:libthrift
   
 
   



[07/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6

2016-02-25 Thread maryannxue
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client 
and server when upgraded from 4.6


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

Branch: refs/heads/calcite
Commit: 1f7b47a5e75fe5f6014b4dcdeb4637d05fd12a43
Parents: 05e6e2a
Author: James Taylor 
Authored: Wed Feb 24 11:48:16 2016 -0800
Committer: James Taylor 
Committed: Wed Feb 24 12:01:21 2016 -0800

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  2 +-
 .../query/ConnectionQueryServicesImpl.java  | 35 
 2 files changed, 30 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/1f7b47a5/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
index a704e22..fb9d228 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java
@@ -73,7 +73,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0 = 
MIN_TABLE_TIMESTAMP + 7;
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_5_0 = 
MIN_TABLE_TIMESTAMP + 8;
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0 = 
MIN_TABLE_TIMESTAMP + 9;
-public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = 
MIN_TABLE_TIMESTAMP + 13;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = 
MIN_TABLE_TIMESTAMP + 14;
 // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the 
MIN_SYSTEM_TABLE_TIMESTAMP_* constants
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0;
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need

http://git-wip-us.apache.org/repos/asf/phoenix/blob/1f7b47a5/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index d55ab30..d27a4bc 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2370,17 +2370,20 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 // Add these columns one at a time, each 
with different timestamps so that if folks have
 // run the upgrade code already for a 
snapshot, we'll still enter this block (and do the
 // parts we haven't yet done).
-metaConnection = 
addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2,
+metaConnection = 
addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4,
 
PhoenixDatabaseMetaData.TRANSACTIONAL + " " + 
PBoolean.INSTANCE.getSqlTypeName());
 // Drop old stats table so that new stats 
table is created
 metaConnection = 
dropStatsTable(metaConnection,
-
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1);
+
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3);
 metaConnection = 
addColumnsIfNotExists(metaConnection,
 
PhoenixDatabaseMetaData.SYSTEM_CATALOG,
-
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0,
+
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2,
 
PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " "
 + 
PLong.INSTANCE.getSqlTypeName());
-
setImmutableTableIndexesImmutable(metaConnection);
+   

[03/12] phoenix git commit: Revert "PHOENIX-2706 Implement client-side mechanism to know if stats are enabled"

2016-02-25 Thread maryannxue
Revert "PHOENIX-2706 Implement client-side mechanism to know if stats are 
enabled"

This reverts commit a1e6ae44be757b3fc5c4192ad55ecd8f3c03c01a.


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

Branch: refs/heads/calcite
Commit: dbc9ee9dfe9e168c45ad279f8478c59f0882240c
Parents: da51f46
Author: James Taylor 
Authored: Tue Feb 23 09:36:53 2016 -0800
Committer: James Taylor 
Committed: Tue Feb 23 09:36:53 2016 -0800

--
 .../StatisticsCollectionRunTrackerIT.java   | 10 ++--
 .../org/apache/phoenix/end2end/IndexToolIT.java |  3 +-
 .../phoenix/end2end/MutableIndexToolIT.java |  1 -
 .../end2end/StatsCollectionDisabledIT.java  | 19 ++-
 .../phoenix/end2end/StatsCollectorIT.java   |  3 --
 .../coprocessor/MetaDataEndpointImpl.java   | 12 -
 .../UngroupedAggregateRegionObserver.java   | 27 +-
 .../phoenix/iterate/BaseResultIterators.java| 25 +
 .../phoenix/query/ConnectionQueryServices.java  |  7 +--
 .../query/ConnectionQueryServicesImpl.java  | 25 ++---
 .../query/ConnectionlessQueryServicesImpl.java  | 18 +--
 .../query/DelegateConnectionQueryServices.java  | 10 
 .../org/apache/phoenix/query/QueryServices.java |  1 -
 .../phoenix/query/QueryServicesOptions.java |  7 ---
 .../apache/phoenix/schema/MetaDataClient.java   |  2 -
 .../schema/stats/NoOpStatisticsCollector.java   |  3 ++
 .../stats/StatisticsCollectionRunTracker.java   |  7 +--
 .../phoenix/schema/stats/StatisticsUtil.java| 16 --
 .../org/apache/phoenix/util/MetaDataUtil.java   | 55 +++-
 .../phoenix/query/QueryServicesTestImpl.java|  2 -
 .../apache/phoenix/util/MetaDataUtilTest.java   | 33 
 21 files changed, 71 insertions(+), 215 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/dbc9ee9d/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
index 345400e..bf567f0 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
@@ -17,7 +17,8 @@
  */
 package org.apache.phoenix.coprocessor;
 
-import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.UPDATE_STATS_SKIPPED;
+import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.COMPACTION_UPDATE_STATS_ROW_COUNT;
+import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.CONCURRENT_UPDATE_STATS_ROW_COUNT;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -37,6 +38,7 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -103,8 +105,7 @@ public class StatisticsCollectionRunTrackerIT extends 
BaseOwnClusterHBaseManaged
 HRegionInfo regionInfo = createTableAndGetRegion(tableName);
 // simulate stats collection via major compaction by marking the 
region as compacting in the tracker
 markRegionAsCompacting(regionInfo);
-long returnValue = runUpdateStats(tableName);
-assertTrue("Update stats should have been skipped", returnValue >= 
UPDATE_STATS_SKIPPED);
+Assert.assertEquals("Row count didn't match", 
COMPACTION_UPDATE_STATS_ROW_COUNT, runUpdateStats(tableName));
 StatisticsCollectionRunTracker tracker =
 StatisticsCollectionRunTracker.getInstance(new 
Configuration());
 // assert that the tracker state was cleared.
@@ -116,7 +117,8 @@ public class StatisticsCollectionRunTrackerIT extends 
BaseOwnClusterHBaseManaged
 String tableName = 
"testUpdateStatsPreventsAnotherUpdateStatsFromRunning".toUpperCase();
 HRegionInfo regionInfo = createTableAndGetRegion(tableName);
 markRunningUpdateStats(regionInfo);
-assertTrue("Update stats should have been skipped", 
runUpdateStats(tableName) >= UPDATE_STATS_SKIPPED);
+Assert.assertEquals("Row count didn't match", 
CONCURRENT_UPDATE_STATS_ROW_COUNT,
+runUpdateStats(tableName));
 
 // assert that running the concurrent and race-losing u

[08/12] phoenix git commit: PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client and server when upgraded from 4.6

2016-02-25 Thread maryannxue
PHOENIX-2713 Backward compatibility fails with CNF exception with 4.7 client 
and server when upgraded from 4.6


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

Branch: refs/heads/calcite
Commit: a6de19bd2290d8242b002ff661ec7028577e3055
Parents: 1f7b47a
Author: James Taylor 
Authored: Wed Feb 24 17:25:51 2016 -0800
Committer: James Taylor 
Committed: Wed Feb 24 17:28:26 2016 -0800

--
 .../query/ConnectionQueryServicesImpl.java  | 65 
 .../stats/StatisticsCollectorFactory.java   | 17 -
 2 files changed, 68 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a6de19bd/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index d27a4bc..37ebc78 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -2367,24 +2367,24 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0, columnsToAdd);
 }
 if(currentServerSideTableTimeStamp < 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0) {
+// Drop old stats table so that new stats 
table is created
+metaConnection = 
dropStatsTable(metaConnection, 
+
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4);
 // Add these columns one at a time, each 
with different timestamps so that if folks have
 // run the upgrade code already for a 
snapshot, we'll still enter this block (and do the
 // parts we haven't yet done).
-metaConnection = 
addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 4,
+metaConnection = 
addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, 
+
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3,
 
PhoenixDatabaseMetaData.TRANSACTIONAL + " " + 
PBoolean.INSTANCE.getSqlTypeName());
-// Drop old stats table so that new stats 
table is created
-metaConnection = 
dropStatsTable(metaConnection,
-
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 3);
-metaConnection = 
addColumnsIfNotExists(metaConnection,
-
PhoenixDatabaseMetaData.SYSTEM_CATALOG,
+metaConnection = 
addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG, 
 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 2,
-
PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " "
-+ 
PLong.INSTANCE.getSqlTypeName());
-metaConnection = 
setImmutableTableIndexesImmutable(metaConnection, 
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1);
-Properties props = 
PropertiesUtil.deepCopy(metaConnection.getClientInfo());
-
props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0));
-metaConnection = new 
PhoenixConnection(metaConnection, ConnectionQueryServicesImpl.this, props);
-// that already have cached data.
+
PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY + " " + 
PLong.INSTANCE.getSqlTypeName());
+metaConnection = 
setImmutableTableIndexesImmutable(metaConnection, 
+
MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 - 1);
+   

[01/12] phoenix git commit: PHOENIX-2706 Implement client-side mechanism to know if stats are enabled

2016-02-25 Thread maryannxue
Repository: phoenix
Updated Branches:
  refs/heads/calcite 9ac854ae5 -> 36ee23ab7


PHOENIX-2706 Implement client-side mechanism to know if stats are enabled


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

Branch: refs/heads/calcite
Commit: a1e6ae44be757b3fc5c4192ad55ecd8f3c03c01a
Parents: e4acd0c
Author: James Taylor 
Authored: Mon Feb 22 18:49:04 2016 -0800
Committer: James Taylor 
Committed: Mon Feb 22 18:49:04 2016 -0800

--
 .../StatisticsCollectionRunTrackerIT.java   | 10 ++--
 .../org/apache/phoenix/end2end/IndexToolIT.java |  3 +-
 .../phoenix/end2end/MutableIndexToolIT.java |  1 +
 .../end2end/StatsCollectionDisabledIT.java  | 19 +--
 .../phoenix/end2end/StatsCollectorIT.java   |  3 ++
 .../coprocessor/MetaDataEndpointImpl.java   | 12 +
 .../UngroupedAggregateRegionObserver.java   | 27 +-
 .../phoenix/iterate/BaseResultIterators.java| 25 -
 .../phoenix/query/ConnectionQueryServices.java  |  7 ++-
 .../query/ConnectionQueryServicesImpl.java  | 25 +++--
 .../query/ConnectionlessQueryServicesImpl.java  | 18 ++-
 .../query/DelegateConnectionQueryServices.java  | 10 
 .../org/apache/phoenix/query/QueryServices.java |  1 +
 .../phoenix/query/QueryServicesOptions.java |  7 +++
 .../apache/phoenix/schema/MetaDataClient.java   |  2 +
 .../schema/stats/NoOpStatisticsCollector.java   |  3 --
 .../stats/StatisticsCollectionRunTracker.java   |  7 ++-
 .../phoenix/schema/stats/StatisticsUtil.java| 16 ++
 .../org/apache/phoenix/util/MetaDataUtil.java   | 55 +---
 .../phoenix/query/QueryServicesTestImpl.java|  2 +
 .../apache/phoenix/util/MetaDataUtilTest.java   | 33 
 21 files changed, 215 insertions(+), 71 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a1e6ae44/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
index bf567f0..345400e 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/coprocessor/StatisticsCollectionRunTrackerIT.java
@@ -17,8 +17,7 @@
  */
 package org.apache.phoenix.coprocessor;
 
-import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.COMPACTION_UPDATE_STATS_ROW_COUNT;
-import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.CONCURRENT_UPDATE_STATS_ROW_COUNT;
+import static 
org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker.UPDATE_STATS_SKIPPED;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -38,7 +37,6 @@ import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.stats.StatisticsCollectionRunTracker;
 import org.apache.phoenix.util.ReadOnlyProps;
-import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -105,7 +103,8 @@ public class StatisticsCollectionRunTrackerIT extends 
BaseOwnClusterHBaseManaged
 HRegionInfo regionInfo = createTableAndGetRegion(tableName);
 // simulate stats collection via major compaction by marking the 
region as compacting in the tracker
 markRegionAsCompacting(regionInfo);
-Assert.assertEquals("Row count didn't match", 
COMPACTION_UPDATE_STATS_ROW_COUNT, runUpdateStats(tableName));
+long returnValue = runUpdateStats(tableName);
+assertTrue("Update stats should have been skipped", returnValue >= 
UPDATE_STATS_SKIPPED);
 StatisticsCollectionRunTracker tracker =
 StatisticsCollectionRunTracker.getInstance(new 
Configuration());
 // assert that the tracker state was cleared.
@@ -117,8 +116,7 @@ public class StatisticsCollectionRunTrackerIT extends 
BaseOwnClusterHBaseManaged
 String tableName = 
"testUpdateStatsPreventsAnotherUpdateStatsFromRunning".toUpperCase();
 HRegionInfo regionInfo = createTableAndGetRegion(tableName);
 markRunningUpdateStats(regionInfo);
-Assert.assertEquals("Row count didn't match", 
CONCURRENT_UPDATE_STATS_ROW_COUNT,
-runUpdateStats(tableName));
+assertTrue("Update stats should have been skipped", 
runUpdateStats(tableName) >= UPDATE_STATS_SKIPPED);
 
 // assert that running the concurrent and ra