Repository: hbase Updated Branches: refs/heads/0.98 79ff36339 -> 44d410660
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/44d41066 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/44d41066 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/44d41066 Branch: refs/heads/0.98 Commit: 44d4106608e924bbd9b0ae85165a0f04a7cdb321 Parents: 79ff363 Author: Enis Soztutar <[email protected]> Authored: Thu Sep 11 14:41:27 2014 -0700 Committer: Enis Soztutar <[email protected]> Committed: Thu Sep 11 14:41:27 2014 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/client/Query.java | 29 +++++++++++++++++++- .../org/apache/hadoop/hbase/client/Scan.java | 27 ------------------ 2 files changed, 28 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/44d41066/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 0d41934..57feb08 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 @@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.security.access.AccessControlConstants; import org.apache.hadoop.hbase.security.access.Permission; import org.apache.hadoop.hbase.security.visibility.Authorizations; import org.apache.hadoop.hbase.security.visibility.VisibilityConstants; -import org.apache.hadoop.hbase.util.Bytes; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; @@ -36,6 +35,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; /** @@ -118,4 +118,31 @@ public abstract class Query extends OperationWithAttributes { @Deprecated public void setACLStrategy(boolean cellFirstStrategy) { } + + /** + * 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 void setIsolationLevel(IsolationLevel level) { + setAttribute(ISOLATION_LEVEL, level.toBytes()); + } + + /** + * @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); + } } http://git-wip-us.apache.org/repos/asf/hbase/blob/44d41066/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 4527d56..3d57156 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 @@ -87,7 +87,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. @@ -738,32 +737,6 @@ 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 void setIsolationLevel(IsolationLevel level) { - setAttribute(ISOLATION_LEVEL, level.toBytes()); - } - /* - * @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 * <p>
