HBASE-25496 add get_namespace_rsgroup command (#2874)
Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
9e9bec24d2
commit
6c3861f65d
|
@ -1447,6 +1447,16 @@ module Hbase
|
||||||
@admin.modifyNamespace(nsb.build)
|
@admin.modifyNamespace(nsb.build)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------------------------
|
||||||
|
# Get namespace's rsgroup
|
||||||
|
def get_namespace_rsgroup(namespace_name)
|
||||||
|
# Fail if namespace name is not a string
|
||||||
|
raise(ArgumentError, 'Namespace name must be of type String') unless namespace_name.is_a?(String)
|
||||||
|
nsd = @admin.getNamespaceDescriptor(namespace_name)
|
||||||
|
raise(ArgumentError, 'Namespace does not exist') unless nsd
|
||||||
|
nsd.getConfigurationValue("hbase.rsgroup.name")
|
||||||
|
end
|
||||||
|
|
||||||
#----------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------
|
||||||
# Drops a table
|
# Drops a table
|
||||||
def drop_namespace(namespace_name)
|
def drop_namespace(namespace_name)
|
||||||
|
|
|
@ -628,5 +628,6 @@ Shell.load_command_group(
|
||||||
rename_rsgroup
|
rename_rsgroup
|
||||||
alter_rsgroup_config
|
alter_rsgroup_config
|
||||||
show_rsgroup_config
|
show_rsgroup_config
|
||||||
|
get_namespace_rsgroup
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
module Shell
|
||||||
|
module Commands
|
||||||
|
class GetNamespaceRsgroup < Command
|
||||||
|
def help
|
||||||
|
<<-EOF
|
||||||
|
Get the group name the given NameSpace is a member of.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
hbase> get_namespace_rsgroup 'namespace_name'
|
||||||
|
|
||||||
|
EOF
|
||||||
|
end
|
||||||
|
|
||||||
|
def command(namespace_name)
|
||||||
|
group_name = admin.get_namespace_rsgroup(namespace_name)
|
||||||
|
unless group_name.nil?
|
||||||
|
formatter.row([group_name])
|
||||||
|
end
|
||||||
|
formatter.footer(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue