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 4622ea7 PHOENIX-5175 Separate client settings for disabling server side mutations for upserts and deletes 4622ea7 is described below commit 4622ea79c2906eb096c3a080e59e2d0c56e10458 Author: Abhishek Singh Chouhan <abhishekchouhan...@gmail.com> AuthorDate: Tue Mar 5 10:45:21 2019 -0800 PHOENIX-5175 Separate client settings for disabling server side mutations for upserts and deletes --- .../java/org/apache/phoenix/end2end/DeleteIT.java | 32 +++++++---- .../phoenix/end2end/IndexBuildTimestampIT.java | 3 +- .../phoenix/end2end/UpsertSelectAutoCommitIT.java | 15 +++-- .../org/apache/phoenix/end2end/UpsertSelectIT.java | 65 ++++++++++++++-------- .../org/apache/phoenix/compile/DeleteCompiler.java | 4 +- .../org/apache/phoenix/compile/UpsertCompiler.java | 4 +- .../org/apache/phoenix/query/QueryServices.java | 3 +- .../apache/phoenix/query/QueryServicesOptions.java | 3 +- 8 files changed, 84 insertions(+), 45 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java index 39210fa..505a5ae 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DeleteIT.java @@ -90,7 +90,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { private void testDeleteFilter(boolean autoCommit) throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = initTableValues(conn); @@ -119,7 +120,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { private void testDeleteByFilterAndRow(boolean autoCommit) throws SQLException { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = initTableValues(conn); @@ -186,7 +188,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { private void testDeleteRange(boolean autoCommit, boolean createIndex, boolean local) throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = initTableValues(conn); String indexName = generateUniqueName(); @@ -319,7 +322,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { Connection con = null; try { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); con = DriverManager.getConnection(getUrl(), props); con.setAutoCommit(autoCommit); @@ -413,7 +417,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { try { boolean autoCommit = false; Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); con = DriverManager.getConnection(getUrl(), props); con.setAutoCommit(autoCommit); @@ -490,7 +495,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { try { boolean autoCommit = false; Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); con = DriverManager.getConnection(getUrl(), props); con.setAutoCommit(autoCommit); @@ -615,7 +621,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { Connection con = null; try { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); con = DriverManager.getConnection(getUrl(), props); con.setAutoCommit(autoCommit); @@ -678,7 +685,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { private void testDeleteForTableWithRowTimestampCol(boolean autoCommit, String tableName) throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(autoCommit); Statement stm = conn.createStatement(); @@ -764,7 +772,7 @@ public class DeleteIT extends ParallelStatsDisabledIT { + "CREATE INDEX IF NOT EXISTS index_column_double_id ON " + tableName + "(double_id);" + "UPSERT INTO " + tableName + " VALUES (9000000,0.5,'Sample text extra');" ; Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(true); Statement stm = conn.createStatement(); @@ -788,7 +796,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (pk1 DECIMAL NOT NULL, v1 VARCHAR CONSTRAINT PK PRIMARY KEY (pk1))"; int numRecords = 1010; Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute(ddl); Statement stmt = conn.createStatement(); @@ -823,7 +832,8 @@ public class DeleteIT extends ParallelStatsDisabledIT { String idx1 = "CREATE INDEX " + indexName1 + " ON " + tableName + "(v1)"; String idx2 = "CREATE INDEX " + indexName2 + " ON " + tableName + "(v1, v2)"; Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute(ddl); conn.createStatement().execute(idx1); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexBuildTimestampIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexBuildTimestampIT.java index 50be0b8..2d166a5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexBuildTimestampIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexBuildTimestampIT.java @@ -179,7 +179,8 @@ public class IndexBuildTimestampIT extends BaseUniqueNamesOwnClusterIT { EnvironmentEdgeManager.injectEdge(clock3); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, "true"); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, "true"); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, "true"); Connection conn = DriverManager.getConnection(getUrl(), props); String viewName = null; 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 4078578..c4be5db 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 @@ -60,7 +60,8 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT { @Test public void testAutoCommitUpsertSelect() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); String atable = generateUniqueName(); @@ -114,7 +115,8 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT { @Test public void testDynamicUpsertSelect() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = generateUniqueName(); String cursorDDL = " CREATE TABLE IF NOT EXISTS " + tableName @@ -172,7 +174,8 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT { props.setProperty(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB, Integer.toString(512)); props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3)); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); String tableName = generateUniqueName(); @@ -201,7 +204,8 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT { Properties connectionProperties = new Properties(); connectionProperties.setProperty(QueryServices.MAX_MUTATION_SIZE_ATTRIB, "3"); connectionProperties.setProperty(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, "50000"); - connectionProperties.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + connectionProperties.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); PhoenixConnection connection = (PhoenixConnection) DriverManager.getConnection(getUrl(), connectionProperties); connection.setAutoCommit(true); @@ -227,7 +231,8 @@ public class UpsertSelectAutoCommitIT extends ParallelStatsDisabledIT { props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3)); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); String tableName = generateUniqueName(); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 493e2a5..207935b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -99,7 +99,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tenantId = getOrganizationId(); byte[][] splits = getDefaultSplits(tenantId); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); String aTable = initATableValues(tenantId, saltTable ? null : splits, null, null, getUrl(), saltTable ? "salt_buckets = 2" : null); String customEntityTable = generateUniqueName(); @@ -249,7 +250,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String ptsdbTable = generateUniqueName(); ensureTableCreated(getUrl(), ptsdbTable, PTSDB_NAME); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); String upsert = "UPSERT INTO " + ptsdbTable + "(\"DATE\", val, host) " + @@ -420,7 +422,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String ptsdbTable = generateUniqueName(); ensureTableCreated(getUrl(), ptsdbTable, PTSDB_NAME); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(autoCommit); String upsert = "UPSERT INTO " + ptsdbTable + "(\"DATE\", val, host) " + @@ -492,7 +495,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); ensureTableCreated(getUrl(), tableName, "IntKeyTest", splits, null); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String upsert = "UPSERT INTO " + tableName + " VALUES(1)"; PreparedStatement upsertStmt = conn.prepareStatement(upsert); @@ -527,7 +531,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); createTestTable(getUrl(), "create table " + tableName + " (i integer not null primary key desc, j integer)", splits, null); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String upsert = "UPSERT INTO " + tableName + " VALUES(1, 1)"; PreparedStatement upsertStmt = conn.prepareStatement(upsert); @@ -585,7 +590,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); createTestTable(getUrl(), "create table " + tableName + " (i integer not null primary key desc, j integer)", splits, null); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String upsert = "UPSERT INTO " + tableName + " VALUES(1, 1)"; PreparedStatement upsertStmt = conn.prepareStatement(upsert); @@ -623,7 +629,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); ensureTableCreated(getUrl(), tableName, "IntKeyTest", splits, null, null); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String upsert = "UPSERT INTO " + tableName + " VALUES(?)"; PreparedStatement upsertStmt = conn.prepareStatement(upsert); @@ -661,7 +668,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { @Test public void testUpsertSelectWithLimit() throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = generateUniqueName(); conn.createStatement().execute("create table " + tableName + " (id varchar(10) not null primary key, val varchar(10), ts timestamp)"); @@ -725,7 +733,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { @Test public void testUpsertSelectWithSequence() throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String t1 = generateUniqueName(); String t2 = generateUniqueName(); @@ -768,7 +777,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { public void testUpsertSelectWithSequenceAndOrderByWithSalting() throws Exception { int numOfRecords = 200; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String t1 = generateUniqueName(); String t2 = generateUniqueName(); @@ -833,7 +843,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { long rowTimestamp = EnvironmentEdgeManager.currentTimeMillis(); Date rowTimestampDate = new Date(rowTimestamp); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + t1 + " (PK1, PK2, KV1) VALUES(?, ?, ?)"); stmt.setString(1, "PK1"); @@ -901,7 +912,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { public void testUpsertSelectSameTableWithRowTimestampColumn() throws Exception { String tableName = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute("CREATE TABLE " + tableName + " (PK1 INTEGER NOT NULL, PK2 DATE NOT NULL, KV1 VARCHAR CONSTRAINT PK PRIMARY KEY(PK1, PK2 ROW_TIMESTAMP)) "); } @@ -950,7 +962,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { } long startTime = EnvironmentEdgeManager.currentTimeMillis(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { // Upsert values where row_timestamp column PK2 is not set and the column names are specified // This should upsert data with the value for PK2 as server timestamp @@ -1029,7 +1042,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName1 = generateUniqueName(); String tableName2 = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute("CREATE TABLE " + tableName1 + " (PK1 INTEGER NOT NULL, PK2 DATE NOT NULL, PK3 INTEGER NOT NULL, KV1 VARCHAR CONSTRAINT PK PRIMARY KEY(PK1, PK2 ROW_TIMESTAMP, PK3)) "); conn.createStatement().execute("CREATE TABLE " + tableName2 + " (PK1 INTEGER NOT NULL, PK2 DATE NOT NULL, PK3 INTEGER NOT NULL, KV1 VARCHAR CONSTRAINT PK PRIMARY KEY(PK1, PK2 DESC ROW_TIMESTAMP, PK3)) "); @@ -1105,7 +1119,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tenantViewIdx = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute("CREATE IMMUTABLE TABLE " + baseTable + " (TENANT_ID CHAR(15) NOT NULL, PK2 DATE NOT NULL, PK3 INTEGER NOT NULL, KV1 VARCHAR, KV2 VARCHAR, KV3 VARCHAR CONSTRAINT PK PRIMARY KEY(TENANT_ID, PK2 ROW_TIMESTAMP, PK3)) MULTI_TENANT = true, SALT_BUCKETS = 8"); conn.createStatement().execute("CREATE INDEX " + baseTableIdx + " ON " + baseTable + " (PK2, KV3) INCLUDE (KV1)"); @@ -1310,7 +1325,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); String tableName2 = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute("CREATE TABLE " + tableName + " (PK1 BIGINT NOT NULL PRIMARY KEY ROW_TIMESTAMP, KV1 VARCHAR)"); conn.createStatement().execute("CREATE TABLE " + tableName2 + " (PK1 BIGINT NOT NULL PRIMARY KEY ROW_TIMESTAMP, KV1 VARCHAR)"); @@ -1335,7 +1351,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { @Test public void testUpsertSelectWithFixedWidthNullByteSizeArray() throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); String t1 = generateUniqueName(); conn.createStatement().execute( @@ -1393,7 +1410,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { private void testUpsertSelectWithMultiByteChars(boolean autoCommit) throws Exception { Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(autoCommit); String t1 = generateUniqueName(); @@ -1438,7 +1456,7 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { props.setProperty(QueryServices.MUTATE_BATCH_SIZE_BYTES_ATTRIB, Integer.toString(512)); props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, Integer.toString(3)); props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, Integer.toString(3)); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, allowServerSideMutations); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); String t1 = generateUniqueName(); @@ -1467,7 +1485,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName = generateUniqueName(); String indexName = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName + " (k1 TIMESTAMP not null, k2 bigint not null, v bigint, constraint pk primary key (k1 row_timestamp, k2)) SALT_BUCKETS = 9"); @@ -1533,7 +1552,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { String tableName1 = generateUniqueName(); String tableName2 = generateUniqueName(); Properties props = new Properties(); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(true); conn.createStatement().execute("create table " + tableName1 + "(name varchar(160) primary key, id varchar(120), address varchar(160))"); @@ -1551,7 +1571,8 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { private Connection getTenantConnection(String tenantId) throws Exception { Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES); - props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); + props.setProperty(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + allowServerSideMutations); props.setProperty(TENANT_ID_ATTRIB, tenantId); return DriverManager.getConnection(getUrl(), props); } diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java index d414205..7e97db5 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/DeleteCompiler.java @@ -438,8 +438,8 @@ public class DeleteCompiler { final ConnectionQueryServices services = connection.getQueryServices(); List<QueryPlan> queryPlans; boolean allowServerMutations = - services.getProps().getBoolean(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, - QueryServicesOptions.DEFAULT_ENABLE_SERVER_SIDE_MUTATIONS); + services.getProps().getBoolean(QueryServices.ENABLE_SERVER_SIDE_DELETE_MUTATIONS, + QueryServicesOptions.DEFAULT_ENABLE_SERVER_SIDE_DELETE_MUTATIONS); NamedTableNode tableNode = delete.getTable(); String tableName = tableNode.getName().getTableName(); String schemaName = tableNode.getName().getSchemaName(); diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java index e2a6f5d..5509582 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java @@ -354,8 +354,8 @@ public class UpsertCompiler { services.getProps().getBoolean(QueryServices.ENABLE_SERVER_UPSERT_SELECT, QueryServicesOptions.DEFAULT_ENABLE_SERVER_UPSERT_SELECT); boolean allowServerMutations = - services.getProps().getBoolean(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, - QueryServicesOptions.DEFAULT_ENABLE_SERVER_SIDE_MUTATIONS); + services.getProps().getBoolean(QueryServices.ENABLE_SERVER_SIDE_UPSERT_MUTATIONS, + QueryServicesOptions.DEFAULT_ENABLE_SERVER_SIDE_UPSERT_MUTATIONS); UpsertingParallelIteratorFactory parallelIteratorFactoryToBe = null; boolean useServerTimestampToBe = false; 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 9168367..7468222 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 @@ -312,7 +312,8 @@ public interface QueryServices extends SQLCloseable { 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"; + public static final String ENABLE_SERVER_SIDE_DELETE_MUTATIONS ="phoenix.client.enable.server.delete.mutations"; + public static final String ENABLE_SERVER_SIDE_UPSERT_MUTATIONS ="phoenix.client.enable.server.upsert.mutations"; //Update Cache Frequency default config attribute public static final String DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB = "phoenix.default.update.cache.frequency"; 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 5a8a1b6..0e873a7 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 @@ -369,7 +369,8 @@ public class QueryServicesOptions { public static final boolean DEFAULT_ENABLE_SERVER_UPSERT_SELECT = false; // By default generally allow server trigger mutations - public static final boolean DEFAULT_ENABLE_SERVER_SIDE_MUTATIONS = true; + public static final boolean DEFAULT_ENABLE_SERVER_SIDE_DELETE_MUTATIONS = true; + public static final boolean DEFAULT_ENABLE_SERVER_SIDE_UPSERT_MUTATIONS = true; public static final boolean DEFAULT_COST_BASED_OPTIMIZER_ENABLED = false; public static final boolean DEFAULT_WILDCARD_QUERY_DYNAMIC_COLS_ATTRIB = false;