[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5124 PropertyPolicyProvider should not evaluate default hbase config properties (addendum)

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

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


The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
 new 8935a39  PHOENIX-5124 PropertyPolicyProvider should not evaluate 
default hbase config properties (addendum)
8935a39 is described below

commit 8935a39b7477ca6dd33851b5d87cb2ef3cff9e5d
Author: Thomas D'Silva 
AuthorDate: Thu Feb 7 18:15:12 2019 -0800

PHOENIX-5124 PropertyPolicyProvider should not evaluate default hbase 
config properties (addendum)
---
 .../src/main/java/org/apache/phoenix/util/PropertiesUtil.java| 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
index b029a26..a52d979 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PropertiesUtil.java
@@ -76,6 +76,7 @@ public class PropertiesUtil {
 
 /**
  * Removes properties present that are present in standard HBase 
configuration and standard Phoenix properties
+ * These are then evaluated by the PropertyPolicyProvider.
  */
 public static Properties removeStandardHBasePhoenixConfig(Properties 
props) {
 Configuration config = HBaseConfiguration.create();
@@ -83,10 +84,12 @@ public class PropertiesUtil {
 for(Entry entry: props.entrySet()) {
 if ( entry.getKey() instanceof String) {
 String propName = (String) entry.getKey();
-if (config.get(propName) == null
-&& PhoenixEmbeddedDriver.DEFAULT_PROPS.get(propName) 
== null
+// add the property to the normalized list if its not a 
standard Phoenix property and
+// if the property is not defined in hbase-site.xml or if it 
is defined and its value is different
+if ( PhoenixEmbeddedDriver.DEFAULT_PROPS.get(propName) == null
 && !propName.equals(PhoenixRuntime.CURRENT_SCN_ATTRIB)
-&& !propName.equals(PhoenixRuntime.TENANT_ID_ATTRIB)) {
+&& !propName.equals(PhoenixRuntime.TENANT_ID_ATTRIB)
+&& (config.get(propName) == null || 
!config.get(propName).equals(entry.getValue()) )) {
 normalizedProps.put(propName, props.getProperty(propName));
 }
 }



[phoenix] branch 4.x-HBase-1.4 updated: PHOENIX-5124 PropertyPolicyProvider should not evaluate default hbase config properties

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

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


The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push:
 new d3301e4  PHOENIX-5124 PropertyPolicyProvider should not evaluate 
default hbase config properties
d3301e4 is described below

commit d3301e45435e479cf8dfeda6f4bcf2873b3106c5
Author: Thomas D'Silva 
AuthorDate: Mon Feb 4 23:17:37 2019 -0800

PHOENIX-5124 PropertyPolicyProvider should not evaluate default hbase 
config properties
---
 .../apache/phoenix/end2end/AppendOnlySchemaIT.java |  2 +-
 .../phoenix/end2end/PropertyPolicyProviderIT.java  | 26 
 .../java/org/apache/phoenix/rpc/UpdateCacheIT.java |  2 +-
 .../org/apache/phoenix/jdbc/PhoenixConnection.java |  2 +-
 .../apache/phoenix/jdbc/PhoenixEmbeddedDriver.java |  7 ++
 .../org/apache/phoenix/util/PropertiesUtil.java| 28 +-
 6 files changed, 58 insertions(+), 9 deletions(-)

diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
index b39c4f0..e1c56ea 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AppendOnlySchemaIT.java
@@ -70,7 +70,7 @@ public class AppendOnlySchemaIT extends 
ParallelStatsDisabledIT {
 Mockito.spy(driver.getConnectionQueryServices(getUrl(),
 PropertiesUtil.deepCopy(TEST_PROPERTIES)));
 Properties props = new Properties();
-props.putAll(PhoenixEmbeddedDriver.DEFFAULT_PROPS.asMap());
+props.putAll(PhoenixEmbeddedDriver.DEFAULT_PROPS.asMap());
 
 try (Connection conn1 = connectionQueryServices.connect(getUrl(), 
props);
 Connection conn2 = sameClient ? conn1 : 
connectionQueryServices.connect(getUrl(), props)) {
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
new file mode 100644
index 000..48508a9
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/PropertyPolicyProviderIT.java
@@ -0,0 +1,26 @@
+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/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
index 2959b99..a1bdad7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
@@ -192,7 +192,7 @@ public class UpdateCacheIT extends ParallelStatsDisabledIT {
// use a spyed ConnectionQueryServices so we can verify calls 
to getTable
ConnectionQueryServices connectionQueryServices = 
Mockito.spy(driver.getConnectionQueryServices(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES)));
Properties props = new Properties();
-   props.putAll(PhoenixEmbeddedDriver.DEFFAULT_PROPS.asMap());
+   props.putAll(PhoenixEmbeddedDriver.DEFAULT_PROPS.asMap());
Connection conn = connectionQueryServices.connect(getUrl(), 
props);
try {
conn.setAutoCommit(false);
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 596e27c..d74 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
@@ -245,7 +245,7 @@ public class PhoenixConnection implements Connection, 
MetaDataMutated, SQLClosea
 
 // Filter user provided properties based on property policy, if
 // provided.
-PropertyPolicyProvider.getPropertyPolicy().evaluate(info);
+