phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject phoenix git commit: PHOENIX-4671 Fix minor size accounting bug for MutationSize.
Date Thu, 29 Mar 2018 21:42:16 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 d911dd337 -> 037b7cbe3


PHOENIX-4671 Fix minor size accounting bug for MutationSize.


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 037b7cbe3b9ee87f7863a8028c69127744403893
Parents: d911dd3
Author: Lars Hofhansl <larsh@apache.org>
Authored: Thu Mar 29 14:42:12 2018 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Thu Mar 29 14:42:12 2018 -0700

----------------------------------------------------------------------
 .../end2end/UpsertSelectAutoCommitIT.java       | 28 ++++++++++++++++++++
 .../apache/phoenix/execute/MutationState.java   |  1 +
 2 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/037b7cbe/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java
index 6b781a0..38d48d6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectAutoCommitIT.java
@@ -23,15 +23,19 @@ import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.sql.Connection;
 import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
 
+import org.apache.phoenix.exception.SQLExceptionCode;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
@@ -173,4 +177,28 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT
{
         conn.close();
     }
 
+    @Test
+    public void testMaxMutationSize() throws Exception {
+        Properties connectionProperties = new Properties();
+        connectionProperties.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB, "3");
+        connectionProperties.setProperty(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, "50000");
+        PhoenixConnection connection =
+                (PhoenixConnection) DriverManager.getConnection(getUrl(), connectionProperties);
+        connection.setAutoCommit(true);
+        String fullTableName = generateUniqueName();
+        try (Statement stmt = connection.createStatement()) {
+            stmt.execute(
+                    "CREATE TABLE " + fullTableName + " (pk INTEGER PRIMARY KEY, v1 INTEGER,
v2 INTEGER)");
+            stmt.execute(
+                    "CREATE SEQUENCE " + fullTableName + "_seq cache 1000");
+            stmt.execute("UPSERT INTO " + fullTableName + " VALUES (NEXT VALUE FOR " + fullTableName
+ "_seq, rand(), rand())");
+        }
+        try (Statement stmt = connection.createStatement()) {
+            for (int i=0; i<16; i++) {
+                stmt.execute("UPSERT INTO " + fullTableName + " SELECT NEXT VALUE FOR " +
fullTableName + "_seq, rand(), rand() FROM " + fullTableName);
+            }
+        }
+        connection.close();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/037b7cbe/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
index dfbb89b..839194a 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java
@@ -1563,6 +1563,7 @@ public class MutationState implements SQLCloseable {
         
         public void clear(){
             rowKeyToRowMutationState.clear();
+            estimatedSize = 0;
         }
         
         public Collection<RowMutationState> values() {


Mime
View raw message