Return-Path: X-Original-To: apmail-phoenix-commits-archive@minotaur.apache.org Delivered-To: apmail-phoenix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E0E3A11F8F for ; Sun, 8 Jun 2014 20:01:19 +0000 (UTC) Received: (qmail 91100 invoked by uid 500); 8 Jun 2014 20:01:16 -0000 Delivered-To: apmail-phoenix-commits-archive@phoenix.apache.org Received: (qmail 91048 invoked by uid 500); 8 Jun 2014 20:01:16 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 91019 invoked by uid 99); 8 Jun 2014 20:01:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Jun 2014 20:01:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 42A7F46EA4; Sun, 8 Jun 2014 20:01:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jamestaylor@apache.org To: commits@phoenix.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: PHOENIX-1034 Move validate/reserve of sequences into query compile Date: Sun, 8 Jun 2014 20:01:16 +0000 (UTC) Repository: phoenix Updated Branches: refs/heads/master 2ad434d6e -> ea9232a31 PHOENIX-1034 Move validate/reserve of sequences into query compile Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ea9232a3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ea9232a3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ea9232a3 Branch: refs/heads/master Commit: ea9232a31e0bed23c6e746e91d3bb3250dc71ae9 Parents: 2ad434d Author: James Taylor Authored: Sun Jun 8 13:01:55 2014 -0700 Committer: James Taylor Committed: Sun Jun 8 13:02:50 2014 -0700 ---------------------------------------------------------------------- .../phoenix/coprocessor/SequenceRegionObserver.java | 2 +- .../apache/phoenix/jdbc/PhoenixPreparedStatement.java | 4 ++-- .../java/org/apache/phoenix/jdbc/PhoenixStatement.java | 12 ++++++------ .../phoenix/query/ConnectionQueryServicesImpl.java | 2 +- .../main/java/org/apache/phoenix/schema/Sequence.java | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea9232a3/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java index a21a61a..97a9a47 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/SequenceRegionObserver.java @@ -129,7 +129,7 @@ public class SequenceRegionObserver extends BaseRegionObserver { long value = PDataType.LONG.getCodec().decodeLong(cq.getValueArray(), cq.getValueOffset(), SortOrder.getDefault()); get.addColumn(cf, CellUtil.cloneQualifier(cq)); - validateOnly &= (Sequence.ValueOp.VALIDATE_SEQUENCES.ordinal() == value); + validateOnly &= (Sequence.ValueOp.VALIDATE_SEQUENCE.ordinal() == value); } } Result result = region.get(get); http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea9232a3/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java index d75eb28..7eea568 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixPreparedStatement.java @@ -189,7 +189,7 @@ public class PhoenixPreparedStatement extends PhoenixStatement implements Prepar } try { // Just compile top level query without optimizing to get ResultSetMetaData - QueryPlan plan = statement.compilePlan(this, Sequence.ValueOp.VALIDATE_SEQUENCES); + QueryPlan plan = statement.compilePlan(this, Sequence.ValueOp.VALIDATE_SEQUENCE); return new PhoenixResultSetMetaData(this.getConnection(), plan.getProjector()); } finally { int lastSetBit = 0; @@ -212,7 +212,7 @@ public class PhoenixPreparedStatement extends PhoenixStatement implements Prepar } } try { - StatementPlan plan = statement.compilePlan(this, Sequence.ValueOp.VALIDATE_SEQUENCES); + StatementPlan plan = statement.compilePlan(this, Sequence.ValueOp.VALIDATE_SEQUENCE); return plan.getParameterMetaData(); } finally { int lastSetBit = 0; http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea9232a3/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java index 529a40a..d4c677b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java @@ -195,7 +195,7 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho } protected QueryPlan optimizeQuery(CompilableStatement stmt) throws SQLException { - QueryPlan plan = stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCES); + QueryPlan plan = stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCE); return connection.getQueryServices().getOptimizer().optimize(this, plan); } @@ -205,7 +205,7 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho @Override public PhoenixResultSet call() throws Exception { try { - QueryPlan plan = stmt.compilePlan(PhoenixStatement.this, Sequence.ValueOp.RESERVE_SEQUENCES); + QueryPlan plan = stmt.compilePlan(PhoenixStatement.this, Sequence.ValueOp.RESERVE_SEQUENCE); plan = connection.getQueryServices().getOptimizer().optimize( PhoenixStatement.this, plan); PhoenixResultSet rs = newResultSet(plan.iterator(), plan.getProjector()); @@ -242,7 +242,7 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho // since they'd update data directly from coprocessors, and should thus operate on // the latest state try { - MutationPlan plan = stmt.compilePlan(PhoenixStatement.this, Sequence.ValueOp.RESERVE_SEQUENCES); + MutationPlan plan = stmt.compilePlan(PhoenixStatement.this, Sequence.ValueOp.RESERVE_SEQUENCE); MutationState state = plan.execute(); connection.getMutationState().join(state); if (connection.getAutoCommit()) { @@ -346,7 +346,7 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho @Override public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp seqAction) throws SQLException { CompilableStatement compilableStmt = getStatement(); - final StatementPlan plan = compilableStmt.compilePlan(stmt, Sequence.ValueOp.VALIDATE_SEQUENCES); + final StatementPlan plan = compilableStmt.compilePlan(stmt, Sequence.ValueOp.VALIDATE_SEQUENCE); List planSteps = plan.getExplainPlan().getPlanSteps(); List tuples = Lists.newArrayListWithExpectedSize(planSteps.size()); for (String planStep : planSteps) { @@ -904,14 +904,14 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho if (stmt.getOperation().isMutation()) { throw new ExecuteQueryNotApplicableException(query); } - return stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCES); + return stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCE); } public MutationPlan compileMutation(CompilableStatement stmt, String query) throws SQLException { if (!stmt.getOperation().isMutation()) { throw new ExecuteUpdateNotApplicableException(query); } - return stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCES); + return stmt.compilePlan(this, Sequence.ValueOp.RESERVE_SEQUENCE); } public MutationPlan compileMutation(String sql) throws SQLException { http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea9232a3/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 0ace6b6..5eb5314 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -1719,7 +1719,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement */ @Override public void incrementSequences(List sequenceKeys, long timestamp, long[] values, SQLException[] exceptions) throws SQLException { - incrementSequenceValues(sequenceKeys, timestamp, values, exceptions, 1, Sequence.ValueOp.RESERVE_SEQUENCES); + incrementSequenceValues(sequenceKeys, timestamp, values, exceptions, 1, Sequence.ValueOp.RESERVE_SEQUENCE); } @SuppressWarnings("deprecation") http://git-wip-us.apache.org/repos/asf/phoenix/blob/ea9232a3/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java index 41f62fe..da5d034 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/Sequence.java @@ -53,7 +53,7 @@ import com.google.common.collect.Lists; public class Sequence { public static final int SUCCESS = 0; - public enum ValueOp {VALIDATE_SEQUENCES, RESERVE_SEQUENCES}; + public enum ValueOp {VALIDATE_SEQUENCE, RESERVE_SEQUENCE}; public enum MetaOp {CREATE_SEQUENCE, DROP_SEQUENCE, RETURN_SEQUENCE}; // Pre-compute index of sequence key values to prevent binary search @@ -127,7 +127,7 @@ public class Sequence { throw EMPTY_SEQUENCE_CACHE_EXCEPTION; } if (value.currentValue == value.nextValue) { - if (action == ValueOp.VALIDATE_SEQUENCES) { + if (action == ValueOp.VALIDATE_SEQUENCE) { return value.currentValue; } throw EMPTY_SEQUENCE_CACHE_EXCEPTION;