From 81f7f246efdbd87e3b66904d0e3f72abb109b0d7 Mon Sep 17 00:00:00 2001 From: Ankit Singhal Date: Mon, 19 Oct 2020 10:03:06 -0700 Subject: [PATCH] PHOENIX-6196 Update phoenix.mutate.maxSizeBytes to accept long values --- .../phoenix/execute/PartialCommitIT.java | 2 +- .../apache/phoenix/compile/DeleteCompiler.java | 16 ++++++++-------- .../apache/phoenix/compile/UpsertCompiler.java | 18 +++++++++--------- .../apache/phoenix/jdbc/PhoenixConnection.java | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java index ee24ca958e4..e452da4d864 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java @@ -270,7 +270,7 @@ private PhoenixConnection getConnectionWithTableOrderPreservingMutationState() t // passing a null mutation state forces the connection.newMutationState() to be used to create the MutationState return new PhoenixConnection(con, (MutationState)null) { @Override - protected MutationState newMutationState(int maxSize, int maxSizeBytes) { + protected MutationState newMutationState(int maxSize, long maxSizeBytes) { return new MutationState(maxSize, maxSizeBytes, this, mutations, false, null); }; }; 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 c682665b27a..f8013fa08e3 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 @@ -142,7 +142,7 @@ private static MutationState deleteRows(StatementContext context, ResultIterator final boolean autoFlush = connection.getAutoCommit() || tableRef.getTable().isTransactional(); ConnectionQueryServices services = connection.getQueryServices(); final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); - final int maxSizeBytes = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); + final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); final int batchSize = Math.min(connection.getMutateBatchSize(), maxSize); MultiRowMutationState mutations = new MultiRowMutationState(batchSize); List otherMutations = null; @@ -569,7 +569,7 @@ Collections. emptyList(), null, delete.getOrderBy(), delete.getLimit( } final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); - final int maxSizeBytes = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); + final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); // If we're doing a query for a set of rows with no where clause, then we don't need to contact the server at all. if (noQueryReqd) { @@ -649,9 +649,9 @@ private class SingleRowDeleteMutationPlan implements MutationPlan { private final PhoenixConnection connection; private final int maxSize; private final StatementContext context; - private final int maxSizeBytes; + private final long maxSizeBytes; - public SingleRowDeleteMutationPlan(QueryPlan dataPlan, PhoenixConnection connection, int maxSize, int maxSizeBytes) { + public SingleRowDeleteMutationPlan(QueryPlan dataPlan, PhoenixConnection connection, int maxSize, long maxSizeBytes) { this.dataPlan = dataPlan; this.connection = connection; this.maxSize = maxSize; @@ -733,10 +733,10 @@ private class ServerSelectDeleteMutationPlan implements MutationPlan { private final QueryPlan aggPlan; private final RowProjector projector; private final int maxSize; - private final int maxSizeBytes; + private final long maxSizeBytes; public ServerSelectDeleteMutationPlan(QueryPlan dataPlan, PhoenixConnection connection, QueryPlan aggPlan, - RowProjector projector, int maxSize, int maxSizeBytes) { + RowProjector projector, int maxSize, long maxSizeBytes) { this.context = dataPlan.getContext(); this.dataPlan = dataPlan; this.connection = connection; @@ -847,14 +847,14 @@ private class ClientSelectDeleteMutationPlan implements MutationPlan { private final List otherTableRefs; private final TableRef projectedTableRef; private final int maxSize; - private final int maxSizeBytes; + private final long maxSizeBytes; private final PhoenixConnection connection; public ClientSelectDeleteMutationPlan(TableRef targetTableRef, QueryPlan dataPlan, QueryPlan bestPlan, boolean hasPreOrPostProcessing, DeletingParallelIteratorFactory parallelIteratorFactory, List otherTableRefs, TableRef projectedTableRef, int maxSize, - int maxSizeBytes, PhoenixConnection connection) { + long maxSizeBytes, PhoenixConnection connection) { this.context = bestPlan.getContext(); this.targetTableRef = targetTableRef; this.dataPlan = dataPlan; 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 3a2a5340eb5..5bbc85f02f8 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 @@ -212,8 +212,8 @@ public static MutationState upsertSelect(StatementContext childContext, TableRef ConnectionQueryServices services = connection.getQueryServices(); int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); - int maxSizeBytes = - services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, + long maxSizeBytes = + services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); int maxHBaseClientKeyValueSize = services.getProps().getInt(QueryServices.HBASE_CLIENT_KEYVALUE_MAXSIZE, @@ -370,7 +370,7 @@ public MutationPlan compile(UpsertStatement upsert) throws SQLException { final PhoenixConnection connection = statement.getConnection(); ConnectionQueryServices services = connection.getQueryServices(); final int maxSize = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); - final int maxSizeBytes = services.getProps().getInt(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); + final long maxSizeBytes = services.getProps().getLong(QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB,QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); List columnNodes = upsert.getColumns(); TableRef tableRefToBe = null; PTable table = null; @@ -1056,12 +1056,12 @@ private class ServerUpsertSelectMutationPlan implements MutationPlan { private final QueryPlan aggPlan; private final RowProjector aggProjector; private final int maxSize; - private final int maxSizeBytes; + private final long maxSizeBytes; public ServerUpsertSelectMutationPlan(QueryPlan queryPlan, TableRef tableRef, QueryPlan originalQueryPlan, StatementContext context, PhoenixConnection connection, Scan scan, QueryPlan aggPlan, RowProjector aggProjector, - int maxSize, int maxSizeBytes) { + int maxSize, long maxSizeBytes) { this.queryPlan = queryPlan; this.tableRef = tableRef; this.originalQueryPlan = originalQueryPlan; @@ -1179,14 +1179,14 @@ private class UpsertValuesMutationPlan implements MutationPlan { private final boolean useServerTimestamp; private final byte[] onDupKeyBytes; private final int maxSize; - private final int maxSizeBytes; + private final long maxSizeBytes; public UpsertValuesMutationPlan(StatementContext context, TableRef tableRef, int nodeIndexOffset, List constantExpressions, List allColumns, int[] columnIndexes, Set overlapViewColumns, byte[][] values, Set addViewColumns, PhoenixConnection connection, int[] pkSlotIndexes, boolean useServerTimestamp, byte[] onDupKeyBytes, - int maxSize, int maxSizeBytes) { + int maxSize, long maxSizeBytes) { this.context = context; this.tableRef = tableRef; this.nodeIndexOffset = nodeIndexOffset; @@ -1342,9 +1342,9 @@ private class ClientUpsertSelectMutationPlan implements MutationPlan { private final int[] pkSlotIndexes; private final boolean useServerTimestamp; private final int maxSize; - private final int maxSizeBytes; + private final long maxSizeBytes; - public ClientUpsertSelectMutationPlan(QueryPlan queryPlan, TableRef tableRef, QueryPlan originalQueryPlan, UpsertingParallelIteratorFactory parallelIteratorFactory, RowProjector projector, int[] columnIndexes, int[] pkSlotIndexes, boolean useServerTimestamp, int maxSize, int maxSizeBytes) { + public ClientUpsertSelectMutationPlan(QueryPlan queryPlan, TableRef tableRef, QueryPlan originalQueryPlan, UpsertingParallelIteratorFactory parallelIteratorFactory, RowProjector projector, int[] columnIndexes, int[] pkSlotIndexes, boolean useServerTimestamp, int maxSize, long maxSizeBytes) { this.queryPlan = queryPlan; this.tableRef = tableRef; this.originalQueryPlan = originalQueryPlan; 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 a4000be04ff..d48dbc423df 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 @@ -328,7 +328,7 @@ public ReadOnlyProps getProps() { int maxSize = this.services.getProps().getInt( QueryServices.MAX_MUTATION_SIZE_ATTRIB, QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE); - int maxSizeBytes = this.services.getProps().getInt( + long maxSizeBytes = this.services.getProps().getLong( QueryServices.MAX_MUTATION_SIZE_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_MAX_MUTATION_SIZE_BYTES); String timeZoneID = this.services.getProps().get(QueryServices.DATE_FORMAT_TIMEZONE_ATTRIB, @@ -589,7 +589,7 @@ public PTableRef getTableRef(PTableKey key) throws TableNotFoundException { return metaData.getTableRef(key); } - protected MutationState newMutationState(int maxSize, int maxSizeBytes) { + protected MutationState newMutationState(int maxSize, long maxSizeBytes) { return new MutationState(maxSize, maxSizeBytes, this); }