Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 f64170a30 -> d653973a2


PHOENIX-4683 Cap timeouts for stats precompact hook logic


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

Branch: refs/heads/5.x-HBase-2.0
Commit: d653973a29648258c6a1cd44fda1452914fd019f
Parents: f64170a
Author: Vincent Poon <vincentp...@apache.org>
Authored: Mon Apr 9 13:39:27 2018 -0700
Committer: Vincent Poon <vincentp...@apache.org>
Committed: Mon Apr 9 13:40:05 2018 -0700

----------------------------------------------------------------------
 .../coprocessor/UngroupedAggregateRegionObserver.java        | 8 ++++++--
 .../phoenix/schema/stats/DefaultStatisticsCollector.java     | 2 +-
 .../org/apache/phoenix/schema/stats/StatisticsWriter.java    | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d653973a/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 1ef591f..4697b99 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
@@ -100,6 +100,7 @@ import 
org.apache.phoenix.hbase.index.covered.update.ColumnReference;
 import org.apache.phoenix.hbase.index.util.GenericKeyValueBuilder;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.hbase.index.util.KeyValueBuilder;
+import org.apache.phoenix.hbase.index.write.IndexWriterUtils;
 import org.apache.phoenix.index.IndexMaintainer;
 import org.apache.phoenix.index.PhoenixIndexCodec;
 import org.apache.phoenix.jdbc.PhoenixConnection;
@@ -940,10 +941,13 @@ public class UngroupedAggregateRegionObserver extends 
BaseScannerRegionObserver
                     InternalScanner internalScanner = scanner;
                     try {
                         long clientTimeStamp = 
EnvironmentEdgeManager.currentTimeMillis();
+                        DelegateRegionCoprocessorEnvironment compactionConfEnv 
= new DelegateRegionCoprocessorEnvironment(compactionConfig, 
c.getEnvironment());
                         StatisticsCollector stats = 
StatisticsCollectorFactory.createStatisticsCollector(
-                            c.getEnvironment(), table.getNameAsString(), 
clientTimeStamp,
+                            compactionConfEnv, table.getNameAsString(), 
clientTimeStamp,
                             store.getColumnFamilyDescriptor().getName());
-                        internalScanner = 
stats.createCompactionScanner(c.getEnvironment(), store, scanner);
+                        internalScanner =
+                                
stats.createCompactionScanner(compactionConfEnv,
+                                    store, scanner);
                     } catch (Exception e) {
                         // If we can't reach the stats table, don't interrupt 
the normal
                         // compaction operation, just log a warning.

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d653973a/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 853c24d..3e96b8b 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
@@ -141,7 +141,7 @@ class DefaultStatisticsCollector implements 
StatisticsCollector {
             Table htable = null;
             try {
                 // Next check for GUIDE_POST_WIDTH on table
-                htable = env.getConnection().getTable(
+                htable = env.createConnection(env.getConfiguration()).getTable(
                     
SchemaUtil.getPhysicalTableName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES,
 env.getConfiguration()));
                 Get get = new Get(ptableKey);
                 get.addColumn(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES, 
PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH_BYTES);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d653973a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
index f4d5e63..67e957e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/StatisticsWriter.java
@@ -82,7 +82,7 @@ public class StatisticsWriter implements Closeable {
         if (clientTimeStamp == HConstants.LATEST_TIMESTAMP) {
             clientTimeStamp = EnvironmentEdgeManager.currentTimeMillis();
         }
-        Table statsWriterTable = env.getConnection().getTable(
+        Table statsWriterTable = 
env.createConnection(env.getConfiguration()).getTable(
                 
SchemaUtil.getPhysicalTableName(PhoenixDatabaseMetaData.SYSTEM_STATS_NAME_BYTES,
 env.getConfiguration()));
         Table statsReaderTable = ServerUtil.getHTableForCoprocessorScan(env, 
statsWriterTable);
         StatisticsWriter statsTable = new StatisticsWriter(statsReaderTable, 
statsWriterTable, tableName,

Reply via email to