From 0d8683507bc027e1e740614e64ca06dea651800c Mon Sep 17 00:00:00 2001 From: Reid Chan Date: Wed, 15 Apr 2020 19:20:14 +0800 Subject: [PATCH] HBASE-24112 [RSGroup] Support renaming rsgroup (#1467) Signed-off-by: Duo Zhang Signed-off-by: stack --- .../generated/RSGroupAdminProtos.java | 1181 ++++++++++++++++- .../src/main/protobuf/RSGroupAdmin.proto | 11 + .../hadoop/hbase/rsgroup/RSGroupAdmin.java | 7 + .../hbase/rsgroup/RSGroupAdminClient.java | 13 + .../hbase/rsgroup/RSGroupAdminEndpoint.java | 33 + .../hbase/rsgroup/RSGroupAdminServer.java | 7 + .../hbase/rsgroup/RSGroupInfoManager.java | 7 + .../hbase/rsgroup/RSGroupInfoManagerImpl.java | 17 + .../hbase/rsgroup/TestRSGroupsAdmin1.java | 48 + .../hbase/rsgroup/TestRSGroupsBase.java | 16 + .../rsgroup/VerifyingRSGroupAdminClient.java | 6 + .../BaseMasterAndRegionObserver.java | 11 + .../hbase/coprocessor/BaseMasterObserver.java | 10 + .../hbase/coprocessor/MasterObserver.java | 21 + .../hbase/master/MasterCoprocessorHost.java | 26 + .../hbase/coprocessor/TestMasterObserver.java | 9 + 16 files changed, 1395 insertions(+), 28 deletions(-) diff --git a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/RSGroupAdminProtos.java b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/RSGroupAdminProtos.java index 2d8415c9f9d..9577e9f6779 100644 --- a/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/RSGroupAdminProtos.java +++ b/hbase-protocol/src/main/java/org/apache/hadoop/hbase/protobuf/generated/RSGroupAdminProtos.java @@ -13428,6 +13428,1034 @@ public final class RSGroupAdminProtos { // @@protoc_insertion_point(class_scope:hbase.pb.RemoveServersResponse) } + public interface RenameRSGroupRequestOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string old_rsgroup_name = 1; + /** + * required string old_rsgroup_name = 1; + */ + boolean hasOldRsgroupName(); + /** + * required string old_rsgroup_name = 1; + */ + java.lang.String getOldRsgroupName(); + /** + * required string old_rsgroup_name = 1; + */ + com.google.protobuf.ByteString + getOldRsgroupNameBytes(); + + // required string new_rsgroup_name = 2; + /** + * required string new_rsgroup_name = 2; + */ + boolean hasNewRsgroupName(); + /** + * required string new_rsgroup_name = 2; + */ + java.lang.String getNewRsgroupName(); + /** + * required string new_rsgroup_name = 2; + */ + com.google.protobuf.ByteString + getNewRsgroupNameBytes(); + } + /** + * Protobuf type {@code hbase.pb.RenameRSGroupRequest} + */ + public static final class RenameRSGroupRequest extends + com.google.protobuf.GeneratedMessage + implements RenameRSGroupRequestOrBuilder { + // Use RenameRSGroupRequest.newBuilder() to construct. + private RenameRSGroupRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private RenameRSGroupRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final RenameRSGroupRequest defaultInstance; + public static RenameRSGroupRequest getDefaultInstance() { + return defaultInstance; + } + + public RenameRSGroupRequest getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RenameRSGroupRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + oldRsgroupName_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + newRsgroupName_ = input.readBytes(); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.class, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public RenameRSGroupRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RenameRSGroupRequest(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string old_rsgroup_name = 1; + public static final int OLD_RSGROUP_NAME_FIELD_NUMBER = 1; + private java.lang.Object oldRsgroupName_; + /** + * required string old_rsgroup_name = 1; + */ + public boolean hasOldRsgroupName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string old_rsgroup_name = 1; + */ + public java.lang.String getOldRsgroupName() { + java.lang.Object ref = oldRsgroupName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + oldRsgroupName_ = s; + } + return s; + } + } + /** + * required string old_rsgroup_name = 1; + */ + public com.google.protobuf.ByteString + getOldRsgroupNameBytes() { + java.lang.Object ref = oldRsgroupName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oldRsgroupName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string new_rsgroup_name = 2; + public static final int NEW_RSGROUP_NAME_FIELD_NUMBER = 2; + private java.lang.Object newRsgroupName_; + /** + * required string new_rsgroup_name = 2; + */ + public boolean hasNewRsgroupName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string new_rsgroup_name = 2; + */ + public java.lang.String getNewRsgroupName() { + java.lang.Object ref = newRsgroupName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + newRsgroupName_ = s; + } + return s; + } + } + /** + * required string new_rsgroup_name = 2; + */ + public com.google.protobuf.ByteString + getNewRsgroupNameBytes() { + java.lang.Object ref = newRsgroupName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + newRsgroupName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private void initFields() { + oldRsgroupName_ = ""; + newRsgroupName_ = ""; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasOldRsgroupName()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasNewRsgroupName()) { + 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, getOldRsgroupNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getNewRsgroupNameBytes()); + } + 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, getOldRsgroupNameBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getNewRsgroupNameBytes()); + } + 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.RSGroupAdminProtos.RenameRSGroupRequest)) { + return super.equals(obj); + } + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest other = (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest) obj; + + boolean result = true; + result = result && (hasOldRsgroupName() == other.hasOldRsgroupName()); + if (hasOldRsgroupName()) { + result = result && getOldRsgroupName() + .equals(other.getOldRsgroupName()); + } + result = result && (hasNewRsgroupName() == other.hasNewRsgroupName()); + if (hasNewRsgroupName()) { + result = result && getNewRsgroupName() + .equals(other.getNewRsgroupName()); + } + result = result && + getUnknownFields().equals(other.getUnknownFields()); + return result; + } + + private int memoizedHashCode = 0; + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptorForType().hashCode(); + if (hasOldRsgroupName()) { + hash = (37 * hash) + OLD_RSGROUP_NAME_FIELD_NUMBER; + hash = (53 * hash) + getOldRsgroupName().hashCode(); + } + if (hasNewRsgroupName()) { + hash = (37 * hash) + NEW_RSGROUP_NAME_FIELD_NUMBER; + hash = (53 * hash) + getNewRsgroupName().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest 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; + } + /** + * Protobuf type {@code hbase.pb.RenameRSGroupRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupRequest_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.class, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.Builder.class); + } + + // Construct using org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.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(); + oldRsgroupName_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + newRsgroupName_ = ""; + 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.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupRequest_descriptor; + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest getDefaultInstanceForType() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.getDefaultInstance(); + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest build() { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest buildPartial() { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest result = new org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.oldRsgroupName_ = oldRsgroupName_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.newRsgroupName_ = newRsgroupName_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest) { + return mergeFrom((org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest other) { + if (other == org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.getDefaultInstance()) return this; + if (other.hasOldRsgroupName()) { + bitField0_ |= 0x00000001; + oldRsgroupName_ = other.oldRsgroupName_; + onChanged(); + } + if (other.hasNewRsgroupName()) { + bitField0_ |= 0x00000002; + newRsgroupName_ = other.newRsgroupName_; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasOldRsgroupName()) { + + return false; + } + if (!hasNewRsgroupName()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // required string old_rsgroup_name = 1; + private java.lang.Object oldRsgroupName_ = ""; + /** + * required string old_rsgroup_name = 1; + */ + public boolean hasOldRsgroupName() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * required string old_rsgroup_name = 1; + */ + public java.lang.String getOldRsgroupName() { + java.lang.Object ref = oldRsgroupName_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + oldRsgroupName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string old_rsgroup_name = 1; + */ + public com.google.protobuf.ByteString + getOldRsgroupNameBytes() { + java.lang.Object ref = oldRsgroupName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oldRsgroupName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string old_rsgroup_name = 1; + */ + public Builder setOldRsgroupName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + oldRsgroupName_ = value; + onChanged(); + return this; + } + /** + * required string old_rsgroup_name = 1; + */ + public Builder clearOldRsgroupName() { + bitField0_ = (bitField0_ & ~0x00000001); + oldRsgroupName_ = getDefaultInstance().getOldRsgroupName(); + onChanged(); + return this; + } + /** + * required string old_rsgroup_name = 1; + */ + public Builder setOldRsgroupNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + oldRsgroupName_ = value; + onChanged(); + return this; + } + + // required string new_rsgroup_name = 2; + private java.lang.Object newRsgroupName_ = ""; + /** + * required string new_rsgroup_name = 2; + */ + public boolean hasNewRsgroupName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * required string new_rsgroup_name = 2; + */ + public java.lang.String getNewRsgroupName() { + java.lang.Object ref = newRsgroupName_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + newRsgroupName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * required string new_rsgroup_name = 2; + */ + public com.google.protobuf.ByteString + getNewRsgroupNameBytes() { + java.lang.Object ref = newRsgroupName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + newRsgroupName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * required string new_rsgroup_name = 2; + */ + public Builder setNewRsgroupName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + newRsgroupName_ = value; + onChanged(); + return this; + } + /** + * required string new_rsgroup_name = 2; + */ + public Builder clearNewRsgroupName() { + bitField0_ = (bitField0_ & ~0x00000002); + newRsgroupName_ = getDefaultInstance().getNewRsgroupName(); + onChanged(); + return this; + } + /** + * required string new_rsgroup_name = 2; + */ + public Builder setNewRsgroupNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + newRsgroupName_ = value; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:hbase.pb.RenameRSGroupRequest) + } + + static { + defaultInstance = new RenameRSGroupRequest(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:hbase.pb.RenameRSGroupRequest) + } + + public interface RenameRSGroupResponseOrBuilder + extends com.google.protobuf.MessageOrBuilder { + } + /** + * Protobuf type {@code hbase.pb.RenameRSGroupResponse} + */ + public static final class RenameRSGroupResponse extends + com.google.protobuf.GeneratedMessage + implements RenameRSGroupResponseOrBuilder { + // Use RenameRSGroupResponse.newBuilder() to construct. + private RenameRSGroupResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private RenameRSGroupResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final RenameRSGroupResponse defaultInstance; + public static RenameRSGroupResponse getDefaultInstance() { + return defaultInstance; + } + + public RenameRSGroupResponse getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private RenameRSGroupResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.class, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public RenameRSGroupResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RenameRSGroupResponse(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private void initFields() { + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + 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.RSGroupAdminProtos.RenameRSGroupResponse)) { + return super.equals(obj); + } + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse other = (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse) obj; + + boolean result = true; + result = result && + getUnknownFields().equals(other.getUnknownFields()); + return result; + } + + private int memoizedHashCode = 0; + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse 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; + } + /** + * Protobuf type {@code hbase.pb.RenameRSGroupResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupResponse_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.class, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.Builder.class); + } + + // Construct using org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.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(); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.internal_static_hbase_pb_RenameRSGroupResponse_descriptor; + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse getDefaultInstanceForType() { + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance(); + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse build() { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse buildPartial() { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse result = new org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse(this); + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse) { + return mergeFrom((org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse other) { + if (other == org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + // @@protoc_insertion_point(builder_scope:hbase.pb.RenameRSGroupResponse) + } + + static { + defaultInstance = new RenameRSGroupResponse(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:hbase.pb.RenameRSGroupResponse) + } + /** * Protobuf service {@code hbase.pb.RSGroupAdminService} */ @@ -13524,6 +14552,14 @@ public final class RSGroupAdminProtos { org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest request, com.google.protobuf.RpcCallback done); + /** + * rpc RenameRSGroup(.hbase.pb.RenameRSGroupRequest) returns (.hbase.pb.RenameRSGroupResponse); + */ + public abstract void renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request, + com.google.protobuf.RpcCallback done); + } public static com.google.protobuf.Service newReflectiveService( @@ -13617,6 +14653,14 @@ public final class RSGroupAdminProtos { impl.removeServers(controller, request, done); } + @java.lang.Override + public void renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request, + com.google.protobuf.RpcCallback done) { + impl.renameRSGroup(controller, request, done); + } + }; } @@ -13661,6 +14705,8 @@ public final class RSGroupAdminProtos { return impl.moveServersAndTables(controller, (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveServersAndTablesRequest)request); case 10: return impl.removeServers(controller, (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest)request); + case 11: + return impl.renameRSGroup(controller, (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest)request); default: throw new java.lang.AssertionError("Can't get here."); } @@ -13697,6 +14743,8 @@ public final class RSGroupAdminProtos { return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveServersAndTablesRequest.getDefaultInstance(); case 10: return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest.getDefaultInstance(); + case 11: + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); } @@ -13733,6 +14781,8 @@ public final class RSGroupAdminProtos { return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveServersAndTablesResponse.getDefaultInstance(); case 10: return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse.getDefaultInstance(); + case 11: + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); } @@ -13829,6 +14879,14 @@ public final class RSGroupAdminProtos { org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest request, com.google.protobuf.RpcCallback done); + /** + * rpc RenameRSGroup(.hbase.pb.RenameRSGroupRequest) returns (.hbase.pb.RenameRSGroupResponse); + */ + public abstract void renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request, + com.google.protobuf.RpcCallback done); + public static final com.google.protobuf.Descriptors.ServiceDescriptor getDescriptor() { @@ -13906,6 +14964,11 @@ public final class RSGroupAdminProtos { com.google.protobuf.RpcUtil.specializeCallback( done)); return; + case 11: + this.renameRSGroup(controller, (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest)request, + com.google.protobuf.RpcUtil.specializeCallback( + done)); + return; default: throw new java.lang.AssertionError("Can't get here."); } @@ -13942,6 +15005,8 @@ public final class RSGroupAdminProtos { return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveServersAndTablesRequest.getDefaultInstance(); case 10: return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest.getDefaultInstance(); + case 11: + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); } @@ -13978,6 +15043,8 @@ public final class RSGroupAdminProtos { return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveServersAndTablesResponse.getDefaultInstance(); case 10: return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse.getDefaultInstance(); + case 11: + return org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance(); default: throw new java.lang.AssertionError("Can't get here."); } @@ -14163,6 +15230,21 @@ public final class RSGroupAdminProtos { org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse.class, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse.getDefaultInstance())); } + + public void renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request, + com.google.protobuf.RpcCallback done) { + channel.callMethod( + getDescriptor().getMethods().get(11), + controller, + request, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance(), + com.google.protobuf.RpcUtil.generalizeCallback( + done, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.class, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance())); + } } public static BlockingInterface newBlockingStub( @@ -14225,6 +15307,11 @@ public final class RSGroupAdminProtos { com.google.protobuf.RpcController controller, org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest request) throws com.google.protobuf.ServiceException; + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request) + throws com.google.protobuf.ServiceException; } private static final class BlockingStub implements BlockingInterface { @@ -14365,6 +15452,18 @@ public final class RSGroupAdminProtos { org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse.getDefaultInstance()); } + + public org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse renameRSGroup( + com.google.protobuf.RpcController controller, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest request) + throws com.google.protobuf.ServiceException { + return (org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse) channel.callBlockingMethod( + getDescriptor().getMethods().get(11), + controller, + request, + org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse.getDefaultInstance()); + } + } // @@protoc_insertion_point(class_scope:hbase.pb.RSGroupAdminService) @@ -14490,6 +15589,16 @@ public final class RSGroupAdminProtos { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_hbase_pb_RemoveServersResponse_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_hbase_pb_RenameRSGroupRequest_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_hbase_pb_RenameRSGroupRequest_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_hbase_pb_RenameRSGroupResponse_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_hbase_pb_RenameRSGroupResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -14534,34 +15643,38 @@ public final class RSGroupAdminProtos { "\030\003 \003(\0132\023.hbase.pb.TableName\"\036\n\034MoveServe" + "rsAndTablesResponse\"=\n\024RemoveServersRequ" + "est\022%\n\007servers\030\001 \003(\0132\024.hbase.pb.ServerNa" + - "me\"\027\n\025RemoveServersResponse2\332\007\n\023RSGroupA" + - "dminService\022S\n\016GetRSGroupInfo\022\037.hbase.pb" + - ".GetRSGroupInfoRequest\032 .hbase.pb.GetRSG" + - "roupInfoResponse\022h\n\025GetRSGroupInfoOfTabl" + - "e\022&.hbase.pb.GetRSGroupInfoOfTableReques", - "t\032\'.hbase.pb.GetRSGroupInfoOfTableRespon" + - "se\022k\n\026GetRSGroupInfoOfServer\022\'.hbase.pb." + - "GetRSGroupInfoOfServerRequest\032(.hbase.pb" + - ".GetRSGroupInfoOfServerResponse\022J\n\013MoveS" + - "ervers\022\034.hbase.pb.MoveServersRequest\032\035.h" + - "base.pb.MoveServersResponse\022G\n\nMoveTable" + - "s\022\033.hbase.pb.MoveTablesRequest\032\034.hbase.p" + - "b.MoveTablesResponse\022G\n\nAddRSGroup\022\033.hba" + - "se.pb.AddRSGroupRequest\032\034.hbase.pb.AddRS" + - "GroupResponse\022P\n\rRemoveRSGroup\022\036.hbase.p", - "b.RemoveRSGroupRequest\032\037.hbase.pb.Remove" + - "RSGroupResponse\022S\n\016BalanceRSGroup\022\037.hbas" + - "e.pb.BalanceRSGroupRequest\032 .hbase.pb.Ba" + - "lanceRSGroupResponse\022Y\n\020ListRSGroupInfos" + - "\022!.hbase.pb.ListRSGroupInfosRequest\032\".hb" + - "ase.pb.ListRSGroupInfosResponse\022e\n\024MoveS" + - "erversAndTables\022%.hbase.pb.MoveServersAn" + - "dTablesRequest\032&.hbase.pb.MoveServersAnd" + - "TablesResponse\022P\n\rRemoveServers\022\036.hbase." + - "pb.RemoveServersRequest\032\037.hbase.pb.Remov", - "eServersResponseBH\n*org.apache.hadoop.hb" + - "ase.protobuf.generatedB\022RSGroupAdminProt" + - "osH\001\210\001\001\240\001\001" + "me\"\027\n\025RemoveServersResponse\"J\n\024RenameRSG" + + "roupRequest\022\030\n\020old_rsgroup_name\030\001 \002(\t\022\030\n" + + "\020new_rsgroup_name\030\002 \002(\t\"\027\n\025RenameRSGroup" + + "Response2\254\010\n\023RSGroupAdminService\022S\n\016GetR" + + "SGroupInfo\022\037.hbase.pb.GetRSGroupInfoRequ", + "est\032 .hbase.pb.GetRSGroupInfoResponse\022h\n" + + "\025GetRSGroupInfoOfTable\022&.hbase.pb.GetRSG" + + "roupInfoOfTableRequest\032\'.hbase.pb.GetRSG" + + "roupInfoOfTableResponse\022k\n\026GetRSGroupInf" + + "oOfServer\022\'.hbase.pb.GetRSGroupInfoOfSer" + + "verRequest\032(.hbase.pb.GetRSGroupInfoOfSe" + + "rverResponse\022J\n\013MoveServers\022\034.hbase.pb.M" + + "oveServersRequest\032\035.hbase.pb.MoveServers" + + "Response\022G\n\nMoveTables\022\033.hbase.pb.MoveTa" + + "blesRequest\032\034.hbase.pb.MoveTablesRespons", + "e\022G\n\nAddRSGroup\022\033.hbase.pb.AddRSGroupReq" + + "uest\032\034.hbase.pb.AddRSGroupResponse\022P\n\rRe" + + "moveRSGroup\022\036.hbase.pb.RemoveRSGroupRequ" + + "est\032\037.hbase.pb.RemoveRSGroupResponse\022S\n\016" + + "BalanceRSGroup\022\037.hbase.pb.BalanceRSGroup" + + "Request\032 .hbase.pb.BalanceRSGroupRespons" + + "e\022Y\n\020ListRSGroupInfos\022!.hbase.pb.ListRSG" + + "roupInfosRequest\032\".hbase.pb.ListRSGroupI" + + "nfosResponse\022e\n\024MoveServersAndTables\022%.h" + + "base.pb.MoveServersAndTablesRequest\032&.hb", + "ase.pb.MoveServersAndTablesResponse\022P\n\rR" + + "emoveServers\022\036.hbase.pb.RemoveServersReq" + + "uest\032\037.hbase.pb.RemoveServersResponse\022P\n" + + "\rRenameRSGroup\022\036.hbase.pb.RenameRSGroupR" + + "equest\032\037.hbase.pb.RenameRSGroupResponseB" + + "H\n*org.apache.hadoop.hbase.protobuf.gene" + + "ratedB\022RSGroupAdminProtosH\001\210\001\001\240\001\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -14712,6 +15825,18 @@ public final class RSGroupAdminProtos { com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_hbase_pb_RemoveServersResponse_descriptor, new java.lang.String[] { }); + internal_static_hbase_pb_RenameRSGroupRequest_descriptor = + getDescriptor().getMessageTypes().get(24); + internal_static_hbase_pb_RenameRSGroupRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_hbase_pb_RenameRSGroupRequest_descriptor, + new java.lang.String[] { "OldRsgroupName", "NewRsgroupName", }); + internal_static_hbase_pb_RenameRSGroupResponse_descriptor = + getDescriptor().getMessageTypes().get(25); + internal_static_hbase_pb_RenameRSGroupResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_hbase_pb_RenameRSGroupResponse_descriptor, + new java.lang.String[] { }); return null; } }; diff --git a/hbase-protocol/src/main/protobuf/RSGroupAdmin.proto b/hbase-protocol/src/main/protobuf/RSGroupAdmin.proto index fbd55ad2213..8d79a06c91e 100644 --- a/hbase-protocol/src/main/protobuf/RSGroupAdmin.proto +++ b/hbase-protocol/src/main/protobuf/RSGroupAdmin.proto @@ -123,6 +123,14 @@ message RemoveServersRequest { message RemoveServersResponse { } +message RenameRSGroupRequest { + required string old_rsgroup_name = 1; + required string new_rsgroup_name = 2; +} + +message RenameRSGroupResponse { +} + service RSGroupAdminService { rpc GetRSGroupInfo(GetRSGroupInfoRequest) returns (GetRSGroupInfoResponse); @@ -156,4 +164,7 @@ service RSGroupAdminService { rpc RemoveServers(RemoveServersRequest) returns (RemoveServersResponse); + + rpc RenameRSGroup(RenameRSGroupRequest) + returns (RenameRSGroupResponse); } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdmin.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdmin.java index ab20ae9975a..af2505e172d 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdmin.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdmin.java @@ -99,4 +99,11 @@ public interface RSGroupAdmin extends Closeable { * @param servers set of servers to remove */ void removeServers(Set
servers) throws IOException; + + /** + * Rename rsgroup. + * @param oldName old rsgroup name + * @param newName new rsgroup name + */ + void renameRSGroup(String oldName, String newName) throws IOException; } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java index 5802d96a0b6..32f8692414c 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java @@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.MoveTablesR import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RSGroupAdminService; import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveRSGroupRequest; import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest; +import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest; import org.apache.hadoop.hbase.protobuf.generated.RSGroupProtos; import com.google.common.collect.Sets; @@ -226,6 +227,18 @@ public class RSGroupAdminClient implements RSGroupAdmin { } } + @Override + public void renameRSGroup(String oldName, String newName) throws IOException { + RenameRSGroupRequest request = RenameRSGroupRequest.newBuilder() + .setOldRsgroupName(oldName) + .setNewRsgroupName(newName).build(); + try { + stub.renameRSGroup(null, request); + } catch (ServiceException e) { + throw ProtobufUtil.handleRemoteException(e); + } + } + @Override public void close() throws IOException { } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java index b1a4c86d54a..574fa0e7166 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java @@ -88,6 +88,8 @@ import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveRSGro import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveRSGroupResponse; import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersRequest; import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RemoveServersResponse; +import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupRequest; +import org.apache.hadoop.hbase.protobuf.generated.RSGroupAdminProtos.RenameRSGroupResponse; import org.apache.hadoop.hbase.protobuf.generated.TableProtos; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.security.UserProvider; @@ -489,6 +491,27 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } } + @Override + public void renameRSGroup(RpcController controller, + RenameRSGroupRequest request, + RpcCallback done) { + RenameRSGroupResponse.Builder builder = RenameRSGroupResponse.newBuilder(); + String oldRSGroup = request.getOldRsgroupName(); + String newRSGroup = request.getNewRsgroupName(); + try { + if (master.getMasterCoprocessorHost() != null) { + master.getMasterCoprocessorHost().preRenameRSGroup(oldRSGroup, newRSGroup); + } + groupAdminServer.renameRSGroup(oldRSGroup, newRSGroup); + if (master.getMasterCoprocessorHost() != null) { + master.getMasterCoprocessorHost().postRenameRSGroup(oldRSGroup, newRSGroup); + } + } catch (IOException e) { + ResponseConverter.setControllerException(controller, e); + } + done.run(builder.build()); + } + ///////////////////////////////////////////////////////////////////////////// // MasterObserver overrides ///////////////////////////////////////////////////////////////////////////// @@ -1231,6 +1254,16 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService } + @Override + public void preRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } + + @Override + public void postRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } + public void checkPermission(String request) throws IOException { accessChecker.requirePermission(getActiveUser(), request, Permission.Action.ADMIN); } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java index c6c90d9ebe3..2b12f810353 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminServer.java @@ -503,6 +503,13 @@ public class RSGroupAdminServer implements RSGroupAdmin { moveTables(tables, targetGroup); } + @Override + public void renameRSGroup(String oldName, String newName) throws IOException { + synchronized (rsGroupInfoManager) { + rsGroupInfoManager.renameRSGroup(oldName, newName); + } + } + @Override public void close() throws IOException { } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java index e50412c0de8..106523fcb55 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManager.java @@ -125,4 +125,11 @@ public interface RSGroupInfoManager { * @param servers set of servers to remove */ void removeServers(Set
servers) throws IOException; + + /** + * Rename RSGroup + * @param oldName old rsgroup name + * @param newName new rsgroup name + */ + void renameRSGroup(String oldName, String newName) throws IOException; } diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java index 9699941fdfb..008484d2cbf 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java @@ -842,4 +842,21 @@ public class RSGroupInfoManagerImpl implements RSGroupInfoManager, ServerListene flushConfig(newGroupMap); } } + + @Override + public void renameRSGroup(String oldName, String newName) throws IOException { + checkGroupName(oldName); + checkGroupName(newName); + if (oldName.equals(RSGroupInfo.DEFAULT_GROUP)) { + throw new ConstraintException("Can't rename default rsgroup"); + } + + RSGroupInfo oldGroup = getRSGroup(oldName); + Map newGroupMap = Maps.newHashMap(rsGroupMap); + newGroupMap.remove(oldName); + RSGroupInfo newGroup = new RSGroupInfo(newName, oldGroup.getServers(), oldGroup.getTables()); + newGroupMap.put(newName, newGroup); + flushConfig(newGroupMap); + } + } diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java index 1d16e66cf79..2a6c1b33700 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java @@ -470,4 +470,52 @@ public class TestRSGroupsAdmin1 extends TestRSGroupsBase { initialize(); } + @Test + public void testRenameRSGroup() throws Exception { + // Add rsgroup, and assign 2 servers and a table to it. + RSGroupInfo oldgroup = addGroup(rsGroupAdmin, "oldgroup", 2); + final TableName tb1 = TableName.valueOf("testRename"); + TEST_UTIL.createTable(tb1, "tr"); + rsGroupAdmin.moveTables(Sets.newHashSet(tb1), oldgroup.getName()); + TEST_UTIL.waitFor(1000, new Waiter.Predicate() { + @Override + public boolean evaluate() throws Exception { + return rsGroupAdmin.getRSGroupInfoOfTable(tb1).getServers().size() == 2; + } + }); + oldgroup = rsGroupAdmin.getRSGroupInfo(oldgroup.getName()); + assertEquals(2, oldgroup.getServers().size()); + assertEquals(oldgroup.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tb1).getName()); + assertTrue(oldgroup.getTables().contains(tb1)); + + // Another rsgroup and table for verification + // that they are unchanged during we're renaming oldgroup. + RSGroupInfo normal = addGroup(rsGroupAdmin, "normal", 1); + final TableName tb2 = TableName.valueOf("unmovedTable"); + TEST_UTIL.createTable(tb2, "ut"); + rsGroupAdmin.moveTables(Sets.newHashSet(tb2), normal.getName()); + TEST_UTIL.waitFor(1000, new Waiter.Predicate() { + @Override + public boolean evaluate() throws Exception { + return rsGroupAdmin.getRSGroupInfoOfTable(tb2).getServers().size() == 1; + } + }); + normal = rsGroupAdmin.getRSGroupInfo(normal.getName()); + assertEquals(1, normal.getServers().size()); + assertEquals(normal.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tb2).getName()); + assertTrue(normal.containsTable(tb2)); + + + // Rename rsgroup + rsGroupAdmin.renameRSGroup(oldgroup.getName(), "newgroup"); + Set
servers = oldgroup.getServers(); + RSGroupInfo newgroup = rsGroupAdmin.getRSGroupInfo("newgroup"); + assertEquals(servers.size(), newgroup.getServers().size()); + for (Address server : servers) { + assertTrue(newgroup.containsServer(server)); + } + assertEquals(newgroup.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tb1).getName()); + assertTrue(newgroup.containsTable(tb1)); + assertEquals(normal.getName(), rsGroupAdmin.getRSGroupInfoOfTable(tb2).getName()); + } } diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java index 05f41dd6b38..8a8f011727d 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsBase.java @@ -292,6 +292,8 @@ public abstract class TestRSGroupsBase { boolean postRemoveServersCalled = false; boolean preMoveServersAndTables = false; boolean postMoveServersAndTables = false; + boolean preReNameRSGroupCalled = false; + boolean postReNameRSGroupCalled = false; public void resetFlags() { preBalanceRSGroupCalled = false; @@ -308,6 +310,8 @@ public abstract class TestRSGroupsBase { postRemoveServersCalled = false; preMoveServersAndTables = false; postMoveServersAndTables = false; + preReNameRSGroupCalled = false; + postReNameRSGroupCalled = false; } @Override @@ -395,5 +399,17 @@ public abstract class TestRSGroupsBase { String groupName, boolean balancerRan) throws IOException { postBalanceRSGroupCalled = true; } + + @Override + public void preRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + preReNameRSGroupCalled = true; + } + + @Override + public void postRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + postReNameRSGroupCalled = true; + } } } \ No newline at end of file diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java index 09a171684e4..fccd741058d 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java @@ -110,6 +110,12 @@ public class VerifyingRSGroupAdminClient implements RSGroupAdmin { verify(); } + @Override + public void renameRSGroup(String oldName, String newName) throws IOException { + wrapped.renameRSGroup(oldName, newName); + verify(); + } + public void verify() throws IOException { Map groupMap = Maps.newHashMap(); Set zList = Sets.newHashSet(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java index c2b326a594a..8465654c3d6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterAndRegionObserver.java @@ -685,4 +685,15 @@ public class BaseMasterAndRegionObserver extends BaseRegionObserver public void postRemoveServers(ObserverContext ctx, Set
servers) throws IOException { } + + + @Override + public void preRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } + + @Override + public void postRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java index b7aca2fe8c3..4bf6b25fae6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseMasterObserver.java @@ -685,4 +685,14 @@ public class BaseMasterObserver implements MasterObserver { public void postBalanceRSGroup(ObserverContext ctx, String groupName, boolean balancerRan) throws IOException { } + + @Override + public void preRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } + + @Override + public void postRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java index 32b9c5b1bb1..0b42dbe5bb1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java @@ -1215,4 +1215,25 @@ public interface MasterObserver extends Coprocessor { */ void postBalanceRSGroup(final ObserverContext ctx, String groupName, boolean balancerRan) throws IOException; + + /** + * Called before rename rsgroup. + * @param ctx the environment to interact with the framework and master + * @param oldName old rsgroup name + * @param newName new rsgroup name + * @throws IOException on failure + */ + void preRenameRSGroup(final ObserverContext ctx, + final String oldName, final String newName) throws IOException; + + /** + * Called after rename rsgroup. + * @param ctx the environment to interact with the framework and master + * @param oldName old rsgroup name + * @param newName new rsgroup name + * @throws IOException on failure + */ + void postRenameRSGroup(final ObserverContext ctx, + final String oldName, final String newName) throws IOException; + } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java index a6413f5581b..37f2b011a01 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java @@ -1435,6 +1435,32 @@ public class MasterCoprocessorHost }); } + public void preRenameRSGroup(final String oldName, final String newName) + throws IOException { + execOperation(coprocessors.isEmpty() ? null: new CoprocessorOperation() { + @Override + public void call(MasterObserver oserver, + ObserverContext ctx) throws IOException { + if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) { + oserver.preRenameRSGroup(ctx, oldName, newName); + } + } + }); + } + + public void postRenameRSGroup(final String oldName, final String newName) + throws IOException { + execOperation(coprocessors.isEmpty() ? null: new CoprocessorOperation() { + @Override + public void call(MasterObserver oserver, + ObserverContext ctx) throws IOException { + if(((MasterEnvironment)ctx.getEnvironment()).supportGroupCPs) { + oserver.postRenameRSGroup(ctx, oldName, newName); + } + } + }); + } + private static abstract class CoprocessorOperation extends ObserverContext { public CoprocessorOperation() { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java index cc5e2e56cad..5f537895d6c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestMasterObserver.java @@ -1367,6 +1367,15 @@ public class TestMasterObserver { String groupName, boolean balancerRan) throws IOException { } + @Override + public void preRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } + + @Override + public void postRenameRSGroup(ObserverContext ctx, + String oldName, String newName) throws IOException { + } } private static HBaseTestingUtility UTIL = new HBaseTestingUtility();