phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject git commit: PHOENIX-1174 Rename and move properties using existing convention
Date Sun, 17 Aug 2014 07:34:49 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 355369ad5 -> 0ebe0769c


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/0ebe0769
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0ebe0769
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0ebe0769

Branch: refs/heads/master
Commit: 0ebe0769c9ab8aa6daa2eb225fc65ea1f9cfe39f
Parents: 355369a
Author: James Taylor <jtaylor@salesforce.com>
Authored: Sun Aug 17 00:35:53 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Sun Aug 17 00:36:55 2014 -0700

----------------------------------------------------------------------
 .../phoenix/trace/PhoenixTableMetricsWriterIT.java   |  5 +++--
 .../phoenix/trace/PhoenixTracingEndToEndIT.java      |  3 ++-
 .../java/org/apache/phoenix/query/QueryServices.java | 15 ++++++++-------
 .../apache/phoenix/query/QueryServicesOptions.java   |  6 ++++++
 .../phoenix/trace/PhoenixTableMetricsWriter.java     | 10 ++++++----
 .../java/org/apache/phoenix/trace/TraceReader.java   | 13 ++++++-------
 .../java/org/apache/phoenix/trace/util/Tracing.java  |  2 +-
 .../java/org/apache/phoenix/trace/TracingCompat.java |  8 --------
 8 files changed, 32 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
index b1544e8..ecac21b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
@@ -24,6 +24,7 @@ import java.sql.Connection;
 import java.util.Collection;
 
 import org.apache.phoenix.metrics.PhoenixMetricsRecord;
+import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.trace.Hadoop1TracingTestEnabler.Hadoop1Disabled;
 import org.apache.phoenix.trace.TraceReader.SpanInfo;
 import org.apache.phoenix.trace.TraceReader.TraceHolder;
@@ -50,9 +51,9 @@ public class PhoenixTableMetricsWriterIT extends BaseTracingTestIT {
 
         // check for existence of the tracing table
         try {
-            String ddl = "CREATE TABLE " + TracingCompat.DEFAULT_STATS_TABLE_NAME;
+            String ddl = "CREATE TABLE " + QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME;
             conn.createStatement().execute(ddl);
-            fail("Table " + TracingCompat.DEFAULT_STATS_TABLE_NAME
+            fail("Table " + QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME
                     + " was not created by the metrics sink");
         } catch (Exception e) {
             // expected

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
index 0fe4538..6742f9e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
@@ -34,6 +34,7 @@ import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.end2end.HBaseManagedTimeTest;
 import org.apache.phoenix.metrics.Metrics;
 import org.apache.phoenix.metrics.TracingTestCompat;
+import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.trace.Hadoop1TracingTestEnabler.Hadoop1Disabled;
 import org.apache.phoenix.trace.TraceReader.SpanInfo;
 import org.apache.phoenix.trace.TraceReader.TraceHolder;
@@ -223,7 +224,7 @@ public class PhoenixTracingEndToEndIT extends BaseTracingTestIT {
             public boolean foundTrace(TraceHolder trace, SpanInfo span) {
                 String traceInfo = trace.toString();
                 // skip logging traces that are just traces about tracing
-                if (traceInfo.contains(TracingCompat.DEFAULT_STATS_TABLE_NAME)) {
+                if (traceInfo.contains(QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME))
{
                     return false;
                 }
                 if (traceInfo.contains("Completing index")) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/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 b445adf..39ba76a 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,15 +123,16 @@ 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";
+    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";
+
     // 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";
+    public static final String TRACING_PAGE_SIZE_ATTRIB = "phoenix.trace.read.pagesize";
+    public static final String TRACING_PROBABILITY_THRESHOLD_ATTRIB = "phoenix.trace.probability.threshold";
+    public static final String TRACING_STATS_TABLE_NAME_ATTRIB = "phoenix.trace.statsTableName";
+
     
     /**
      * Get executor service used for parallel scans

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/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 6bffdb2..20c3359 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
@@ -135,6 +135,12 @@ public class QueryServicesOptions {
     public static final int DEFAULT_INDEX_MIN_PRIORITY = 1000;
     public static final int DEFAULT_INDEX_HANDLER_COUNT = 30;
     
+    public static final int DEFAULT_TRACING_PAGE_SIZE = 100;
+    /**
+     * Configuration key to overwrite the tablename that should be used as the target table
+     */
+    public static final String DEFAULT_TRACING_STATS_TABLE_NAME = "SYSTEM.TRACING_STATS";
+
     private final Configuration config;
 
     private QueryServicesOptions(Configuration config) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/phoenix-core/src/main/java/org/apache/phoenix/trace/PhoenixTableMetricsWriter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/trace/PhoenixTableMetricsWriter.java
b/phoenix-core/src/main/java/org/apache/phoenix/trace/PhoenixTableMetricsWriter.java
index f29e448..f39db75 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/trace/PhoenixTableMetricsWriter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/trace/PhoenixTableMetricsWriter.java
@@ -42,6 +42,8 @@ import org.apache.phoenix.metrics.MetricsWriter;
 import org.apache.phoenix.metrics.PhoenixAbstractMetric;
 import org.apache.phoenix.metrics.PhoenixMetricTag;
 import org.apache.phoenix.metrics.PhoenixMetricsRecord;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.util.QueryUtil;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -84,8 +86,8 @@ public class PhoenixTableMetricsWriter implements MetricsWriter {
             conn.setAutoCommit(true);
 
             String tableName =
-                    conf.get(TracingCompat.TARGET_TABLE_CONF_KEY,
-                        TracingCompat.DEFAULT_STATS_TABLE_NAME);
+                    conf.get(QueryServices.TRACING_STATS_TABLE_NAME_ATTRIB,
+                            QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME);
 
             initializeInternal(conn, tableName);
         } catch (Exception e) {
@@ -104,13 +106,13 @@ public class PhoenixTableMetricsWriter implements MetricsWriter {
      * Used for <b>TESTING ONLY</b>
      * <p>
      * Initialize the connection and setup the table to use the
-     * {@link TracingCompat#DEFAULT_STATS_TABLE_NAME}
+     * {@link TracingCompat#DEFAULT_TRACING_STATS_TABLE_NAME}
      * @param conn to store for upserts and to create the table (if necessary)
      * @throws SQLException if any phoenix operation fails
      */
     @VisibleForTesting
     public void initForTesting(Connection conn) throws SQLException {
-        initializeInternal(conn, TracingCompat.DEFAULT_STATS_TABLE_NAME);
+        initializeInternal(conn, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/phoenix-core/src/main/java/org/apache/phoenix/trace/TraceReader.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/trace/TraceReader.java b/phoenix-core/src/main/java/org/apache/phoenix/trace/TraceReader.java
index 4760329..a397e39 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/trace/TraceReader.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/trace/TraceReader.java
@@ -30,7 +30,8 @@ import java.util.TreeSet;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.phoenix.metrics.MetricInfo;
-import org.apache.phoenix.trace.PhoenixTableMetricsWriter;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
 import org.cloudera.htrace.Span;
 
 import com.google.common.base.Joiner;
@@ -42,8 +43,6 @@ import com.google.common.primitives.Longs;
 public class TraceReader {
 
     private static final Log LOG = LogFactory.getLog(TraceReader.class);
-    private static final int DEFAULT_PAGE_SIZE = 100;
-    private static final String PAGE_SIZE_CONF_KEY = "phoenix.trace.read.pagesize";
     private final Joiner comma = Joiner.on(',');
     private String knownColumns;
     {
@@ -64,12 +63,12 @@ public class TraceReader {
     public TraceReader(Connection conn, String statsTableName) throws SQLException {
         this.conn = conn;
         this.table = statsTableName;
-        String ps = conn.getClientInfo(PAGE_SIZE_CONF_KEY);
-        this.pageSize = ps == null ? DEFAULT_PAGE_SIZE : Integer.parseInt(ps);
+        String ps = conn.getClientInfo(QueryServices.TRACING_PAGE_SIZE_ATTRIB);
+        this.pageSize = ps == null ? QueryServicesOptions.DEFAULT_TRACING_PAGE_SIZE : Integer.parseInt(ps);
     }
 
     public TraceReader(Connection conn) throws SQLException {
-        this(conn, TracingCompat.DEFAULT_STATS_TABLE_NAME);
+        this(conn, QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME);
     }
 
     /**
@@ -86,7 +85,7 @@ public class TraceReader {
         // trace
         // goes together), and then by start time (so parent spans always appear before child
spans)
         String query =
-                "SELECT " + knownColumns + " FROM " + TracingCompat.DEFAULT_STATS_TABLE_NAME
+                "SELECT " + knownColumns + " FROM " + QueryServicesOptions.DEFAULT_TRACING_STATS_TABLE_NAME
                         + " ORDER BY " + MetricInfo.TRACE.columnName + " DESC, "
                         + MetricInfo.START.columnName + " ASC" + " LIMIT " + pageSize;
         int resultCount = 0;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/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 b2b8180..5e4ac9e 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
@@ -112,7 +112,7 @@ public class Tracing {
                 @Override
                 public Sampler<?> apply(ConfigurationAdapter conn) {
                     // get the connection properties for the probability information
-                    double threshold = Double.parseDouble(conn.get(QueryServices.PROBABILITY_THRESHOLD_ATTRIB));
+                    double threshold = Double.parseDouble(conn.get(QueryServices.TRACING_PROBABILITY_THRESHOLD_ATTRIB));
                     return new ProbabilitySampler(threshold);
                 }
             };

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0ebe0769/phoenix-hadoop-compat/src/main/java/org/apache/phoenix/trace/TracingCompat.java
----------------------------------------------------------------------
diff --git a/phoenix-hadoop-compat/src/main/java/org/apache/phoenix/trace/TracingCompat.java
b/phoenix-hadoop-compat/src/main/java/org/apache/phoenix/trace/TracingCompat.java
index 6ec12de..ad4a58d 100644
--- a/phoenix-hadoop-compat/src/main/java/org/apache/phoenix/trace/TracingCompat.java
+++ b/phoenix-hadoop-compat/src/main/java/org/apache/phoenix/trace/TracingCompat.java
@@ -40,14 +40,6 @@ public class TracingCompat {
         return CompatibilityFactory.getInstance(PhoenixSpanReceiver.class);
     }
 
-    public static final String DEFAULT_STATS_TABLE_NAME = "PHOENIX.TRACING_STATS";
-
-    /**
-     * Configuration key to overwrite the tablename that should be used as the target table
-     */
-    public static final String TARGET_TABLE_CONF_KEY =
-            "org.apache.phoenix._internal.trace.tablename";
-
     public static final String METRIC_SOURCE_KEY = "phoenix.";
 
     /** Set context to enable filtering */


Mime
View raw message