hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-15285 Forward-port respect for isReturnResult from HBASE-15095
Date Thu, 18 Feb 2016 03:33:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 a8314301c -> e610655e5


HBASE-15285 Forward-port respect for isReturnResult from HBASE-15095


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

Branch: refs/heads/branch-1.2
Commit: e610655e5c622d081a2b7d6fee494159c2d1e179
Parents: a831430
Author: stack <stack@apache.org>
Authored: Wed Feb 17 19:32:41 2016 -0800
Committer: stack <stack@apache.org>
Committed: Wed Feb 17 19:33:07 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Append.java   |  7 +++----
 .../apache/hadoop/hbase/client/Increment.java    | 11 ++++-------
 .../org/apache/hadoop/hbase/client/Mutation.java | 19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e610655e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
index 58c204b..f20f727 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java
@@ -47,7 +47,6 @@ import org.apache.hadoop.hbase.util.Bytes;
 @InterfaceAudience.Public
 @InterfaceStability.Stable
 public class Append extends Mutation {
-  private static final String RETURN_RESULTS = "_rr_";
   /**
    * @param returnResults
    *          True (default) if the append operation should return the results.
@@ -55,16 +54,16 @@ public class Append extends Mutation {
    *          bandwidth setting this to false.
    */
   public Append setReturnResults(boolean returnResults) {
-    setAttribute(RETURN_RESULTS, Bytes.toBytes(returnResults));
+    super.setReturnResults(returnResults);
     return this;
   }
 
   /**
    * @return current setting for returnResults
    */
+  // This method makes public the superclasses's protected method.
   public boolean isReturnResults() {
-    byte[] v = getAttribute(RETURN_RESULTS);
-    return v == null ? true : Bytes.toBoolean(v);
+    return super.isReturnResults();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/e610655e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
index 1857533..b60cbde 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
@@ -52,9 +52,6 @@ import org.apache.hadoop.hbase.util.ClassSize;
 @InterfaceStability.Stable
 public class Increment extends Mutation implements Comparable<Row> {
   private static final long HEAP_OVERHEAD =  ClassSize.REFERENCE + ClassSize.TIMERANGE;
-
-  private static final String RETURN_RESULTS = "_rr_";
-
   private TimeRange tr = new TimeRange();
 
   /**
@@ -170,16 +167,16 @@ public class Increment extends Mutation implements Comparable<Row>
{
    *          to false.
    */
   public Increment setReturnResults(boolean returnResults) {
-    setAttribute(RETURN_RESULTS, Bytes.toBytes(returnResults));
+    super.setReturnResults(returnResults);
     return this;
   }
 
   /**
-   * @return current value for returnResults
+   * @return current setting for returnResults
    */
+  // This method makes public the superclasses's protected method.
   public boolean isReturnResults() {
-    byte[] v = getAttribute(RETURN_RESULTS);
-    return v == null ? true : Bytes.toBoolean(v);
+    return super.isReturnResults();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/e610655e/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
index 2b88ffc..138a0fe 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
@@ -83,6 +83,8 @@ public abstract class Mutation extends OperationWithAttributes implements
Row, C
    */
   private static final String OP_ATTRIBUTE_TTL = "_ttl";
 
+  private static final String RETURN_RESULTS = "_rr_";
+
   protected byte [] row = null;
   protected long ts = HConstants.LATEST_TIMESTAMP;
   protected Durability durability = Durability.USE_DEFAULT;
@@ -508,6 +510,23 @@ public abstract class Mutation extends OperationWithAttributes implements
Row, C
   }
 
   /**
+   * @return current value for returnResults
+   */
+  // Used by Increment and Append only.
+  @InterfaceAudience.Private
+  protected boolean isReturnResults() {
+    byte[] v = getAttribute(RETURN_RESULTS);
+    return v == null ? true : Bytes.toBoolean(v);
+  }
+
+  @InterfaceAudience.Private
+  // Used by Increment and Append only.
+  protected Mutation setReturnResults(boolean returnResults) {
+    setAttribute(RETURN_RESULTS, Bytes.toBytes(returnResults));
+    return this;
+  }
+
+  /**
    * Subclasses should override this method to add the heap size of their own fields.
    * @return the heap size to add (will be aligned).
    */


Mime
View raw message