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/05/02 05:41:07 UTC
git commit: PHOENIX-956 Connection properties ignored (SamarthJain)
Repository: incubator-phoenix
Updated Branches:
refs/heads/3.0 48f564de0 -> 466ad3969
PHOENIX-956 Connection properties ignored (SamarthJain)
Project: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/commit/466ad396
Tree: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/tree/466ad396
Diff: http://git-wip-us.apache.org/repos/asf/incubator-phoenix/diff/466ad396
Branch: refs/heads/3.0
Commit: 466ad39690ac7d2253dc8989a83df72e77dac85c
Parents: 48f564d
Author: James Taylor <jt...@salesforce.com>
Authored: Thu May 1 20:40:43 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Thu May 1 20:40:43 2014 -0700
----------------------------------------------------------------------
.../apache/phoenix/jdbc/PhoenixConnection.java | 3 ++-
.../apache/phoenix/jdbc/PhoenixDriverTest.java | 22 ++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/466ad396/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
----------------------------------------------------------------------
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 97493a1..2368211 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
@@ -71,6 +71,7 @@ import org.apache.phoenix.util.DateUtil;
import org.apache.phoenix.util.JDBCUtil;
import org.apache.phoenix.util.NumberUtil;
import org.apache.phoenix.util.PhoenixRuntime;
+import org.apache.phoenix.util.PropertiesUtil;
import org.apache.phoenix.util.ReadOnlyProps;
import org.apache.phoenix.util.SQLCloseable;
import org.apache.phoenix.util.SQLCloseables;
@@ -134,7 +135,7 @@ public class PhoenixConnection implements Connection, org.apache.phoenix.jdbc.Jd
public PhoenixConnection(ConnectionQueryServices services, String url, Properties info, PMetaData metaData) throws SQLException {
this.url = url;
// Copy so client cannot change
- this.info = info == null ? new Properties() : new Properties(info);
+ this.info = info == null ? new Properties() : PropertiesUtil.deepCopy(info);
final PName tenantId = JDBCUtil.getTenantId(url, info);
if (this.info.isEmpty() && tenantId == null) {
this.services = services;
http://git-wip-us.apache.org/repos/asf/incubator-phoenix/blob/466ad396/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
index 55b944d..bcb4f51 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixDriverTest.java
@@ -18,14 +18,17 @@
package org.apache.phoenix.jdbc;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
+import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Properties;
import org.apache.phoenix.query.BaseConnectionlessQueryTest;
+import org.apache.phoenix.query.QueryServices;
import org.apache.phoenix.util.PhoenixRuntime;
import org.junit.Test;
@@ -37,6 +40,25 @@ public class PhoenixDriverTest extends BaseConnectionlessQueryTest {
final String url = getUrl();
verifyConnectionValid(url);
}
+
+ @Test
+ public void testMaxMutationSizeSetCorrectly() throws Exception {
+ Properties connectionProperties = new Properties();
+ connectionProperties.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB,"100");
+ connectionProperties.setProperty(QueryServices.IMMUTABLE_ROWS_ATTRIB,"100");
+ Connection connection = DriverManager.getConnection(getUrl(), connectionProperties);
+
+ PreparedStatement stmt = connection.prepareStatement("upsert into " + ATABLE + " (organization_id, entity_id, a_integer) values (?,?,?)");
+ try {
+ for (int i = 0; i < 200; i++) {
+ stmt.setString(1, "AAAA" + i);
+ stmt.setString(2, "BBBB" + i);
+ stmt.setInt(3, 1);
+ stmt.execute();
+ }
+ fail("Upsert should have failed since the number of upserts (200) is greater than the MAX_MUTATION_SIZE_ATTRIB (100)");
+ } catch (IllegalArgumentException expected) {}
+ }
private void verifyConnectionValid(String url) throws SQLException {
Driver driver = DriverManager.getDriver(url);