HBASE-15285 Forward-port respect for isReturnResult from HBASE-15095
This commit is contained in:
parent
2e1a3ef644
commit
23917519e8
|
@ -47,7 +47,6 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
@InterfaceStability.Stable
|
@InterfaceStability.Stable
|
||||||
public class Append extends Mutation {
|
public class Append extends Mutation {
|
||||||
private static final String RETURN_RESULTS = "_rr_";
|
|
||||||
/**
|
/**
|
||||||
* @param returnResults
|
* @param returnResults
|
||||||
* True (default) if the append operation should return the results.
|
* True (default) if the append operation should return the results.
|
||||||
|
@ -55,16 +54,16 @@ public class Append extends Mutation {
|
||||||
* bandwidth setting this to false.
|
* bandwidth setting this to false.
|
||||||
*/
|
*/
|
||||||
public Append setReturnResults(boolean returnResults) {
|
public Append setReturnResults(boolean returnResults) {
|
||||||
setAttribute(RETURN_RESULTS, Bytes.toBytes(returnResults));
|
super.setReturnResults(returnResults);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return current setting for returnResults
|
* @return current setting for returnResults
|
||||||
*/
|
*/
|
||||||
|
// This method makes public the superclasses's protected method.
|
||||||
public boolean isReturnResults() {
|
public boolean isReturnResults() {
|
||||||
byte[] v = getAttribute(RETURN_RESULTS);
|
return super.isReturnResults();
|
||||||
return v == null ? true : Bytes.toBoolean(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,9 +52,6 @@ import org.apache.hadoop.hbase.util.ClassSize;
|
||||||
@InterfaceStability.Stable
|
@InterfaceStability.Stable
|
||||||
public class Increment extends Mutation implements Comparable<Row> {
|
public class Increment extends Mutation implements Comparable<Row> {
|
||||||
private static final long HEAP_OVERHEAD = ClassSize.REFERENCE + ClassSize.TIMERANGE;
|
private static final long HEAP_OVERHEAD = ClassSize.REFERENCE + ClassSize.TIMERANGE;
|
||||||
|
|
||||||
private static final String RETURN_RESULTS = "_rr_";
|
|
||||||
|
|
||||||
private TimeRange tr = new TimeRange();
|
private TimeRange tr = new TimeRange();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,16 +167,16 @@ public class Increment extends Mutation implements Comparable<Row> {
|
||||||
* to false.
|
* to false.
|
||||||
*/
|
*/
|
||||||
public Increment setReturnResults(boolean returnResults) {
|
public Increment setReturnResults(boolean returnResults) {
|
||||||
setAttribute(RETURN_RESULTS, Bytes.toBytes(returnResults));
|
super.setReturnResults(returnResults);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return current value for returnResults
|
* @return current setting for returnResults
|
||||||
*/
|
*/
|
||||||
|
// This method makes public the superclasses's protected method.
|
||||||
public boolean isReturnResults() {
|
public boolean isReturnResults() {
|
||||||
byte[] v = getAttribute(RETURN_RESULTS);
|
return super.isReturnResults();
|
||||||
return v == null ? true : Bytes.toBoolean(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 OP_ATTRIBUTE_TTL = "_ttl";
|
||||||
|
|
||||||
|
private static final String RETURN_RESULTS = "_rr_";
|
||||||
|
|
||||||
protected byte [] row = null;
|
protected byte [] row = null;
|
||||||
protected long ts = HConstants.LATEST_TIMESTAMP;
|
protected long ts = HConstants.LATEST_TIMESTAMP;
|
||||||
protected Durability durability = Durability.USE_DEFAULT;
|
protected Durability durability = Durability.USE_DEFAULT;
|
||||||
|
@ -507,6 +509,23 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
* Subclasses should override this method to add the heap size of their own fields.
|
||||||
* @return the heap size to add (will be aligned).
|
* @return the heap size to add (will be aligned).
|
||||||
|
|
Loading…
Reference in New Issue