You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by la...@apache.org on 2018/03/29 21:33:38 UTC
phoenix git commit: PHOENIX-4671 Fix minor size accounting bug for
MutationSize.
Repository: phoenix
Updated Branches:
refs/heads/master 815026ad4 -> ec9267721
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/ec926772
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ec926772
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ec926772
Branch: refs/heads/master
Commit: ec92677218607ce575ec6c189f8a2f2a37369f99
Parents: 815026a
Author: Lars Hofhansl <la...@apache.org>
Authored: Thu Mar 29 14:33:34 2018 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Thu Mar 29 14:33:34 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/ec926772/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/ec926772/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() {