You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by td...@apache.org on 2015/03/13 02:31:05 UTC
phoenix git commit: Use row level conflict detection
Repository: phoenix
Updated Branches:
refs/heads/txn 28da96e9c -> aaf8b4fe6
Use row level conflict detection
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/aaf8b4fe
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/aaf8b4fe
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/aaf8b4fe
Branch: refs/heads/txn
Commit: aaf8b4fe6cc24276b7efd5e44529db27e74a21f8
Parents: 28da96e
Author: Thomas D'Silva <tw...@gmail.com>
Authored: Thu Mar 12 18:30:59 2015 -0700
Committer: Thomas D'Silva <tw...@gmail.com>
Committed: Thu Mar 12 18:30:59 2015 -0700
----------------------------------------------------------------------
.../main/java/org/apache/phoenix/execute/MutationState.java | 4 +++-
.../java/org/apache/phoenix/iterate/TableResultIterator.java | 3 ++-
.../main/java/org/apache/phoenix/util/TransactionUtil.java | 7 +++++++
3 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/aaf8b4fe/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 c452991..edaab9e 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
@@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import co.cask.tephra.TxConstants;
import co.cask.tephra.hbase98.TransactionAwareHTable;
import org.apache.hadoop.hbase.HConstants;
@@ -60,6 +61,7 @@ import org.apache.phoenix.util.LogUtil;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.SQLCloseable;
import org.apache.phoenix.util.ServerUtil;
+import org.apache.phoenix.util.TransactionUtil;
import org.cloudera.htrace.Span;
import org.cloudera.htrace.TraceScope;
import org.slf4j.Logger;
@@ -424,7 +426,7 @@ public class MutationState implements SQLCloseable {
// Don't add immutable indexes (those are the only ones that would participate
// during a commit), as we don't need conflict detection for these.
if (table.isTransactional() && table.getType() != PTableType.INDEX) {
- TransactionAwareHTable txnAware = new TransactionAwareHTable(hTable);
+ TransactionAwareHTable txnAware = TransactionUtil.getTransactionAwareHTable(hTable);
connection.addTxParticipant(txnAware);
hTable = txnAware;
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/aaf8b4fe/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
index 5beb2e1..7f5d527 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/TableResultIterator.java
@@ -31,6 +31,7 @@ import org.apache.phoenix.schema.TableRef;
import org.apache.phoenix.schema.tuple.Tuple;
import org.apache.phoenix.util.Closeables;
import org.apache.phoenix.util.ServerUtil;
+import org.apache.phoenix.util.TransactionUtil;
/**
@@ -86,7 +87,7 @@ public class TableResultIterator extends ExplainTable implements ResultIterator
PTable table = tableRef.getTable();
HTableInterface htable = context.getConnection().getQueryServices().getTable(table.getPhysicalName().getBytes());
if (table.isTransactional()) {
- TransactionAwareHTable txnAware = new TransactionAwareHTable(htable);
+ TransactionAwareHTable txnAware = TransactionUtil.getTransactionAwareHTable(htable);
context.getConnection().addTxParticipant(txnAware);
htable = txnAware;
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/aaf8b4fe/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
index 0b154ce..34bba47 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/TransactionUtil.java
@@ -24,7 +24,10 @@ import co.cask.tephra.Transaction;
import co.cask.tephra.TransactionCodec;
import co.cask.tephra.TransactionConflictException;
import co.cask.tephra.TransactionFailureException;
+import co.cask.tephra.TxConstants;
+import co.cask.tephra.hbase98.TransactionAwareHTable;
+import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.exception.SQLExceptionInfo;
@@ -63,4 +66,8 @@ public class TransactionUtil {
.setRootCause(e)
.build().buildException();
}
+
+ public static TransactionAwareHTable getTransactionAwareHTable(HTableInterface htable) {
+ return new TransactionAwareHTable(htable, TxConstants.ConflictDetection.ROW);
+ }
}