PHOENIX-4745 Update Tephra version to 0.14.0-incubating
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/df2a7e69 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/df2a7e69 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/df2a7e69 Branch: refs/heads/4.x-cdh5.14 Commit: df2a7e69808ed0be53afea3734aab6ea0149d1ad Parents: 574d818 Author: James Taylor <jtay...@salesforce.com> Authored: Thu May 24 16:10:52 2018 -0700 Committer: James Taylor <jtay...@salesforce.com> Committed: Thu May 24 18:01:45 2018 -0700 ---------------------------------------------------------------------- .../phoenix/query/QueryServicesOptions.java | 5 +- .../transaction/TephraTransactionContext.java | 74 +++++++++++++++++++- pom.xml | 2 +- 3 files changed, 78 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/df2a7e69/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java ---------------------------------------------------------------------- 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 d708785..307c5dd 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 @@ -117,6 +117,7 @@ import org.apache.phoenix.trace.util.Tracing; import org.apache.phoenix.transaction.TransactionFactory; import org.apache.phoenix.util.DateUtil; import org.apache.phoenix.util.ReadOnlyProps; +import org.apache.tephra.TxConstants; @@ -440,7 +441,9 @@ public class QueryServicesOptions { .setIfUnset(UPLOAD_BINARY_DATA_TYPE_ENCODING, DEFAULT_UPLOAD_BINARY_DATA_TYPE_ENCODING) .setIfUnset(PHOENIX_ACLS_ENABLED, DEFAULT_PHOENIX_ACLS_ENABLED) .setIfUnset(LOG_LEVEL, DEFAULT_LOGGING_LEVEL) - .setIfUnset(LOG_SAMPLE_RATE, DEFAULT_LOG_SAMPLE_RATE); + .setIfUnset(LOG_SAMPLE_RATE, DEFAULT_LOG_SAMPLE_RATE) + .setIfUnset(TxConstants.TX_PRE_014_CHANGESET_KEY, Boolean.FALSE.toString()) + ; // HBase sets this to 1, so we reset it to something more appropriate. // Hopefully HBase will change this, because we can't know if a user set // it to 1, so we'll change it. http://git-wip-us.apache.org/repos/asf/phoenix/blob/df2a7e69/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionContext.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionContext.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionContext.java index 8b16210..9c6af63 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionContext.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/TephraTransactionContext.java @@ -26,7 +26,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HTableInterface; +import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.exception.SQLExceptionInfo; @@ -391,9 +393,79 @@ public class TephraTransactionContext implements PhoenixTransactionContext { return new TephraTransactionContext(context, subTask); } + public static class TransactionAwareHTableDelegate extends TransactionAwareHTable implements HTableInterface { + private final HTableInterface delegate; + + public TransactionAwareHTableDelegate(HTableInterface hTable, TxConstants.ConflictDetection conflictLevel) { + super(hTable, conflictLevel); + delegate = hTable; + } + + @Override + public long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL) + throws IOException { + return delegate.incrementColumnValue(row, family, qualifier, amount, writeToWAL); + } + + @Override + public Boolean[] exists(List<Get> gets) throws IOException { + return delegate.exists(gets); + } + + @Override + public void setAutoFlush(boolean autoFlush) { + delegate.setAutoFlush(autoFlush); + } + + @Override + public void setAutoFlush(boolean autoFlush, boolean clearBufferOnFail) { + delegate.setAutoFlush(autoFlush, clearBufferOnFail); + } + + @Override + public void setAutoFlushTo(boolean autoFlush) { + delegate.setAutoFlushTo(autoFlush); + } + + @Override + public boolean isAutoFlush() { + return delegate.isAutoFlush(); + } + + @Override + public void flushCommits() throws IOException { + delegate.flushCommits(); + } + + @Override + public Result getRowOrBefore(byte[] row, byte[] family) throws IOException { + return delegate.getRowOrBefore(row, family); + } + + @Override + public void setRpcTimeout(int i) { + delegate.setRpcTimeout(i); + } + + @Override + public int getRpcTimeout() { + return delegate.getRpcTimeout(); + } + + @Override + public void setOperationTimeout(int i) { + delegate.setOperationTimeout(i); + } + + @Override + public int getOperationTimeout() { + return delegate.getOperationTimeout(); + } + } + @Override public HTableInterface getTransactionalTable(HTableInterface htable, boolean isImmutable) { - TransactionAwareHTable transactionAwareHTable = new TransactionAwareHTable(htable, isImmutable ? TxConstants.ConflictDetection.NONE : TxConstants.ConflictDetection.ROW); + TransactionAwareHTableDelegate transactionAwareHTable = new TransactionAwareHTableDelegate(htable, isImmutable ? TxConstants.ConflictDetection.NONE : TxConstants.ConflictDetection.ROW); this.addTransactionAware(transactionAwareHTable); return transactionAwareHTable; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/df2a7e69/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 944b5f6..bea1199 100644 --- a/pom.xml +++ b/pom.xml @@ -143,7 +143,7 @@ <joni.version>2.1.2</joni.version> <avatica.version>1.10.0</avatica.version> <jettyVersion>8.1.7.v20120910</jettyVersion> - <tephra.version>0.13.0-incubating</tephra.version> + <tephra.version>0.14.0-incubating</tephra.version> <spark.version>${cdh.spark.version}</spark.version> <scala.version>2.10.4</scala.version> <scala.binary.version>2.10</scala.binary.version>