You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/08/15 23:35:58 UTC

git commit: PHOENIX-1174 Rename and move properties using existing convention

Repository: phoenix
Updated Branches:
  refs/heads/4.0 2a3a253c2 -> 5aa381516


PHOENIX-1174 Rename and move properties using existing convention


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

Branch: refs/heads/4.0
Commit: 5aa38151681b0c9f7f15c7e520f1d1eea4821565
Parents: 2a3a253
Author: James Taylor <ja...@apache.org>
Authored: Fri Aug 15 14:32:14 2014 -0700
Committer: James Taylor <ja...@apache.org>
Committed: Fri Aug 15 14:32:14 2014 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/index/IndexHandlerIT.java   |  4 ++--
 .../ipc/PhoenixIndexRpcSchedulerFactory.java    | 23 +++++---------------
 .../org/apache/phoenix/query/QueryServices.java |  9 ++++++++
 .../phoenix/query/QueryServicesOptions.java     | 11 ++++++++--
 .../org/apache/phoenix/trace/util/Tracing.java  | 18 ++++++---------
 .../PhoenixIndexRpcSchedulerFactoryTest.java    |  5 +++--
 6 files changed, 35 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
index 8536652..1507d6b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexHandlerIT.java
@@ -38,7 +38,7 @@ import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.hbase.index.IndexQosRpcControllerFactory;
 import org.apache.phoenix.hbase.index.TableName;
-import org.apache.phoenix.hbase.index.ipc.PhoenixIndexRpcSchedulerFactory;
+import org.apache.phoenix.query.QueryServicesOptions;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -159,7 +159,7 @@ public class IndexHandlerIT {
         // check the counts on the rpc controller
         assertEquals("Didn't get the expected number of index priority writes!", 1,
             (int) CountingIndexClientRpcController.priorityCounts
-                    .get(PhoenixIndexRpcSchedulerFactory.DEFAULT_INDEX_MIN_PRIORITY));
+                    .get(QueryServicesOptions.DEFAULT_INDEX_MIN_PRIORITY));
 
         table.close();
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/ipc/PhoenixIndexRpcSchedulerFactory.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/ipc/PhoenixIndexRpcSchedulerFactory.java b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/ipc/PhoenixIndexRpcSchedulerFactory.java
index 500db7c..8e0b86f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/ipc/PhoenixIndexRpcSchedulerFactory.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/ipc/PhoenixIndexRpcSchedulerFactory.java
@@ -26,6 +26,8 @@ import org.apache.hadoop.hbase.ipc.RpcScheduler;
 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
 import org.apache.hadoop.hbase.regionserver.RpcSchedulerFactory;
 import org.apache.hadoop.hbase.regionserver.SimpleRpcSchedulerFactory;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
 
 import com.google.common.base.Preconditions;
 
@@ -37,21 +39,6 @@ public class PhoenixIndexRpcSchedulerFactory implements RpcSchedulerFactory {
 
     private static final Log LOG = LogFactory.getLog(PhoenixIndexRpcSchedulerFactory.class);
 
-    private static final String INDEX_HANDLER_COUNT_KEY =
-            "org.apache.phoenix.regionserver.index.handler.count";
-    private static final int DEFAULT_INDEX_HANDLER_COUNT = 30;
-
-    /**
-     * HConstants#HIGH_QOS is the max we will see to a standard table. We go higher to differentiate
-     * and give some room for things in the middle
-     */
-    public static final int DEFAULT_INDEX_MIN_PRIORITY = 1000;
-    public static final int DEFAULT_INDEX_MAX_PRIORITY = 1050;
-    public static final String MIN_INDEX_PRIOIRTY_KEY =
-            "org.apache.phoenix.regionserver.index.priority.min";
-    public static final String MAX_INDEX_PRIOIRTY_KEY =
-            "org.apache.phoenix.regionserver.index.priority.max";
-
     private static final String VERSION_TOO_OLD_FOR_INDEX_RPC =
             "Running an older version of HBase (less than 0.98.4), Phoenix index RPC handling cannot be enabled.";
 
@@ -75,9 +62,9 @@ public class PhoenixIndexRpcSchedulerFactory implements RpcSchedulerFactory {
             return delegate;
         }
 
-        int indexHandlerCount = conf.getInt(INDEX_HANDLER_COUNT_KEY, DEFAULT_INDEX_HANDLER_COUNT);
+        int indexHandlerCount = conf.getInt(QueryServices.INDEX_HANDLER_COUNT_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_HANDLER_COUNT);
         int minPriority = getMinPriority(conf);
-        int maxPriority = conf.getInt(MAX_INDEX_PRIOIRTY_KEY, DEFAULT_INDEX_MAX_PRIORITY);
+        int maxPriority = conf.getInt(QueryServices.MAX_INDEX_PRIOIRTY_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_MAX_PRIORITY);
         // make sure the ranges are outside the warning ranges
         Preconditions.checkArgument(maxPriority > minPriority, "Max index priority (" + maxPriority
                 + ") must be larger than min priority (" + minPriority + ")");
@@ -99,6 +86,6 @@ public class PhoenixIndexRpcSchedulerFactory implements RpcSchedulerFactory {
     }
 
     public static int getMinPriority(Configuration conf) {
-        return conf.getInt(MIN_INDEX_PRIOIRTY_KEY, DEFAULT_INDEX_MIN_PRIORITY);
+        return conf.getInt(QueryServices.MIN_INDEX_PRIOIRTY_ATTRIB, QueryServicesOptions.DEFAULT_INDEX_MIN_PRIORITY);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index 3e0e461..b445adf 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -123,6 +123,15 @@ public interface QueryServices extends SQLCloseable {
     // Index will be partially re-built from index disable time stamp - following overlap time 
     public static final String INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME_ATTRIB = 
         "phoenix.index.failure.handling.rebuild.overlap.time";
+    // Constants for for configuring tracing
+    public static final String TRACING_FREQ_ATTRIB = "phoenix.trace.frequency";
+    public static final String PROBABILITY_THRESHOLD_ATTRIB = "phoenix.trace.probability.threshold";
+    public static final String MIN_INDEX_PRIOIRTY_ATTRIB =
+    "phoenix.regionserver.index.priority.min";
+    public static final String MAX_INDEX_PRIOIRTY_ATTRIB =
+    "phoenix.regionserver.index.priority.max";
+    public static final String INDEX_HANDLER_COUNT_ATTRIB =
+    "phoenix.regionserver.index.handler.count";
     
     /**
      * Get executor service used for parallel scans

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index e0be74d..6bffdb2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -60,7 +60,6 @@ import java.util.Map.Entry;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
-
 import org.apache.phoenix.util.DateUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
 
@@ -128,8 +127,16 @@ public class QueryServicesOptions {
     public static final long DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_INTERVAL = 10000; // 10 secs
     public static final long DEFAULT_INDEX_FAILURE_HANDLING_REBUILD_OVERLAP_TIME = 300000; // 5 mins
     
-    private final Configuration config;
+    public static final int DEFAULT_INDEX_MAX_PRIORITY = 1050;
+    /**
+     * HConstants#HIGH_QOS is the max we will see to a standard table. We go higher to differentiate
+     * and give some room for things in the middle
+     */
+    public static final int DEFAULT_INDEX_MIN_PRIORITY = 1000;
+    public static final int DEFAULT_INDEX_HANDLER_COUNT = 30;
     
+    private final Configuration config;
+
     private QueryServicesOptions(Configuration config) {
         this.config = config;
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java b/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
index 3367bce..b2b8180 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/trace/util/Tracing.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.call.CallRunner;
 import org.apache.phoenix.call.CallWrapper;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.QueryServices;
 import org.cloudera.htrace.Sampler;
 import org.cloudera.htrace.Span;
 import org.cloudera.htrace.Trace;
@@ -55,16 +56,11 @@ public class Tracing {
     private static final String START_SPAN_MESSAGE = "Span received on server. Starting child";
 
     // Constants for passing into the metrics system
-    public static final String TRACE_METRIC_PREFIX = "phoenix.trace.instance";
-    // Constants for for configuring tracing
-    public static final String TRACING_LEVEL_KEY = "org.apache.phoenix.trace.frequency";
-    protected static final String PROBABILITY_THRESHOLD_KEY =
-            "org.apache.phoenix.trace.probability.threshold";
-
+    private static final String TRACE_METRIC_PREFIX = "phoenix.trace.instance";
     /**
      * We always trace on the server, assuming the client has requested tracing on the request
      */
-    public static Sampler<?> SERVER_TRACE_LEVEL = Sampler.ALWAYS;
+    private static Sampler<?> SERVER_TRACE_LEVEL = Sampler.ALWAYS;
 
     /**
      * Manage the types of frequencies that we support. By default, we never turn on tracing.
@@ -116,19 +112,19 @@ public class Tracing {
                 @Override
                 public Sampler<?> apply(ConfigurationAdapter conn) {
                     // get the connection properties for the probability information
-                    double threshold = Double.parseDouble(conn.get(PROBABILITY_THRESHOLD_KEY));
+                    double threshold = Double.parseDouble(conn.get(QueryServices.PROBABILITY_THRESHOLD_ATTRIB));
                     return new ProbabilitySampler(threshold);
                 }
             };
 
     public static Sampler<?> getConfiguredSampler(PhoenixConnection connection) {
-        String tracelevel = connection.getClientInfo(TRACING_LEVEL_KEY);
+        String tracelevel = connection.getClientInfo(QueryServices.TRACING_FREQ_ATTRIB);
         return getSampler(tracelevel, new ConfigurationAdapter.ConnectionConfigurationAdapter(
                 connection));
     }
 
     public static Sampler<?> getConfiguredSampler(Configuration conf) {
-        String tracelevel = conf.get(TRACING_LEVEL_KEY);
+        String tracelevel = conf.get(QueryServices.TRACING_FREQ_ATTRIB);
         return getSampler(tracelevel, new ConfigurationAdapter.HadoopConfigConfigurationAdapter(
                 conf));
     }
@@ -138,7 +134,7 @@ public class Tracing {
     }
 
     public static void setSampling(Properties props, Frequency freq) {
-        props.setProperty(TRACING_LEVEL_KEY, freq.key);
+        props.setProperty(QueryServices.TRACING_FREQ_ATTRIB, freq.key);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aa38151/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
index 2df246a..4918bba 100644
--- a/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
+++ b/phoenix-core/src/test/java/org/apache/hadoop/hbase/regionserver/PhoenixIndexRpcSchedulerFactoryTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.fail;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.phoenix.hbase.index.ipc.PhoenixIndexRpcSchedulerFactory;
+import org.apache.phoenix.query.QueryServices;
 import org.junit.Test;
 
 public class PhoenixIndexRpcSchedulerFactoryTest {
@@ -99,7 +100,7 @@ public class PhoenixIndexRpcSchedulerFactoryTest {
     }
 
     private void setMinMax(Configuration conf, int min, int max) {
-        conf.setInt(PhoenixIndexRpcSchedulerFactory.MIN_INDEX_PRIOIRTY_KEY, min);
-        conf.setInt(PhoenixIndexRpcSchedulerFactory.MAX_INDEX_PRIOIRTY_KEY, max);
+        conf.setInt(QueryServices.MIN_INDEX_PRIOIRTY_ATTRIB, min);
+        conf.setInt(QueryServices.MAX_INDEX_PRIOIRTY_ATTRIB, max);
     }
 }
\ No newline at end of file