HBASE-13158 When client supports CellBlock, return the result Cells as controller payload for get(Get) API also.
This commit is contained in:
parent
7ac9eb9d95
commit
574774d8b1
|
@ -861,7 +861,7 @@ public class HTable implements HTableInterface, RegionLocator {
|
|||
try {
|
||||
ClientProtos.GetResponse response = getStub().get(controller, request);
|
||||
if (response == null) return null;
|
||||
return ProtobufUtil.toResult(response.getResult());
|
||||
return ProtobufUtil.toResult(response.getResult(), controller.cellScanner());
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufUtil.getRemoteException(se);
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class RpcRetryingCallerWithReadReplicas {
|
|||
if (response == null) {
|
||||
return null;
|
||||
}
|
||||
return ProtobufUtil.toResult(response.getResult());
|
||||
return ProtobufUtil.toResult(response.getResult(), controller.cellScanner());
|
||||
} catch (ServiceException se) {
|
||||
throw ProtobufUtil.getRemoteException(se);
|
||||
}
|
||||
|
|
|
@ -3210,7 +3210,13 @@ public final class ProtobufUtil {
|
|||
*/
|
||||
public static HBaseProtos.VersionInfo getVersionInfo() {
|
||||
HBaseProtos.VersionInfo.Builder builder = HBaseProtos.VersionInfo.newBuilder();
|
||||
builder.setVersion(VersionInfo.getVersion());
|
||||
String version = VersionInfo.getVersion();
|
||||
builder.setVersion(version);
|
||||
String[] components = version.split("\\.");
|
||||
if (components != null && components.length > 2) {
|
||||
builder.setVersionMajor(Integer.parseInt(components[0]));
|
||||
builder.setVersionMinor(Integer.parseInt(components[1]));
|
||||
}
|
||||
builder.setUrl(VersionInfo.getUrl());
|
||||
builder.setRevision(VersionInfo.getRevision());
|
||||
builder.setUser(VersionInfo.getUser());
|
||||
|
|
|
@ -16798,6 +16798,26 @@ public final class HBaseProtos {
|
|||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getSrcChecksumBytes();
|
||||
|
||||
// optional uint32 version_major = 7;
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
boolean hasVersionMajor();
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
int getVersionMajor();
|
||||
|
||||
// optional uint32 version_minor = 8;
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
boolean hasVersionMinor();
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
int getVersionMinor();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code hbase.pb.VersionInfo}
|
||||
|
@ -16884,6 +16904,16 @@ public final class HBaseProtos {
|
|||
srcChecksum_ = input.readBytes();
|
||||
break;
|
||||
}
|
||||
case 56: {
|
||||
bitField0_ |= 0x00000040;
|
||||
versionMajor_ = input.readUInt32();
|
||||
break;
|
||||
}
|
||||
case 64: {
|
||||
bitField0_ |= 0x00000080;
|
||||
versionMinor_ = input.readUInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
|
@ -17182,6 +17212,38 @@ public final class HBaseProtos {
|
|||
}
|
||||
}
|
||||
|
||||
// optional uint32 version_major = 7;
|
||||
public static final int VERSION_MAJOR_FIELD_NUMBER = 7;
|
||||
private int versionMajor_;
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public boolean hasVersionMajor() {
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public int getVersionMajor() {
|
||||
return versionMajor_;
|
||||
}
|
||||
|
||||
// optional uint32 version_minor = 8;
|
||||
public static final int VERSION_MINOR_FIELD_NUMBER = 8;
|
||||
private int versionMinor_;
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public boolean hasVersionMinor() {
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public int getVersionMinor() {
|
||||
return versionMinor_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
version_ = "";
|
||||
url_ = "";
|
||||
|
@ -17189,6 +17251,8 @@ public final class HBaseProtos {
|
|||
user_ = "";
|
||||
date_ = "";
|
||||
srcChecksum_ = "";
|
||||
versionMajor_ = 0;
|
||||
versionMinor_ = 0;
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
|
@ -17244,6 +17308,12 @@ public final class HBaseProtos {
|
|||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeBytes(6, getSrcChecksumBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
output.writeUInt32(7, versionMajor_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
output.writeUInt32(8, versionMinor_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
|
@ -17277,6 +17347,14 @@ public final class HBaseProtos {
|
|||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBytesSize(6, getSrcChecksumBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(7, versionMajor_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(8, versionMinor_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
|
@ -17330,6 +17408,16 @@ public final class HBaseProtos {
|
|||
result = result && getSrcChecksum()
|
||||
.equals(other.getSrcChecksum());
|
||||
}
|
||||
result = result && (hasVersionMajor() == other.hasVersionMajor());
|
||||
if (hasVersionMajor()) {
|
||||
result = result && (getVersionMajor()
|
||||
== other.getVersionMajor());
|
||||
}
|
||||
result = result && (hasVersionMinor() == other.hasVersionMinor());
|
||||
if (hasVersionMinor()) {
|
||||
result = result && (getVersionMinor()
|
||||
== other.getVersionMinor());
|
||||
}
|
||||
result = result &&
|
||||
getUnknownFields().equals(other.getUnknownFields());
|
||||
return result;
|
||||
|
@ -17367,6 +17455,14 @@ public final class HBaseProtos {
|
|||
hash = (37 * hash) + SRC_CHECKSUM_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getSrcChecksum().hashCode();
|
||||
}
|
||||
if (hasVersionMajor()) {
|
||||
hash = (37 * hash) + VERSION_MAJOR_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getVersionMajor();
|
||||
}
|
||||
if (hasVersionMinor()) {
|
||||
hash = (37 * hash) + VERSION_MINOR_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getVersionMinor();
|
||||
}
|
||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
|
@ -17492,6 +17588,10 @@ public final class HBaseProtos {
|
|||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
srcChecksum_ = "";
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
versionMajor_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
versionMinor_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000080);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -17544,6 +17644,14 @@ public final class HBaseProtos {
|
|||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.srcChecksum_ = srcChecksum_;
|
||||
if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
to_bitField0_ |= 0x00000040;
|
||||
}
|
||||
result.versionMajor_ = versionMajor_;
|
||||
if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
to_bitField0_ |= 0x00000080;
|
||||
}
|
||||
result.versionMinor_ = versionMinor_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
onBuilt();
|
||||
return result;
|
||||
|
@ -17590,6 +17698,12 @@ public final class HBaseProtos {
|
|||
srcChecksum_ = other.srcChecksum_;
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasVersionMajor()) {
|
||||
setVersionMajor(other.getVersionMajor());
|
||||
}
|
||||
if (other.hasVersionMinor()) {
|
||||
setVersionMinor(other.getVersionMinor());
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
|
@ -18085,6 +18199,72 @@ public final class HBaseProtos {
|
|||
return this;
|
||||
}
|
||||
|
||||
// optional uint32 version_major = 7;
|
||||
private int versionMajor_ ;
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public boolean hasVersionMajor() {
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public int getVersionMajor() {
|
||||
return versionMajor_;
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public Builder setVersionMajor(int value) {
|
||||
bitField0_ |= 0x00000040;
|
||||
versionMajor_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_major = 7;</code>
|
||||
*/
|
||||
public Builder clearVersionMajor() {
|
||||
bitField0_ = (bitField0_ & ~0x00000040);
|
||||
versionMajor_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional uint32 version_minor = 8;
|
||||
private int versionMinor_ ;
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public boolean hasVersionMinor() {
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public int getVersionMinor() {
|
||||
return versionMinor_;
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public Builder setVersionMinor(int value) {
|
||||
bitField0_ |= 0x00000080;
|
||||
versionMinor_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional uint32 version_minor = 8;</code>
|
||||
*/
|
||||
public Builder clearVersionMinor() {
|
||||
bitField0_ = (bitField0_ & ~0x00000080);
|
||||
versionMinor_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:hbase.pb.VersionInfo)
|
||||
}
|
||||
|
||||
|
@ -18927,20 +19107,21 @@ public final class HBaseProtos {
|
|||
"al_msg\030\001 \002(\014\"5\n\004UUID\022\026\n\016least_sig_bits\030\001" +
|
||||
" \002(\004\022\025\n\rmost_sig_bits\030\002 \002(\004\"T\n\023Namespace" +
|
||||
"Descriptor\022\014\n\004name\030\001 \002(\014\022/\n\rconfiguratio" +
|
||||
"n\030\002 \003(\0132\030.hbase.pb.NameStringPair\"o\n\013Ver" +
|
||||
"sionInfo\022\017\n\007version\030\001 \002(\t\022\013\n\003url\030\002 \002(\t\022\020" +
|
||||
"\n\010revision\030\003 \002(\t\022\014\n\004user\030\004 \002(\t\022\014\n\004date\030\005" +
|
||||
" \002(\t\022\024\n\014src_checksum\030\006 \002(\t\"Q\n\020RegionServ" +
|
||||
"erInfo\022\020\n\010infoPort\030\001 \001(\005\022+\n\014version_info",
|
||||
"\030\002 \001(\0132\025.hbase.pb.VersionInfo*r\n\013Compare" +
|
||||
"Type\022\010\n\004LESS\020\000\022\021\n\rLESS_OR_EQUAL\020\001\022\t\n\005EQU" +
|
||||
"AL\020\002\022\r\n\tNOT_EQUAL\020\003\022\024\n\020GREATER_OR_EQUAL\020" +
|
||||
"\004\022\013\n\007GREATER\020\005\022\t\n\005NO_OP\020\006*n\n\010TimeUnit\022\017\n" +
|
||||
"\013NANOSECONDS\020\001\022\020\n\014MICROSECONDS\020\002\022\020\n\014MILL" +
|
||||
"ISECONDS\020\003\022\013\n\007SECONDS\020\004\022\013\n\007MINUTES\020\005\022\t\n\005" +
|
||||
"HOURS\020\006\022\010\n\004DAYS\020\007B>\n*org.apache.hadoop.h" +
|
||||
"base.protobuf.generatedB\013HBaseProtosH\001\240\001" +
|
||||
"\001"
|
||||
"n\030\002 \003(\0132\030.hbase.pb.NameStringPair\"\235\001\n\013Ve" +
|
||||
"rsionInfo\022\017\n\007version\030\001 \002(\t\022\013\n\003url\030\002 \002(\t\022" +
|
||||
"\020\n\010revision\030\003 \002(\t\022\014\n\004user\030\004 \002(\t\022\014\n\004date\030" +
|
||||
"\005 \002(\t\022\024\n\014src_checksum\030\006 \002(\t\022\025\n\rversion_m" +
|
||||
"ajor\030\007 \001(\r\022\025\n\rversion_minor\030\010 \001(\r\"Q\n\020Reg",
|
||||
"ionServerInfo\022\020\n\010infoPort\030\001 \001(\005\022+\n\014versi" +
|
||||
"on_info\030\002 \001(\0132\025.hbase.pb.VersionInfo*r\n\013" +
|
||||
"CompareType\022\010\n\004LESS\020\000\022\021\n\rLESS_OR_EQUAL\020\001" +
|
||||
"\022\t\n\005EQUAL\020\002\022\r\n\tNOT_EQUAL\020\003\022\024\n\020GREATER_OR" +
|
||||
"_EQUAL\020\004\022\013\n\007GREATER\020\005\022\t\n\005NO_OP\020\006*n\n\010Time" +
|
||||
"Unit\022\017\n\013NANOSECONDS\020\001\022\020\n\014MICROSECONDS\020\002\022" +
|
||||
"\020\n\014MILLISECONDS\020\003\022\013\n\007SECONDS\020\004\022\013\n\007MINUTE" +
|
||||
"S\020\005\022\t\n\005HOURS\020\006\022\010\n\004DAYS\020\007B>\n*org.apache.h" +
|
||||
"adoop.hbase.protobuf.generatedB\013HBasePro" +
|
||||
"tosH\001\240\001\001"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
|
@ -19084,7 +19265,7 @@ public final class HBaseProtos {
|
|||
internal_static_hbase_pb_VersionInfo_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_hbase_pb_VersionInfo_descriptor,
|
||||
new java.lang.String[] { "Version", "Url", "Revision", "User", "Date", "SrcChecksum", });
|
||||
new java.lang.String[] { "Version", "Url", "Revision", "User", "Date", "SrcChecksum", "VersionMajor", "VersionMinor", });
|
||||
internal_static_hbase_pb_RegionServerInfo_descriptor =
|
||||
getDescriptor().getMessageTypes().get(23);
|
||||
internal_static_hbase_pb_RegionServerInfo_fieldAccessorTable = new
|
||||
|
|
|
@ -227,6 +227,8 @@ message VersionInfo {
|
|||
required string user = 4;
|
||||
required string date = 5;
|
||||
required string src_checksum = 6;
|
||||
optional uint32 version_major = 7;
|
||||
optional uint32 version_minor = 8;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,14 @@ public final class VersionInfoUtil {
|
|||
int major,
|
||||
int minor) {
|
||||
if (versionInfo != null) {
|
||||
if (versionInfo.hasVersionMajor() && versionInfo.hasVersionMinor()) {
|
||||
int clientMajor = versionInfo.getVersionMajor();
|
||||
if (clientMajor != major) {
|
||||
return clientMajor > major;
|
||||
}
|
||||
int clientMinor = versionInfo.getVersionMinor();
|
||||
return clientMinor >= minor;
|
||||
}
|
||||
try {
|
||||
String[] components = versionInfo.getVersion().split("\\.");
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ import org.apache.hadoop.hbase.client.RegionReplicaUtil;
|
|||
import org.apache.hadoop.hbase.client.Result;
|
||||
import org.apache.hadoop.hbase.client.RowMutations;
|
||||
import org.apache.hadoop.hbase.client.Scan;
|
||||
import org.apache.hadoop.hbase.client.VersionInfoUtil;
|
||||
import org.apache.hadoop.hbase.conf.ConfigurationObserver;
|
||||
import org.apache.hadoop.hbase.coordination.CloseRegionCoordination;
|
||||
import org.apache.hadoop.hbase.coordination.OpenRegionCoordination;
|
||||
|
@ -367,7 +368,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
* @return True if current call supports cellblocks
|
||||
*/
|
||||
private boolean isClientCellBlockSupport() {
|
||||
RpcCallContext context = RpcServer.getCurrentCall();
|
||||
return isClientCellBlockSupport(RpcServer.getCurrentCall());
|
||||
}
|
||||
|
||||
private boolean isClientCellBlockSupport(RpcCallContext context) {
|
||||
return context != null && context.isClientCellBlockSupported();
|
||||
}
|
||||
|
||||
|
@ -2031,7 +2035,16 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
ProtobufUtil.toResult(existence, region.getRegionInfo().getReplicaId() != 0);
|
||||
builder.setResult(pbr);
|
||||
} else if (r != null) {
|
||||
ClientProtos.Result pbr = ProtobufUtil.toResult(r);
|
||||
ClientProtos.Result pbr;
|
||||
RpcCallContext call = RpcServer.getCurrentCall();
|
||||
if (isClientCellBlockSupport(call) && controller instanceof PayloadCarryingRpcController
|
||||
&& VersionInfoUtil.hasMinimumVersion(call.getClientVersionInfo(), 1, 3)) {
|
||||
pbr = ProtobufUtil.toResultNoData(r);
|
||||
((PayloadCarryingRpcController) controller)
|
||||
.setCellScanner(CellUtil.createCellScanner(r.rawCells()));
|
||||
} else {
|
||||
pbr = ProtobufUtil.toResult(r);
|
||||
}
|
||||
builder.setResult(pbr);
|
||||
}
|
||||
if (r != null) {
|
||||
|
|
Loading…
Reference in New Issue