You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2012/04/13 22:28:22 UTC
svn commit: r1325937 [5/7] - in /hbase/trunk/src:
main/java/org/apache/hadoop/hbase/catalog/
main/java/org/apache/hadoop/hbase/client/
main/java/org/apache/hadoop/hbase/filter/
main/java/org/apache/hadoop/hbase/io/
main/java/org/apache/hadoop/hbase/ipc...
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java?rev=1325937&r1=1325936&r2=1325937&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/protobuf/generated/HBaseProtos.java Fri Apr 13 20:28:21 2012
@@ -3080,6 +3080,1018 @@ public final class HBaseProtos {
// @@protoc_insertion_point(class_scope:ServerName)
}
+ public interface NameStringPairOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string name = 1;
+ boolean hasName();
+ String getName();
+
+ // required string value = 2;
+ boolean hasValue();
+ String getValue();
+ }
+ public static final class NameStringPair extends
+ com.google.protobuf.GeneratedMessage
+ implements NameStringPairOrBuilder {
+ // Use NameStringPair.newBuilder() to construct.
+ private NameStringPair(Builder builder) {
+ super(builder);
+ }
+ private NameStringPair(boolean noInit) {}
+
+ private static final NameStringPair defaultInstance;
+ public static NameStringPair getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NameStringPair getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameStringPair_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameStringPair_fieldAccessorTable;
+ }
+
+ private int bitField0_;
+ // required string name = 1;
+ public static final int NAME_FIELD_NUMBER = 1;
+ private java.lang.Object name_;
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ if (com.google.protobuf.Internal.isValidUtf8(bs)) {
+ name_ = s;
+ }
+ return s;
+ }
+ }
+ private com.google.protobuf.ByteString getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // required string value = 2;
+ public static final int VALUE_FIELD_NUMBER = 2;
+ private java.lang.Object value_;
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public String getValue() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ if (com.google.protobuf.Internal.isValidUtf8(bs)) {
+ value_ = s;
+ }
+ return s;
+ }
+ }
+ private com.google.protobuf.ByteString getValueBytes() {
+ java.lang.Object ref = value_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((String) ref);
+ value_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ name_ = "";
+ value_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasValue()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getValueBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, getValueBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair)) {
+ return super.equals(obj);
+ }
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair other = (org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair) obj;
+
+ boolean result = true;
+ result = result && (hasName() == other.hasName());
+ if (hasName()) {
+ result = result && getName()
+ .equals(other.getName());
+ }
+ result = result && (hasValue() == other.hasValue());
+ if (hasValue()) {
+ result = result && getValue()
+ .equals(other.getValue());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasName()) {
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ }
+ if (hasValue()) {
+ hash = (37 * hash) + VALUE_FIELD_NUMBER;
+ hash = (53 * hash) + getValue().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ return hash;
+ }
+
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPairOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameStringPair_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameStringPair_fieldAccessorTable;
+ }
+
+ // Construct using org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ value_ = "";
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.getDescriptor();
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair getDefaultInstanceForType() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.getDefaultInstance();
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair build() {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return result;
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair buildPartial() {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair result = new org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.name_ = name_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.value_ = value_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair) {
+ return mergeFrom((org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair other) {
+ if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.getDefaultInstance()) return this;
+ if (other.hasName()) {
+ setName(other.getName());
+ }
+ if (other.hasValue()) {
+ setValue(other.getValue());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasName()) {
+
+ return false;
+ }
+ if (!hasValue()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder(
+ this.getUnknownFields());
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ name_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ value_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ }
+
+ private int bitField0_;
+
+ // required string name = 1;
+ private java.lang.Object name_ = "";
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof String)) {
+ String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+ public Builder setName(String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ void setName(com.google.protobuf.ByteString value) {
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ }
+
+ // required string value = 2;
+ private java.lang.Object value_ = "";
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public String getValue() {
+ java.lang.Object ref = value_;
+ if (!(ref instanceof String)) {
+ String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
+ value_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+ public Builder setValue(String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+ void setValue(com.google.protobuf.ByteString value) {
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ }
+
+ // @@protoc_insertion_point(builder_scope:NameStringPair)
+ }
+
+ static {
+ defaultInstance = new NameStringPair(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:NameStringPair)
+ }
+
+ public interface NameBytesPairOrBuilder
+ extends com.google.protobuf.MessageOrBuilder {
+
+ // required string name = 1;
+ boolean hasName();
+ String getName();
+
+ // optional bytes value = 2;
+ boolean hasValue();
+ com.google.protobuf.ByteString getValue();
+ }
+ public static final class NameBytesPair extends
+ com.google.protobuf.GeneratedMessage
+ implements NameBytesPairOrBuilder {
+ // Use NameBytesPair.newBuilder() to construct.
+ private NameBytesPair(Builder builder) {
+ super(builder);
+ }
+ private NameBytesPair(boolean noInit) {}
+
+ private static final NameBytesPair defaultInstance;
+ public static NameBytesPair getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public NameBytesPair getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameBytesPair_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameBytesPair_fieldAccessorTable;
+ }
+
+ private int bitField0_;
+ // required string name = 1;
+ public static final int NAME_FIELD_NUMBER = 1;
+ private java.lang.Object name_;
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public String getName() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ return (String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ String s = bs.toStringUtf8();
+ if (com.google.protobuf.Internal.isValidUtf8(bs)) {
+ name_ = s;
+ }
+ return s;
+ }
+ }
+ private com.google.protobuf.ByteString getNameBytes() {
+ java.lang.Object ref = name_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8((String) ref);
+ name_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ // optional bytes value = 2;
+ public static final int VALUE_FIELD_NUMBER = 2;
+ private com.google.protobuf.ByteString value_;
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public com.google.protobuf.ByteString getValue() {
+ return value_;
+ }
+
+ private void initFields() {
+ name_ = "";
+ value_ = com.google.protobuf.ByteString.EMPTY;
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasName()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, value_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(1, getNameBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(2, value_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair)) {
+ return super.equals(obj);
+ }
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair other = (org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair) obj;
+
+ boolean result = true;
+ result = result && (hasName() == other.hasName());
+ if (hasName()) {
+ result = result && getName()
+ .equals(other.getName());
+ }
+ result = result && (hasValue() == other.hasValue());
+ if (hasValue()) {
+ result = result && getValue()
+ .equals(other.getValue());
+ }
+ result = result &&
+ getUnknownFields().equals(other.getUnknownFields());
+ return result;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ int hash = 41;
+ hash = (19 * hash) + getDescriptorForType().hashCode();
+ if (hasName()) {
+ hash = (37 * hash) + NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getName().hashCode();
+ }
+ if (hasValue()) {
+ hash = (37 * hash) + VALUE_FIELD_NUMBER;
+ hash = (53 * hash) + getValue().hashCode();
+ }
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ return hash;
+ }
+
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder<Builder>
+ implements org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPairOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameBytesPair_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.internal_static_NameBytesPair_fieldAccessorTable;
+ }
+
+ // Construct using org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
+ }
+ }
+ private static Builder create() {
+ return new Builder();
+ }
+
+ public Builder clear() {
+ super.clear();
+ name_ = "";
+ bitField0_ = (bitField0_ & ~0x00000001);
+ value_ = com.google.protobuf.ByteString.EMPTY;
+ bitField0_ = (bitField0_ & ~0x00000002);
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(buildPartial());
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.getDescriptor();
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair getDefaultInstanceForType() {
+ return org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.getDefaultInstance();
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair build() {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ private org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return result;
+ }
+
+ public org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair buildPartial() {
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair result = new org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair(this);
+ int from_bitField0_ = bitField0_;
+ int to_bitField0_ = 0;
+ if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
+ to_bitField0_ |= 0x00000001;
+ }
+ result.name_ = name_;
+ if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
+ to_bitField0_ |= 0x00000002;
+ }
+ result.value_ = value_;
+ result.bitField0_ = to_bitField0_;
+ onBuilt();
+ return result;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair) {
+ return mergeFrom((org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair other) {
+ if (other == org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.getDefaultInstance()) return this;
+ if (other.hasName()) {
+ setName(other.getName());
+ }
+ if (other.hasValue()) {
+ setValue(other.getValue());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ public final boolean isInitialized() {
+ if (!hasName()) {
+
+ return false;
+ }
+ return true;
+ }
+
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ com.google.protobuf.UnknownFieldSet.Builder unknownFields =
+ com.google.protobuf.UnknownFieldSet.newBuilder(
+ this.getUnknownFields());
+ while (true) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ onChanged();
+ return this;
+ }
+ break;
+ }
+ case 10: {
+ bitField0_ |= 0x00000001;
+ name_ = input.readBytes();
+ break;
+ }
+ case 18: {
+ bitField0_ |= 0x00000002;
+ value_ = input.readBytes();
+ break;
+ }
+ }
+ }
+ }
+
+ private int bitField0_;
+
+ // required string name = 1;
+ private java.lang.Object name_ = "";
+ public boolean hasName() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ public String getName() {
+ java.lang.Object ref = name_;
+ if (!(ref instanceof String)) {
+ String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
+ name_ = s;
+ return s;
+ } else {
+ return (String) ref;
+ }
+ }
+ public Builder setName(String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearName() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ name_ = getDefaultInstance().getName();
+ onChanged();
+ return this;
+ }
+ void setName(com.google.protobuf.ByteString value) {
+ bitField0_ |= 0x00000001;
+ name_ = value;
+ onChanged();
+ }
+
+ // optional bytes value = 2;
+ private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY;
+ public boolean hasValue() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ public com.google.protobuf.ByteString getValue() {
+ return value_;
+ }
+ public Builder setValue(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ value_ = value;
+ onChanged();
+ return this;
+ }
+ public Builder clearValue() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ value_ = getDefaultInstance().getValue();
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:NameBytesPair)
+ }
+
+ static {
+ defaultInstance = new NameBytesPair(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:NameBytesPair)
+ }
+
private static com.google.protobuf.Descriptors.Descriptor
internal_static_RegionInfo_descriptor;
private static
@@ -3105,6 +4117,16 @@ public final class HBaseProtos {
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_ServerName_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_NameStringPair_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_NameStringPair_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_NameBytesPair_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_NameBytesPair_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
@@ -3126,11 +4148,14 @@ public final class HBaseProtos {
"(\014\022\021\n\tqualifier\030\003 \002(\014\022\021\n\ttimestamp\030\004 \001(\004",
"\022\031\n\007keyType\030\005 \001(\0162\010.KeyType\022\r\n\005value\030\006 \001" +
"(\014\"?\n\nServerName\022\020\n\010hostName\030\001 \002(\t\022\014\n\004po" +
- "rt\030\002 \001(\r\022\021\n\tstartCode\030\003 \001(\004*_\n\007KeyType\022\013" +
- "\n\007MINIMUM\020\000\022\007\n\003PUT\020\004\022\n\n\006DELETE\020\010\022\021\n\rDELE" +
- "TE_COLUMN\020\014\022\021\n\rDELETE_FAMILY\020\016\022\014\n\007MAXIMU" +
- "M\020\377\001B>\n*org.apache.hadoop.hbase.protobuf" +
- ".generatedB\013HBaseProtosH\001\240\001\001"
+ "rt\030\002 \001(\r\022\021\n\tstartCode\030\003 \001(\004\"-\n\016NameStrin" +
+ "gPair\022\014\n\004name\030\001 \002(\t\022\r\n\005value\030\002 \002(\t\",\n\rNa" +
+ "meBytesPair\022\014\n\004name\030\001 \002(\t\022\r\n\005value\030\002 \001(\014" +
+ "*_\n\007KeyType\022\013\n\007MINIMUM\020\000\022\007\n\003PUT\020\004\022\n\n\006DEL" +
+ "ETE\020\010\022\021\n\rDELETE_COLUMN\020\014\022\021\n\rDELETE_FAMIL" +
+ "Y\020\016\022\014\n\007MAXIMUM\020\377\001B>\n*org.apache.hadoop.h" +
+ "base.protobuf.generatedB\013HBaseProtosH\001\240\001" +
+ "\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -3177,6 +4202,22 @@ public final class HBaseProtos {
new java.lang.String[] { "HostName", "Port", "StartCode", },
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.class,
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ServerName.Builder.class);
+ internal_static_NameStringPair_descriptor =
+ getDescriptor().getMessageTypes().get(5);
+ internal_static_NameStringPair_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_NameStringPair_descriptor,
+ new java.lang.String[] { "Name", "Value", },
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.class,
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair.Builder.class);
+ internal_static_NameBytesPair_descriptor =
+ getDescriptor().getMessageTypes().get(6);
+ internal_static_NameBytesPair_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_NameBytesPair_descriptor,
+ new java.lang.String[] { "Name", "Value", },
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.class,
+ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.Builder.class);
return null;
}
};
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1325937&r1=1325936&r2=1325937&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Fri Apr 13 20:28:21 2012
@@ -40,11 +40,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Random;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -119,7 +117,7 @@ import org.apache.hadoop.hbase.ipc.Invoc
import org.apache.hadoop.hbase.ipc.ProtocolSignature;
import org.apache.hadoop.hbase.ipc.RpcServer;
import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException;
-import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException;
+import org.apache.hadoop.hbase.protobuf.ClientProtocol;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionProgress;
import org.apache.hadoop.hbase.regionserver.handler.CloseMetaHandler;
import org.apache.hadoop.hbase.regionserver.handler.CloseRegionHandler;
@@ -139,7 +137,6 @@ import org.apache.hadoop.hbase.util.Byte
import org.apache.hadoop.hbase.util.CompressionTest;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.FSTableDescriptors;
-import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.util.InfoServer;
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.Sleeper;
@@ -170,36 +167,22 @@ import com.google.common.collect.Lists;
* the HMaster. There are many HRegionServers in a single HBase deployment.
*/
@InterfaceAudience.Private
-public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
- Runnable, RegionServerServices {
+public class HRegionServer extends RegionServer
+ implements HRegionInterface, HBaseRPCErrorHandler {
public static final Log LOG = LogFactory.getLog(HRegionServer.class);
- // Set when a report to the master comes back with a message asking us to
- // shutdown. Also set by call to stop when debugging or running unit tests
- // of HRegionServer in isolation.
- protected volatile boolean stopped = false;
-
// A state before we go into stopped state. At this stage we're closing user
// space regions.
private boolean stopping = false;
- // Go down hard. Used if file system becomes unavailable and also in
- // debugging and unit tests.
- protected volatile boolean abortRequested;
-
private volatile boolean killed = false;
- // If false, the file system has become unavailable
- protected volatile boolean fsOk;
-
protected final Configuration conf;
protected final AtomicBoolean haveRootRegion = new AtomicBoolean(false);
- private HFileSystem fs;
private boolean useHBaseChecksum; // verify hbase checksums?
private Path rootDir;
- private final Random rand = new Random();
//RegionName vs current action in progress
//true - if open region action in progress
@@ -207,13 +190,6 @@ public class HRegionServer implements HR
private final ConcurrentSkipListMap<byte[], Boolean> regionsInTransitionInRS =
new ConcurrentSkipListMap<byte[], Boolean>(Bytes.BYTES_COMPARATOR);
- /**
- * Map of regions currently being served by this region server. Key is the
- * encoded region name. All access should be synchronized.
- */
- protected final Map<String, HRegion> onlineRegions =
- new ConcurrentHashMap<String, HRegion>();
-
protected final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
final int numRetries;
@@ -222,8 +198,6 @@ public class HRegionServer implements HR
protected final int numRegionsToReport;
- private final long maxScannerResultSize;
-
// Remote HMaster
private HMasterRegionInterface hbaseMaster;
@@ -233,13 +207,6 @@ public class HRegionServer implements HR
private final InetSocketAddress isa;
- // Leases
- private Leases leases;
-
- // Request counter.
- // Do we need this? Can't we just sum region counters? St.Ack 20110412
- private AtomicInteger requestCount = new AtomicInteger();
-
// Info server. Default access so can be used by unit tests. REGIONSERVER
// is name of the webapp and the attribute name used stuffing this instance
// into web context.
@@ -263,9 +230,6 @@ public class HRegionServer implements HR
// Compactions
public CompactSplitThread compactSplitThread;
- // Cache flushing
- MemStoreFlusher cacheFlusher;
-
/*
* Check for compactions requests.
*/
@@ -279,9 +243,6 @@ public class HRegionServer implements HR
// flag set after we're done setting up server threads (used for testing)
protected volatile boolean isOnline;
- final Map<String, RegionScanner> scanners =
- new ConcurrentHashMap<String, RegionScanner>();
-
// zookeeper connection and watcher
private ZooKeeperWatcher zooKeeper;
@@ -405,8 +366,10 @@ public class HRegionServer implements HR
if (initialIsa.getAddress() == null) {
throw new IllegalArgumentException("Failed resolve of " + initialIsa);
}
+
this.rpcServer = HBaseRPC.getServer(this,
- new Class<?>[]{HRegionInterface.class, HBaseRPCErrorHandler.class,
+ new Class<?>[]{HRegionInterface.class, ClientProtocol.class,
+ HBaseRPCErrorHandler.class,
OnlineRegions.class},
initialIsa.getHostName(), // BindAddress is IP we got for this server.
initialIsa.getPort(),
@@ -445,12 +408,8 @@ public class HRegionServer implements HR
}
}
- private static final int NORMAL_QOS = 0;
- private static final int QOS_THRESHOLD = 10; // the line between low and high qos
- private static final int HIGH_QOS = 100;
-
@Retention(RetentionPolicy.RUNTIME)
- private @interface QosPriority {
+ protected @interface QosPriority {
int priority() default 0;
}
@@ -648,7 +607,7 @@ public class HRegionServer implements HR
// Create the thread for the ThriftServer.
if (conf.getBoolean("hbase.regionserver.export.thrift", false)) {
- thriftServer = new HRegionThriftServer(this, conf);
+ thriftServer = new HRegionThriftServer((RegionServer)this, conf);
thriftServer.start();
LOG.info("Started Thrift API from Region Server.");
}
@@ -1081,110 +1040,6 @@ public class HRegionServer implements HR
}
/*
- * Cleanup after Throwable caught invoking method. Converts <code>t</code> to
- * IOE if it isn't already.
- *
- * @param t Throwable
- *
- * @return Throwable converted to an IOE; methods can only let out IOEs.
- */
- private Throwable cleanup(final Throwable t) {
- return cleanup(t, null);
- }
-
- /*
- * Cleanup after Throwable caught invoking method. Converts <code>t</code> to
- * IOE if it isn't already.
- *
- * @param t Throwable
- *
- * @param msg Message to log in error. Can be null.
- *
- * @return Throwable converted to an IOE; methods can only let out IOEs.
- */
- private Throwable cleanup(final Throwable t, final String msg) {
- // Don't log as error if NSRE; NSRE is 'normal' operation.
- if (t instanceof NotServingRegionException) {
- LOG.debug("NotServingRegionException; " + t.getMessage());
- return t;
- }
- if (msg == null) {
- LOG.error("", RemoteExceptionHandler.checkThrowable(t));
- } else {
- LOG.error(msg, RemoteExceptionHandler.checkThrowable(t));
- }
- if (!checkOOME(t)) {
- checkFileSystem();
- }
- return t;
- }
-
- /*
- * @param t
- *
- * @return Make <code>t</code> an IOE if it isn't already.
- */
- private IOException convertThrowableToIOE(final Throwable t) {
- return convertThrowableToIOE(t, null);
- }
-
- /*
- * @param t
- *
- * @param msg Message to put in new IOE if passed <code>t</code> is not an IOE
- *
- * @return Make <code>t</code> an IOE if it isn't already.
- */
- private IOException convertThrowableToIOE(final Throwable t, final String msg) {
- return (t instanceof IOException ? (IOException) t : msg == null
- || msg.length() == 0 ? new IOException(t) : new IOException(msg, t));
- }
-
- /*
- * Check if an OOME and, if so, abort immediately to avoid creating more objects.
- *
- * @param e
- *
- * @return True if we OOME'd and are aborting.
- */
- public boolean checkOOME(final Throwable e) {
- boolean stop = false;
- try {
- if (e instanceof OutOfMemoryError
- || (e.getCause() != null && e.getCause() instanceof OutOfMemoryError)
- || (e.getMessage() != null && e.getMessage().contains(
- "java.lang.OutOfMemoryError"))) {
- stop = true;
- LOG.fatal(
- "Run out of memory; HRegionServer will abort itself immediately", e);
- }
- } finally {
- if (stop) {
- Runtime.getRuntime().halt(1);
- }
- }
- return stop;
- }
-
- /**
- * Checks to see if the file system is still accessible. If not, sets
- * abortRequested and stopRequested
- *
- * @return false if file system is not available
- */
- public boolean checkFileSystem() {
- if (this.fsOk && this.fs != null) {
- try {
- FSUtils.checkFileSystemAvailable(this.fs);
- } catch (IOException e) {
- abort("File System not available", e);
- this.fsOk = false;
- }
- }
- return this.fsOk;
- }
-
- /*
* Inner class that runs on a long period checking if regions need compaction.
*/
private static class CompactionChecker extends Chore {
@@ -2334,15 +2189,6 @@ public class HRegionServer implements HR
}
}
- protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
- long scannerId = -1L;
- scannerId = rand.nextLong();
- String scannerName = String.valueOf(scannerId);
- scanners.put(scannerName, s);
- this.leases.createLease(scannerName, new ScannerListener(scannerName));
- return scannerId;
- }
-
public Result next(final long scannerId) throws IOException {
Result[] res = next(scannerId, 1);
if (res == null || res.length == 0) {
@@ -2468,42 +2314,6 @@ public class HRegionServer implements HR
}
}
- /**
- * Instantiated as a scanner lease. If the lease times out, the scanner is
- * closed
- */
- private class ScannerListener implements LeaseListener {
- private final String scannerName;
-
- ScannerListener(final String n) {
- this.scannerName = n;
- }
-
- public void leaseExpired() {
- RegionScanner s = scanners.remove(this.scannerName);
- if (s != null) {
- LOG.info("Scanner " + this.scannerName + " lease expired on region "
- + s.getRegionInfo().getRegionNameAsString());
- try {
- HRegion region = getRegion(s.getRegionInfo().getRegionName());
- if (region != null && region.getCoprocessorHost() != null) {
- region.getCoprocessorHost().preScannerClose(s);
- }
-
- s.close();
- if (region != null && region.getCoprocessorHost() != null) {
- region.getCoprocessorHost().postScannerClose(s);
- }
- } catch (IOException e) {
- LOG.error("Closing scanner for "
- + s.getRegionInfo().getRegionNameAsString(), e);
- }
- } else {
- LOG.info("Scanner " + this.scannerName + " lease expired");
- }
- }
- }
-
//
// Methods that do the actual work for the remote API
//
@@ -2585,39 +2395,6 @@ public class HRegionServer implements HR
}
}
- protected long addRowLock(Integer r, HRegion region)
- throws LeaseStillHeldException {
- long lockId = -1L;
- lockId = rand.nextLong();
- String lockName = String.valueOf(lockId);
- rowlocks.put(lockName, r);
- this.leases.createLease(lockName, new RowLockListener(lockName, region));
- return lockId;
- }
-
- /**
- * Method to get the Integer lock identifier used internally from the long
- * lock identifier used by the client.
- *
- * @param lockId
- * long row lock identifier from client
- * @return intId Integer row lock used internally in HRegion
- * @throws IOException
- * Thrown if this is not a valid client lock id.
- */
- Integer getLockFromId(long lockId) throws IOException {
- if (lockId == -1L) {
- return null;
- }
- String lockName = String.valueOf(lockId);
- Integer rl = rowlocks.get(lockName);
- if (rl == null) {
- throw new UnknownRowLockException("Invalid row lock");
- }
- this.leases.renewLease(lockName);
- return rl;
- }
-
@Override
@QosPriority(priority=HIGH_QOS)
public void unlockRow(byte[] regionName, long lockId) throws IOException {
@@ -2663,30 +2440,6 @@ public class HRegionServer implements HR
return region.bulkLoadHFiles(familyPaths);
}
- Map<String, Integer> rowlocks = new ConcurrentHashMap<String, Integer>();
-
- /**
- * Instantiated as a row lock lease. If the lease times out, the row lock is
- * released
- */
- private class RowLockListener implements LeaseListener {
- private final String lockName;
- private final HRegion region;
-
- RowLockListener(final String lockName, final HRegion region) {
- this.lockName = lockName;
- this.region = region;
- }
-
- public void leaseExpired() {
- LOG.info("Row Lock " + this.lockName + " lease expired");
- Integer r = rowlocks.remove(this.lockName);
- if (r != null) {
- region.releaseRowLock(r);
- }
- }
- }
-
// Region open/close direct RPCs
@Override
@@ -3057,15 +2810,6 @@ public class HRegionServer implements HR
return r;
}
- /**
- * @param regionName
- * @return HRegion for the passed binary <code>regionName</code> or null if
- * named region is not member of the online regions.
- */
- public HRegion getOnlineRegion(final byte[] regionName) {
- return getFromOnlineRegions(HRegionInfo.encodeRegionName(regionName));
- }
-
/** @return the request count */
public AtomicInteger getRequestCount() {
return this.requestCount;
@@ -3084,25 +2828,6 @@ public class HRegionServer implements HR
}
/**
- * Protected utility method for safely obtaining an HRegion handle.
- *
- * @param regionName
- * Name of online {@link HRegion} to return
- * @return {@link HRegion} for <code>regionName</code>
- * @throws NotServingRegionException
- */
- protected HRegion getRegion(final byte[] regionName)
- throws NotServingRegionException {
- HRegion region = null;
- region = getOnlineRegion(regionName);
- if (region == null) {
- throw new NotServingRegionException("Region is not online: " +
- Bytes.toStringBinary(regionName));
- }
- return region;
- }
-
- /**
* Get the top N most loaded regions this server is serving so we can tell the
* master which regions it can reallocate if we're overloaded. TODO: actually
* calculate which regions are most loaded. (Right now, we're just grabbing
@@ -3123,21 +2848,6 @@ public class HRegionServer implements HR
return regions.toArray(new HRegionInfo[regions.size()]);
}
- /**
- * Called to verify that this server is up and running.
- *
- * @throws IOException
- */
- protected void checkOpen() throws IOException {
- if (this.stopped || this.abortRequested) {
- throw new RegionServerStoppedException("Server " + getServerName() +
- " not running" + (this.abortRequested ? ", aborting" : ""));
- }
- if (!fsOk) {
- throw new RegionServerStoppedException("File system not available");
- }
- }
-
@Override
@QosPriority(priority=HIGH_QOS)
public ProtocolSignature getProtocolSignature(
@@ -3145,6 +2855,8 @@ public class HRegionServer implements HR
throws IOException {
if (protocol.equals(HRegionInterface.class.getName())) {
return new ProtocolSignature(HRegionInterface.VERSION, null);
+ } else if (protocol.equals(ClientProtocol.class.getName())) {
+ return new ProtocolSignature(ClientProtocol.VERSION, null);
}
throw new IOException("Unknown protocol: " + protocol);
}
@@ -3155,6 +2867,8 @@ public class HRegionServer implements HR
throws IOException {
if (protocol.equals(HRegionInterface.class.getName())) {
return HRegionInterface.VERSION;
+ } else if (protocol.equals(ClientProtocol.class.getName())) {
+ return ClientProtocol.VERSION;
}
throw new IOException("Unknown protocol: " + protocol);
}
@@ -3687,4 +3401,4 @@ public class HRegionServer implements HR
mxBeanInfo);
LOG.info("Registered RegionServer MXBean");
}
-}
\ No newline at end of file
+}
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java?rev=1325937&r1=1325936&r2=1325937&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java Fri Apr 13 20:28:21 2012
@@ -36,11 +36,17 @@ import org.apache.hadoop.hbase.NotServin
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.protobuf.RequestConverter;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.GetRequest;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.GetResponse;
import org.apache.hadoop.hbase.thrift.ThriftServerRunner;
import org.apache.hadoop.hbase.thrift.ThriftUtilities;
import org.apache.hadoop.hbase.thrift.generated.IOError;
import org.apache.hadoop.hbase.thrift.generated.TRowResult;
+import com.google.protobuf.ServiceException;
+
/**
* HRegionThriftServer - this class starts up a Thrift server in the same
* JVM where the RegionServer is running. It inherits most of the
@@ -56,14 +62,14 @@ public class HRegionThriftServer extends
public static final Log LOG = LogFactory.getLog(HRegionThriftServer.class);
- private final HRegionServer rs;
+ private final RegionServer rs;
private final ThriftServerRunner serverRunner;
/**
* Create an instance of the glue object that connects the
* RegionServer with the standard ThriftServer implementation
*/
- HRegionThriftServer(HRegionServer regionServer, Configuration conf)
+ HRegionThriftServer(RegionServer regionServer, Configuration conf)
throws IOException {
super("Region Thrift Server");
this.rs = regionServer;
@@ -130,7 +136,10 @@ public class HRegionThriftServer extends
if (columns == null) {
Get get = new Get(row);
get.setTimeRange(Long.MIN_VALUE, timestamp);
- Result result = rs.get(regionName, get);
+ GetRequest request =
+ RequestConverter.buildGetRequest(regionName, get);
+ GetResponse response = rs.get(null, request);
+ Result result = ProtobufUtil.toResult(response.getResult());
return ThriftUtilities.rowResultFromHBase(result);
}
Get get = new Get(row);
@@ -143,7 +152,10 @@ public class HRegionThriftServer extends
}
}
get.setTimeRange(Long.MIN_VALUE, timestamp);
- Result result = rs.get(regionName, get);
+ GetRequest request =
+ RequestConverter.buildGetRequest(regionName, get);
+ GetResponse response = rs.get(null, request);
+ Result result = ProtobufUtil.toResult(response.getResult());
return ThriftUtilities.rowResultFromHBase(result);
} catch (NotServingRegionException e) {
if (!redirect) {
@@ -153,6 +165,10 @@ public class HRegionThriftServer extends
LOG.debug("ThriftServer redirecting getRowWithColumnsTs");
return super.getRowWithColumnsTs(tableName, rowb, columns, timestamp,
attributes);
+ } catch (ServiceException se) {
+ IOException e = ProtobufUtil.getRemoteException(se);
+ LOG.warn(e.getMessage(), e);
+ throw new IOError(e.getMessage());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java?rev=1325937&r1=1325936&r2=1325937&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/Leases.java Fri Apr 13 20:28:21 2012
@@ -55,7 +55,7 @@ import java.io.IOException;
@InterfaceAudience.Private
public class Leases extends HasThread {
private static final Log LOG = LogFactory.getLog(Leases.class.getName());
- private final int leasePeriod;
+ protected final int leasePeriod;
private final int leaseCheckFrequency;
private volatile DelayQueue<Lease> leaseQueue = new DelayQueue<Lease>();
protected final Map<String, Lease> leases = new HashMap<String, Lease>();