HBASE-11558 Caching set on Scan object gets lost when using TableMapReduceUtil in 0.95+ (Ishan Chhabra)

This commit is contained in:
Nick Dimiduk 2014-07-30 13:29:40 -07:00
parent fa160bd124
commit 50ac59fa85
4 changed files with 159 additions and 56 deletions

View File

@ -904,6 +904,9 @@ public final class ProtobufUtil {
if (scan.getConsistency() == Consistency.TIMELINE) { if (scan.getConsistency() == Consistency.TIMELINE) {
scanBuilder.setConsistency(toConsistency(scan.getConsistency())); scanBuilder.setConsistency(toConsistency(scan.getConsistency()));
} }
if (scan.getCaching() > 0) {
scanBuilder.setCaching(scan.getCaching());
}
return scanBuilder.build(); return scanBuilder.build();
} }
@ -986,6 +989,9 @@ public final class ProtobufUtil {
if (proto.hasConsistency()) { if (proto.hasConsistency()) {
scan.setConsistency(toConsistency(proto.getConsistency())); scan.setConsistency(toConsistency(proto.getConsistency()));
} }
if (proto.hasCaching()) {
scan.setCaching(proto.getCaching());
}
return scan; return scan;
} }

View File

@ -13658,6 +13658,16 @@ public final class ClientProtos {
* <code>optional .Consistency consistency = 16 [default = STRONG];</code> * <code>optional .Consistency consistency = 16 [default = STRONG];</code>
*/ */
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency getConsistency(); org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency getConsistency();
// optional uint32 caching = 17;
/**
* <code>optional uint32 caching = 17;</code>
*/
boolean hasCaching();
/**
* <code>optional uint32 caching = 17;</code>
*/
int getCaching();
} }
/** /**
* Protobuf type {@code Scan} * Protobuf type {@code Scan}
@ -13829,6 +13839,11 @@ public final class ClientProtos {
} }
break; break;
} }
case 136: {
bitField0_ |= 0x00004000;
caching_ = input.readUInt32();
break;
}
} }
} }
} catch (com.google.protobuf.InvalidProtocolBufferException e) { } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -14191,6 +14206,22 @@ public final class ClientProtos {
return consistency_; return consistency_;
} }
// optional uint32 caching = 17;
public static final int CACHING_FIELD_NUMBER = 17;
private int caching_;
/**
* <code>optional uint32 caching = 17;</code>
*/
public boolean hasCaching() {
return ((bitField0_ & 0x00004000) == 0x00004000);
}
/**
* <code>optional uint32 caching = 17;</code>
*/
public int getCaching() {
return caching_;
}
private void initFields() { private void initFields() {
column_ = java.util.Collections.emptyList(); column_ = java.util.Collections.emptyList();
attribute_ = java.util.Collections.emptyList(); attribute_ = java.util.Collections.emptyList();
@ -14208,6 +14239,7 @@ public final class ClientProtos {
small_ = false; small_ = false;
reversed_ = false; reversed_ = false;
consistency_ = org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency.STRONG; consistency_ = org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency.STRONG;
caching_ = 0;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
@ -14287,6 +14319,9 @@ public final class ClientProtos {
if (((bitField0_ & 0x00002000) == 0x00002000)) { if (((bitField0_ & 0x00002000) == 0x00002000)) {
output.writeEnum(16, consistency_.getNumber()); output.writeEnum(16, consistency_.getNumber());
} }
if (((bitField0_ & 0x00004000) == 0x00004000)) {
output.writeUInt32(17, caching_);
}
getUnknownFields().writeTo(output); getUnknownFields().writeTo(output);
} }
@ -14360,6 +14395,10 @@ public final class ClientProtos {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeEnumSize(16, consistency_.getNumber()); .computeEnumSize(16, consistency_.getNumber());
} }
if (((bitField0_ & 0x00004000) == 0x00004000)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(17, caching_);
}
size += getUnknownFields().getSerializedSize(); size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size; memoizedSerializedSize = size;
return size; return size;
@ -14457,6 +14496,11 @@ public final class ClientProtos {
result = result && result = result &&
(getConsistency() == other.getConsistency()); (getConsistency() == other.getConsistency());
} }
result = result && (hasCaching() == other.hasCaching());
if (hasCaching()) {
result = result && (getCaching()
== other.getCaching());
}
result = result && result = result &&
getUnknownFields().equals(other.getUnknownFields()); getUnknownFields().equals(other.getUnknownFields());
return result; return result;
@ -14534,6 +14578,10 @@ public final class ClientProtos {
hash = (37 * hash) + CONSISTENCY_FIELD_NUMBER; hash = (37 * hash) + CONSISTENCY_FIELD_NUMBER;
hash = (53 * hash) + hashEnum(getConsistency()); hash = (53 * hash) + hashEnum(getConsistency());
} }
if (hasCaching()) {
hash = (37 * hash) + CACHING_FIELD_NUMBER;
hash = (53 * hash) + getCaching();
}
hash = (29 * hash) + getUnknownFields().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash; memoizedHashCode = hash;
return hash; return hash;
@ -14706,6 +14754,8 @@ public final class ClientProtos {
bitField0_ = (bitField0_ & ~0x00004000); bitField0_ = (bitField0_ & ~0x00004000);
consistency_ = org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency.STRONG; consistency_ = org.apache.hadoop.hbase.protobuf.generated.ClientProtos.Consistency.STRONG;
bitField0_ = (bitField0_ & ~0x00008000); bitField0_ = (bitField0_ & ~0x00008000);
caching_ = 0;
bitField0_ = (bitField0_ & ~0x00010000);
return this; return this;
} }
@ -14816,6 +14866,10 @@ public final class ClientProtos {
to_bitField0_ |= 0x00002000; to_bitField0_ |= 0x00002000;
} }
result.consistency_ = consistency_; result.consistency_ = consistency_;
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
to_bitField0_ |= 0x00004000;
}
result.caching_ = caching_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
onBuilt(); onBuilt();
return result; return result;
@ -14926,6 +14980,9 @@ public final class ClientProtos {
if (other.hasConsistency()) { if (other.hasConsistency()) {
setConsistency(other.getConsistency()); setConsistency(other.getConsistency());
} }
if (other.hasCaching()) {
setCaching(other.getCaching());
}
this.mergeUnknownFields(other.getUnknownFields()); this.mergeUnknownFields(other.getUnknownFields());
return this; return this;
} }
@ -16106,6 +16163,39 @@ public final class ClientProtos {
return this; return this;
} }
// optional uint32 caching = 17;
private int caching_ ;
/**
* <code>optional uint32 caching = 17;</code>
*/
public boolean hasCaching() {
return ((bitField0_ & 0x00010000) == 0x00010000);
}
/**
* <code>optional uint32 caching = 17;</code>
*/
public int getCaching() {
return caching_;
}
/**
* <code>optional uint32 caching = 17;</code>
*/
public Builder setCaching(int value) {
bitField0_ |= 0x00010000;
caching_ = value;
onChanged();
return this;
}
/**
* <code>optional uint32 caching = 17;</code>
*/
public Builder clearCaching() {
bitField0_ = (bitField0_ & ~0x00010000);
caching_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:Scan) // @@protoc_insertion_point(builder_scope:Scan)
} }
@ -30643,7 +30733,7 @@ public final class ClientProtos {
"(\0132\016.MutationProto\022\035\n\tcondition\030\003 \001(\0132\n." + "(\0132\016.MutationProto\022\035\n\tcondition\030\003 \001(\0132\n." +
"Condition\022\023\n\013nonce_group\030\004 \001(\004\"<\n\016Mutate" + "Condition\022\023\n\013nonce_group\030\004 \001(\004\"<\n\016Mutate" +
"Response\022\027\n\006result\030\001 \001(\0132\007.Result\022\021\n\tpro" + "Response\022\027\n\006result\030\001 \001(\0132\007.Result\022\021\n\tpro" +
"cessed\030\002 \001(\010\"\250\003\n\004Scan\022\027\n\006column\030\001 \003(\0132\007." + "cessed\030\002 \001(\010\"\271\003\n\004Scan\022\027\n\006column\030\001 \003(\0132\007." +
"Column\022!\n\tattribute\030\002 \003(\0132\016.NameBytesPai" + "Column\022!\n\tattribute\030\002 \003(\0132\016.NameBytesPai" +
"r\022\021\n\tstart_row\030\003 \001(\014\022\020\n\010stop_row\030\004 \001(\014\022\027", "r\022\021\n\tstart_row\030\003 \001(\014\022\020\n\010stop_row\030\004 \001(\014\022\027",
"\n\006filter\030\005 \001(\0132\007.Filter\022\036\n\ntime_range\030\006 " + "\n\006filter\030\005 \001(\0132\007.Filter\022\036\n\ntime_range\030\006 " +
@ -30653,55 +30743,55 @@ public final class ClientProtos {
"re_limit\030\013 \001(\r\022\024\n\014store_offset\030\014 \001(\r\022&\n\036" + "re_limit\030\013 \001(\r\022\024\n\014store_offset\030\014 \001(\r\022&\n\036" +
"load_column_families_on_demand\030\r \001(\010\022\r\n\005" + "load_column_families_on_demand\030\r \001(\010\022\r\n\005" +
"small\030\016 \001(\010\022\027\n\010reversed\030\017 \001(\010:\005false\022)\n\013" + "small\030\016 \001(\010\022\027\n\010reversed\030\017 \001(\010:\005false\022)\n\013" +
"consistency\030\020 \001(\0162\014.Consistency:\006STRONG\"" + "consistency\030\020 \001(\0162\014.Consistency:\006STRONG\022" +
"\236\001\n\013ScanRequest\022 \n\006region\030\001 \001(\0132\020.Region" + "\017\n\007caching\030\021 \001(\r\"\236\001\n\013ScanRequest\022 \n\006regi" +
"Specifier\022\023\n\004scan\030\002 \001(\0132\005.Scan\022\022\n\nscanne", "on\030\001 \001(\0132\020.RegionSpecifier\022\023\n\004scan\030\002 \001(\013",
"r_id\030\003 \001(\004\022\026\n\016number_of_rows\030\004 \001(\r\022\025\n\rcl" + "2\005.Scan\022\022\n\nscanner_id\030\003 \001(\004\022\026\n\016number_of" +
"ose_scanner\030\005 \001(\010\022\025\n\rnext_call_seq\030\006 \001(\004" + "_rows\030\004 \001(\r\022\025\n\rclose_scanner\030\005 \001(\010\022\025\n\rne" +
"\"\210\001\n\014ScanResponse\022\030\n\020cells_per_result\030\001 " + "xt_call_seq\030\006 \001(\004\"\210\001\n\014ScanResponse\022\030\n\020ce" +
"\003(\r\022\022\n\nscanner_id\030\002 \001(\004\022\024\n\014more_results\030" + "lls_per_result\030\001 \003(\r\022\022\n\nscanner_id\030\002 \001(\004" +
"\003 \001(\010\022\013\n\003ttl\030\004 \001(\r\022\030\n\007results\030\005 \003(\0132\007.Re" + "\022\024\n\014more_results\030\003 \001(\010\022\013\n\003ttl\030\004 \001(\r\022\030\n\007r" +
"sult\022\r\n\005stale\030\006 \001(\010\"\263\001\n\024BulkLoadHFileReq" + "esults\030\005 \003(\0132\007.Result\022\r\n\005stale\030\006 \001(\010\"\263\001\n" +
"uest\022 \n\006region\030\001 \002(\0132\020.RegionSpecifier\0225" + "\024BulkLoadHFileRequest\022 \n\006region\030\001 \002(\0132\020." +
"\n\013family_path\030\002 \003(\0132 .BulkLoadHFileReque" + "RegionSpecifier\0225\n\013family_path\030\002 \003(\0132 .B" +
"st.FamilyPath\022\026\n\016assign_seq_num\030\003 \001(\010\032*\n" + "ulkLoadHFileRequest.FamilyPath\022\026\n\016assign" +
"\nFamilyPath\022\016\n\006family\030\001 \002(\014\022\014\n\004path\030\002 \002(", "_seq_num\030\003 \001(\010\032*\n\nFamilyPath\022\016\n\006family\030\001",
"\t\"\'\n\025BulkLoadHFileResponse\022\016\n\006loaded\030\001 \002" + " \002(\014\022\014\n\004path\030\002 \002(\t\"\'\n\025BulkLoadHFileRespo" +
"(\010\"a\n\026CoprocessorServiceCall\022\013\n\003row\030\001 \002(" + "nse\022\016\n\006loaded\030\001 \002(\010\"a\n\026CoprocessorServic" +
"\014\022\024\n\014service_name\030\002 \002(\t\022\023\n\013method_name\030\003" + "eCall\022\013\n\003row\030\001 \002(\014\022\024\n\014service_name\030\002 \002(\t" +
" \002(\t\022\017\n\007request\030\004 \002(\014\"9\n\030CoprocessorServ" + "\022\023\n\013method_name\030\003 \002(\t\022\017\n\007request\030\004 \002(\014\"9" +
"iceResult\022\035\n\005value\030\001 \001(\0132\016.NameBytesPair" + "\n\030CoprocessorServiceResult\022\035\n\005value\030\001 \001(" +
"\"d\n\031CoprocessorServiceRequest\022 \n\006region\030" + "\0132\016.NameBytesPair\"d\n\031CoprocessorServiceR" +
"\001 \002(\0132\020.RegionSpecifier\022%\n\004call\030\002 \002(\0132\027." + "equest\022 \n\006region\030\001 \002(\0132\020.RegionSpecifier" +
"CoprocessorServiceCall\"]\n\032CoprocessorSer" + "\022%\n\004call\030\002 \002(\0132\027.CoprocessorServiceCall\"" +
"viceResponse\022 \n\006region\030\001 \002(\0132\020.RegionSpe" + "]\n\032CoprocessorServiceResponse\022 \n\006region\030" +
"cifier\022\035\n\005value\030\002 \002(\0132\016.NameBytesPair\"{\n", "\001 \002(\0132\020.RegionSpecifier\022\035\n\005value\030\002 \002(\0132\016",
"\006Action\022\r\n\005index\030\001 \001(\r\022 \n\010mutation\030\002 \001(\013" + ".NameBytesPair\"{\n\006Action\022\r\n\005index\030\001 \001(\r\022" +
"2\016.MutationProto\022\021\n\003get\030\003 \001(\0132\004.Get\022-\n\014s" + " \n\010mutation\030\002 \001(\0132\016.MutationProto\022\021\n\003get" +
"ervice_call\030\004 \001(\0132\027.CoprocessorServiceCa" + "\030\003 \001(\0132\004.Get\022-\n\014service_call\030\004 \001(\0132\027.Cop" +
"ll\"Y\n\014RegionAction\022 \n\006region\030\001 \002(\0132\020.Reg" + "rocessorServiceCall\"Y\n\014RegionAction\022 \n\006r" +
"ionSpecifier\022\016\n\006atomic\030\002 \001(\010\022\027\n\006action\030\003" + "egion\030\001 \002(\0132\020.RegionSpecifier\022\016\n\006atomic\030" +
" \003(\0132\007.Action\"\221\001\n\021ResultOrException\022\r\n\005i" + "\002 \001(\010\022\027\n\006action\030\003 \003(\0132\007.Action\"\221\001\n\021Resul" +
"ndex\030\001 \001(\r\022\027\n\006result\030\002 \001(\0132\007.Result\022!\n\te" + "tOrException\022\r\n\005index\030\001 \001(\r\022\027\n\006result\030\002 " +
"xception\030\003 \001(\0132\016.NameBytesPair\0221\n\016servic" + "\001(\0132\007.Result\022!\n\texception\030\003 \001(\0132\016.NameBy" +
"e_result\030\004 \001(\0132\031.CoprocessorServiceResul" + "tesPair\0221\n\016service_result\030\004 \001(\0132\031.Coproc" +
"t\"f\n\022RegionActionResult\022-\n\021resultOrExcep", "essorServiceResult\"f\n\022RegionActionResult",
"tion\030\001 \003(\0132\022.ResultOrException\022!\n\texcept" + "\022-\n\021resultOrException\030\001 \003(\0132\022.ResultOrEx" +
"ion\030\002 \001(\0132\016.NameBytesPair\"G\n\014MultiReques" + "ception\022!\n\texception\030\002 \001(\0132\016.NameBytesPa" +
"t\022#\n\014regionAction\030\001 \003(\0132\r.RegionAction\022\022" + "ir\"G\n\014MultiRequest\022#\n\014regionAction\030\001 \003(\013" +
"\n\nnonceGroup\030\002 \001(\004\"@\n\rMultiResponse\022/\n\022r" + "2\r.RegionAction\022\022\n\nnonceGroup\030\002 \001(\004\"@\n\rM" +
"egionActionResult\030\001 \003(\0132\023.RegionActionRe" + "ultiResponse\022/\n\022regionActionResult\030\001 \003(\013" +
"sult*\'\n\013Consistency\022\n\n\006STRONG\020\000\022\014\n\010TIMEL" + "2\023.RegionActionResult*\'\n\013Consistency\022\n\n\006" +
"INE\020\0012\261\002\n\rClientService\022 \n\003Get\022\013.GetRequ" + "STRONG\020\000\022\014\n\010TIMELINE\020\0012\261\002\n\rClientService" +
"est\032\014.GetResponse\022)\n\006Mutate\022\016.MutateRequ" + "\022 \n\003Get\022\013.GetRequest\032\014.GetResponse\022)\n\006Mu" +
"est\032\017.MutateResponse\022#\n\004Scan\022\014.ScanReque" + "tate\022\016.MutateRequest\032\017.MutateResponse\022#\n" +
"st\032\r.ScanResponse\022>\n\rBulkLoadHFile\022\025.Bul", "\004Scan\022\014.ScanRequest\032\r.ScanResponse\022>\n\rBu",
"kLoadHFileRequest\032\026.BulkLoadHFileRespons" + "lkLoadHFile\022\025.BulkLoadHFileRequest\032\026.Bul" +
"e\022F\n\013ExecService\022\032.CoprocessorServiceReq" + "kLoadHFileResponse\022F\n\013ExecService\022\032.Copr" +
"uest\032\033.CoprocessorServiceResponse\022&\n\005Mul" + "ocessorServiceRequest\032\033.CoprocessorServi" +
"ti\022\r.MultiRequest\032\016.MultiResponseBB\n*org" + "ceResponse\022&\n\005Multi\022\r.MultiRequest\032\016.Mul" +
".apache.hadoop.hbase.protobuf.generatedB" + "tiResponseBB\n*org.apache.hadoop.hbase.pr" +
"\014ClientProtosH\001\210\001\001\240\001\001" "otobuf.generatedB\014ClientProtosH\001\210\001\001\240\001\001"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -30791,7 +30881,7 @@ public final class ClientProtos {
internal_static_Scan_fieldAccessorTable = new internal_static_Scan_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_Scan_descriptor, internal_static_Scan_descriptor,
new java.lang.String[] { "Column", "Attribute", "StartRow", "StopRow", "Filter", "TimeRange", "MaxVersions", "CacheBlocks", "BatchSize", "MaxResultSize", "StoreLimit", "StoreOffset", "LoadColumnFamiliesOnDemand", "Small", "Reversed", "Consistency", }); new java.lang.String[] { "Column", "Attribute", "StartRow", "StopRow", "Filter", "TimeRange", "MaxVersions", "CacheBlocks", "BatchSize", "MaxResultSize", "StoreLimit", "StoreOffset", "LoadColumnFamiliesOnDemand", "Small", "Reversed", "Consistency", "Caching", });
internal_static_ScanRequest_descriptor = internal_static_ScanRequest_descriptor =
getDescriptor().getMessageTypes().get(12); getDescriptor().getMessageTypes().get(12);
internal_static_ScanRequest_fieldAccessorTable = new internal_static_ScanRequest_fieldAccessorTable = new

View File

@ -247,6 +247,7 @@ message Scan {
optional bool small = 14; optional bool small = 14;
optional bool reversed = 15 [default = false]; optional bool reversed = 15 [default = false];
optional Consistency consistency = 16 [default = STRONG]; optional Consistency consistency = 16 [default = STRONG];
optional uint32 caching = 17;
} }
/** /**

View File

@ -291,15 +291,21 @@ public class TestProtobufUtil {
scanBuilder.addColumn(columnBuilder.build()); scanBuilder.addColumn(columnBuilder.build());
ClientProtos.Scan proto = scanBuilder.build(); ClientProtos.Scan proto = scanBuilder.build();
// default fields
// Verify default values
assertEquals(1, proto.getMaxVersions()); assertEquals(1, proto.getMaxVersions());
assertEquals(true, proto.getCacheBlocks()); assertEquals(true, proto.getCacheBlocks());
// Verify fields survive ClientProtos.Scan -> Scan -> ClientProtos.Scan
// conversion
scanBuilder = ClientProtos.Scan.newBuilder(proto); scanBuilder = ClientProtos.Scan.newBuilder(proto);
scanBuilder.setMaxVersions(1); scanBuilder.setMaxVersions(2);
scanBuilder.setCacheBlocks(true); scanBuilder.setCacheBlocks(false);
scanBuilder.setCaching(1024);
ClientProtos.Scan expectedProto = scanBuilder.build();
Scan scan = ProtobufUtil.toScan(proto); ClientProtos.Scan actualProto = ProtobufUtil.toScan(
assertEquals(scanBuilder.build(), ProtobufUtil.toScan(scan)); ProtobufUtil.toScan(expectedProto));
assertEquals(expectedProto, actualProto);
} }
} }