[phoenix] branch 4.x-HBase-1.3 updated: PHOENIX-5124 Add config to enable PropertyPolicyProvider (addendum)

2019-02-14 Thread tdsilva
This is an automated email from the ASF dual-hosted git repository.

tdsilva pushed a commit to branch 4.x-HBase-1.3
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.3 by this push:
 new 08c46f6  PHOENIX-5124 Add config to enable PropertyPolicyProvider 
(addendum)
08c46f6 is described below

commit 08c46f679cf329c5ba21a961c6e293d6cafeecbf
Author: Thomas D'Silva 
AuthorDate: Thu Feb 14 18:45:12 2019 -0800

PHOENIX-5124 Add config to enable PropertyPolicyProvider (addendum)
---
 .../org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java | 6 ++
 .../src/main/scala/org/apache/phoenix/spark/PhoenixRDD.scala| 1 +
 2 files changed, 7 insertions(+)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
index b0ea17b..b81394b 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
@@ -47,6 +47,7 @@ import 
org.apache.phoenix.mapreduce.ImportPreUpsertKeyValueProcessor;
 import org.apache.phoenix.mapreduce.PhoenixInputFormat;
 import org.apache.phoenix.mapreduce.index.IndexScrutinyTool.OutputFormat;
 import org.apache.phoenix.mapreduce.index.IndexScrutinyTool.SourceTable;
+import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.schema.PName;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
@@ -212,6 +213,11 @@ public final class PhoenixConfigurationUtil {
 Preconditions.checkNotNull(inputQuery);
 configuration.set(SELECT_STATEMENT, inputQuery);
 }
+
+public static void setPropertyPolicyProviderDisabled(final Configuration 
configuration) {
+Preconditions.checkNotNull(configuration);
+configuration.set(QueryServices.PROPERTY_POLICY_PROVIDER_ENABLED, 
"false");
+}
 
 public static void setSchemaType(Configuration configuration, final 
SchemaType schemaType) {
 Preconditions.checkNotNull(configuration);
diff --git 
a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRDD.scala 
b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRDD.scala
index 7331a5f..cca2e6d 100644
--- a/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRDD.scala
+++ b/phoenix-spark/src/main/scala/org/apache/phoenix/spark/PhoenixRDD.scala
@@ -82,6 +82,7 @@ class PhoenixRDD(sc: SparkContext, table: String, columns: 
Seq[String],
 
 PhoenixConfigurationUtil.setInputClass(config, 
classOf[PhoenixRecordWritable])
 PhoenixConfigurationUtil.setInputTableName(config, table)
+PhoenixConfigurationUtil.setPropertyPolicyProviderDisabled(config);
 
 if(!columns.isEmpty) {
   PhoenixConfigurationUtil.setSelectColumnNames(config, columns.toArray)



[phoenix] branch 4.x-HBase-1.3 updated: PHOENIX-5124 Add config to enable PropertyPolicyProvider

2019-02-14 Thread tdsilva
This is an automated email from the ASF dual-hosted git repository.

tdsilva pushed a commit to branch 4.x-HBase-1.3
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.3 by this push:
 new bdb2b66  PHOENIX-5124 Add config to enable PropertyPolicyProvider
bdb2b66 is described below

commit bdb2b66d73683d2f116e130d53fa8978ccda5ccc
Author: Thomas D'Silva 
AuthorDate: Thu Feb 14 16:14:18 2019 -0800

PHOENIX-5124 Add config to enable PropertyPolicyProvider
---
 .../phoenix/end2end/PropertyPolicyProviderIT.java  | 26 --
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |  7 --
 .../org/apache/phoenix/query/QueryServices.java|  2 ++
 .../apache/phoenix/query/QueryServicesOptions.java |  2 ++
 .../org/apache/phoenix/util/PropertiesUtil.java| 26 --
 .../phoenix/query/PropertyPolicyProviderTest.java  | 10 +
 6 files changed, 19 insertions(+), 54 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertyPolicyProviderIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertyPolicyProviderIT.java
deleted file mode 100644
index 48508a9..000
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertyPolicyProviderIT.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.phoenix.end2end;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.phoenix.mapreduce.util.ConnectionUtil;
-import org.junit.Test;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-public class PropertyPolicyProviderIT  extends ParallelStatsDisabledIT {
-
-@Test
-public void testUsingDefaultHBaseConfigs() throws SQLException {
-Configuration config = HBaseConfiguration.create();
-config.set(HConstants.ZOOKEEPER_QUORUM, getUrl());
-Properties properties=new Properties();
-properties.put("allowedProperty","value");
-try(
-Connection conn = ConnectionUtil.getInputConnection(config, 
properties)
-){}
-}
-
-}
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index d74..d668758 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -244,8 +244,11 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 this.isDescVarLengthRowKeyUpgrade = isDescVarLengthRowKeyUpgrade;
 
 // Filter user provided properties based on property policy, if
-// provided.
-
PropertyPolicyProvider.getPropertyPolicy().evaluate(PropertiesUtil.removeStandardHBasePhoenixConfig(info));
+// provided and QueryServices.PROPERTY_POLICY_PROVIDER_ENABLED is true
+if 
(Boolean.valueOf(info.getProperty(QueryServices.PROPERTY_POLICY_PROVIDER_ENABLED,
+
String.valueOf(QueryServicesOptions.DEFAULT_PROPERTY_POLICY_PROVIDER_ENABLED
 {
+PropertyPolicyProvider.getPropertyPolicy().evaluate(info);
+}
 
 // Copy so client cannot change
 this.info = info == null ? new Properties() : PropertiesUtil
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 98e2ed3..9168367 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
@@ -309,6 +309,8 @@ public interface QueryServices extends SQLCloseable {
 // whether to enable server side RS -> RS calls for upsert select 
statements
 public static final String ENABLE_SERVER_UPSERT_SELECT 
="phoenix.client.enable.server.upsert.select";
 
+public static final String PROPERTY_POLICY_PROVIDER_ENABLED = 
"phoenix.property.policy.provider.enabled";
+
 // whether to trigger mutations on the server at all (UPSERT/DELETE or 
DELETE FROM)
 public static final String ENABLE_SERVER_SIDE_MUTATIONS 
="phoenix.client.enable.server.mutations";
 
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 816d76f..5a8a1b6 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
@@ -349,6 +349,8 @@ public class QueryServicesOptions {
 
 public static final boolean 
DEFAULT_ALLOW_SPLITTABLE_SYSTEM_CATALOG_ROLLBACK = false;
 
+public static final boolean DEFAULT_PROPERTY_POLICY_PROVIDER_ENABLED = 
true;
+