hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject git commit: HBASE-11936 IsolationLevel must be attribute of a Query not a Scan (Vladimir Rodionov)
Date Thu, 11 Sep 2014 19:58:13 GMT
Repository: hbase
Updated Branches:
  refs/heads/master c615f2232 -> 4cb76aa92


HBASE-11936 IsolationLevel must be attribute of a Query not a Scan (Vladimir Rodionov)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4cb76aa9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4cb76aa9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4cb76aa9

Branch: refs/heads/master
Commit: 4cb76aa929c4bd9f9f1f9783ab940a902bfdb166
Parents: c615f22
Author: Enis Soztutar <enis@apache.org>
Authored: Thu Sep 11 12:58:04 2014 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Thu Sep 11 12:58:04 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Get.java     |  6 ++++
 .../org/apache/hadoop/hbase/client/Query.java   | 28 ++++++++++++++++
 .../org/apache/hadoop/hbase/client/Scan.java    | 34 ++++----------------
 3 files changed, 41 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4cb76aa9/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
index 2a872f4..8551e16 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
@@ -482,4 +482,10 @@ public class Get extends Query
   public Get setReplicaId(int Id) {
     return (Get) super.setReplicaId(Id);
   }
+
+  @Override
+  public Get setIsolationLevel(IsolationLevel level) {
+      return (Get) super.setIsolationLevel(level);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/4cb76aa9/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
index 6706cef..357d7b9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Query.java
@@ -34,6 +34,7 @@ import com.google.common.collect.ListMultimap;
 @InterfaceAudience.Public
 @InterfaceStability.Evolving
 public abstract class Query extends OperationWithAttributes {
+  private static final String ISOLATION_LEVEL = "_isolationlevel_";
   protected Filter filter = null;
   protected int targetReplicaId = -1;
   protected Consistency consistency = Consistency.STRONG;
@@ -143,4 +144,31 @@ public abstract class Query extends OperationWithAttributes {
   public int getReplicaId() {
     return this.targetReplicaId;
   }
+
+  /*
+   * Set the isolation level for this query. If the
+   * isolation level is set to READ_UNCOMMITTED, then
+   * this query will return data from committed and
+   * uncommitted transactions. If the isolation level
+   * is set to READ_COMMITTED, then this query will return
+   * data from committed transactions only. If a isolation
+   * level is not explicitly set on a Query, then it
+   * is assumed to be READ_COMMITTED.
+   * @param level IsolationLevel for this query
+   */
+  public Query setIsolationLevel(IsolationLevel level) {
+    setAttribute(ISOLATION_LEVEL, level.toBytes());
+    return this;
+  }
+  /*
+   * @return The isolation level of this query.
+   * If no isolation level was set for this query object,
+   * then it returns READ_COMMITTED.
+   * @return The IsolationLevel for this query
+   */
+  public IsolationLevel getIsolationLevel() {
+    byte[] attr = getAttribute(ISOLATION_LEVEL);
+    return attr == null ? IsolationLevel.READ_COMMITTED :
+                          IsolationLevel.fromBytes(attr);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/4cb76aa9/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
index 734d36f..5189139 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
@@ -89,7 +89,6 @@ public class Scan extends Query {
   private static final Log LOG = LogFactory.getLog(Scan.class);
 
   private static final String RAW_ATTR = "_raw_";
-  private static final String ISOLATION_LEVEL = "_isolationlevel_";
 
   /**
    * EXPERT ONLY.
@@ -751,32 +750,7 @@ public class Scan extends Query {
     return attr == null ? false : Bytes.toBoolean(attr);
   }
 
-  /*
-   * Set the isolation level for this scan. If the
-   * isolation level is set to READ_UNCOMMITTED, then
-   * this scan will return data from committed and
-   * uncommitted transactions. If the isolation level
-   * is set to READ_COMMITTED, then this scan will return
-   * data from committed transactions only. If a isolation
-   * level is not explicitly set on a Scan, then it
-   * is assumed to be READ_COMMITTED.
-   * @param level IsolationLevel for this scan
-   */
-  public Scan setIsolationLevel(IsolationLevel level) {
-    setAttribute(ISOLATION_LEVEL, level.toBytes());
-    return this;
-  }
-  /*
-   * @return The isolation level of this scan.
-   * If no isolation level was set for this scan object,
-   * then it returns READ_COMMITTED.
-   * @return The IsolationLevel for this scan
-   */
-  public IsolationLevel getIsolationLevel() {
-    byte[] attr = getAttribute(ISOLATION_LEVEL);
-    return attr == null ? IsolationLevel.READ_COMMITTED :
-                          IsolationLevel.fromBytes(attr);
-  }
+
 
   /**
    * Set whether this scan is a small scan
@@ -845,4 +819,10 @@ public class Scan extends Query {
   public Scan setReplicaId(int Id) {
     return (Scan) super.setReplicaId(Id);
   }
+
+  @Override
+  public Scan setIsolationLevel(IsolationLevel level) {
+    return (Scan) super.setIsolationLevel(level);
+  }
+
 }


Mime
View raw message