diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java index 51a95e4f0a9..d3f3bc4f82f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java @@ -438,7 +438,7 @@ public class HTable implements HTableInterface { 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); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java index d610d8c5948..f4e2614208d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerWithReadReplicas.java @@ -161,7 +161,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); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index dd42fd53662..b2d599487e1 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -3137,7 +3137,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()); diff --git a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java index d9d7956f9ea..45dfd099a84 100644 --- a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java +++ b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java @@ -17962,6 +17962,26 @@ public final class HBaseProtos { */ com.google.protobuf.ByteString getSrcChecksumBytes(); + + // optional uint32 version_major = 7; + /** + * optional uint32 version_major = 7; + */ + boolean hasVersionMajor(); + /** + * optional uint32 version_major = 7; + */ + int getVersionMajor(); + + // optional uint32 version_minor = 8; + /** + * optional uint32 version_minor = 8; + */ + boolean hasVersionMinor(); + /** + * optional uint32 version_minor = 8; + */ + int getVersionMinor(); } /** * Protobuf type {@code hbase.pb.VersionInfo} @@ -18048,6 +18068,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) { @@ -18346,6 +18376,38 @@ public final class HBaseProtos { } } + // optional uint32 version_major = 7; + public static final int VERSION_MAJOR_FIELD_NUMBER = 7; + private int versionMajor_; + /** + * optional uint32 version_major = 7; + */ + public boolean hasVersionMajor() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional uint32 version_major = 7; + */ + public int getVersionMajor() { + return versionMajor_; + } + + // optional uint32 version_minor = 8; + public static final int VERSION_MINOR_FIELD_NUMBER = 8; + private int versionMinor_; + /** + * optional uint32 version_minor = 8; + */ + public boolean hasVersionMinor() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + /** + * optional uint32 version_minor = 8; + */ + public int getVersionMinor() { + return versionMinor_; + } + private void initFields() { version_ = ""; url_ = ""; @@ -18353,6 +18415,8 @@ public final class HBaseProtos { user_ = ""; date_ = ""; srcChecksum_ = ""; + versionMajor_ = 0; + versionMinor_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -18408,6 +18472,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); } @@ -18441,6 +18511,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; @@ -18494,6 +18572,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; @@ -18531,6 +18619,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; @@ -18656,6 +18752,10 @@ public final class HBaseProtos { bitField0_ = (bitField0_ & ~0x00000010); srcChecksum_ = ""; bitField0_ = (bitField0_ & ~0x00000020); + versionMajor_ = 0; + bitField0_ = (bitField0_ & ~0x00000040); + versionMinor_ = 0; + bitField0_ = (bitField0_ & ~0x00000080); return this; } @@ -18708,6 +18808,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; @@ -18754,6 +18862,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; } @@ -19249,6 +19363,72 @@ public final class HBaseProtos { return this; } + // optional uint32 version_major = 7; + private int versionMajor_ ; + /** + * optional uint32 version_major = 7; + */ + public boolean hasVersionMajor() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional uint32 version_major = 7; + */ + public int getVersionMajor() { + return versionMajor_; + } + /** + * optional uint32 version_major = 7; + */ + public Builder setVersionMajor(int value) { + bitField0_ |= 0x00000040; + versionMajor_ = value; + onChanged(); + return this; + } + /** + * optional uint32 version_major = 7; + */ + public Builder clearVersionMajor() { + bitField0_ = (bitField0_ & ~0x00000040); + versionMajor_ = 0; + onChanged(); + return this; + } + + // optional uint32 version_minor = 8; + private int versionMinor_ ; + /** + * optional uint32 version_minor = 8; + */ + public boolean hasVersionMinor() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + /** + * optional uint32 version_minor = 8; + */ + public int getVersionMinor() { + return versionMinor_; + } + /** + * optional uint32 version_minor = 8; + */ + public Builder setVersionMinor(int value) { + bitField0_ |= 0x00000080; + versionMinor_ = value; + onChanged(); + return this; + } + /** + * optional uint32 version_minor = 8; + */ + public Builder clearVersionMinor() { + bitField0_ = (bitField0_ & ~0x00000080); + versionMinor_ = 0; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:hbase.pb.VersionInfo) } @@ -20106,19 +20286,20 @@ public final class HBaseProtos { "\022\026\n\016least_sig_bits\030\001 \002(\004\022\025\n\rmost_sig_bit" + "s\030\002 \002(\004\"T\n\023NamespaceDescriptor\022\014\n\004name\030\001" + " \002(\014\022/\n\rconfiguration\030\002 \003(\0132\030.hbase.pb.N", - "ameStringPair\"o\n\013VersionInfo\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\004" + - "user\030\004 \002(\t\022\014\n\004date\030\005 \002(\t\022\024\n\014src_checksum" + - "\030\006 \002(\t\"Q\n\020RegionServerInfo\022\020\n\010infoPort\030\001" + - " \001(\005\022+\n\014version_info\030\002 \001(\0132\025.hbase.pb.Ve" + - "rsionInfo*r\n\013CompareType\022\010\n\004LESS\020\000\022\021\n\rLE" + - "SS_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\010TimeUnit\022\017\n\013NANOSECONDS\020\001\022\020\n\014MI" + - "CROSECONDS\020\002\022\020\n\014MILLISECONDS\020\003\022\013\n\007SECOND", - "S\020\004\022\013\n\007MINUTES\020\005\022\t\n\005HOURS\020\006\022\010\n\004DAYS\020\007B>\n" + - "*org.apache.hadoop.hbase.protobuf.genera" + - "tedB\013HBaseProtosH\001\240\001\001" + "ameStringPair\"\235\001\n\013VersionInfo\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_checksu" + + "m\030\006 \002(\t\022\025\n\rversion_major\030\007 \001(\r\022\025\n\rversio" + + "n_minor\030\010 \001(\r\"Q\n\020RegionServerInfo\022\020\n\010inf" + + "oPort\030\001 \001(\005\022+\n\014version_info\030\002 \001(\0132\025.hbas" + + "e.pb.VersionInfo*r\n\013CompareType\022\010\n\004LESS\020" + + "\000\022\021\n\rLESS_OR_EQUAL\020\001\022\t\n\005EQUAL\020\002\022\r\n\tNOT_E" + + "QUAL\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\014MILLISECONDS\020\003\022\013\n" + + "\007SECONDS\020\004\022\013\n\007MINUTES\020\005\022\t\n\005HOURS\020\006\022\010\n\004DA" + + "YS\020\007B>\n*org.apache.hadoop.hbase.protobuf" + + ".generatedB\013HBaseProtosH\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -20274,7 +20455,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(25); internal_static_hbase_pb_RegionServerInfo_fieldAccessorTable = new diff --git a/hbase-protocol/src/main/protobuf/HBase.proto b/hbase-protocol/src/main/protobuf/HBase.proto index 6cb42b12416..e5c967a21ac 100644 --- a/hbase-protocol/src/main/protobuf/HBase.proto +++ b/hbase-protocol/src/main/protobuf/HBase.proto @@ -245,6 +245,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; } /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java index c40551899ed..618777b44ed 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/VersionInfoUtil.java @@ -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("\\."); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index c82d49c2aef..3b254c0f34c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -69,6 +69,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.exceptions.FailedSanityCheckException; import org.apache.hadoop.hbase.exceptions.MergeRegionException; @@ -2100,7 +2101,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) {