[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-13 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r556365043



##
File path: hbase-shell/src/main/ruby/shell/commands/get_namespace_rsgroup.rb
##
@@ -0,0 +1,38 @@
+# 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)

Review comment:
   thanks a lot, I will update this pr





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-11 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r59904



##
File path: hbase-shell/src/main/ruby/shell/commands/get_namespace_rsgroup.rb
##
@@ -0,0 +1,38 @@
+# 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)

Review comment:
   
![image](https://user-images.githubusercontent.com/21099711/104282434-02bdb680-54ea-11eb-8e06-5c5ee2e0a3db.png)
   
   I code it from get_server_rsgroup method, and it look good !





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-11 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r57265



##
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##
@@ -1447,6 +1447,17 @@ def alter_namespace(namespace_name, *args)
   @admin.modifyNamespace(nsb.build)
 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
+  res = nsd.getConfigurationValue("hbase.rsgroup.name")
+  res

Review comment:
   yes, pr has updated, please review again!





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-11 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r42539



##
File path: hbase-shell/src/main/ruby/shell/commands/get_namespace_rsgroup.rb
##
@@ -0,0 +1,39 @@
+# 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)
+formatter.row(group_name)

Review comment:
   thanks ,  no need, I think , pr has undated!





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-11 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r42539



##
File path: hbase-shell/src/main/ruby/shell/commands/get_namespace_rsgroup.rb
##
@@ -0,0 +1,39 @@
+# 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)
+formatter.row(group_name)

Review comment:
   thanks ,  no need, I think , pr has undated!





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [hbase] leyangyueshan commented on a change in pull request #2874: HBASE-25496 add get_namespace_rsgroup command

2021-01-11 Thread GitBox


leyangyueshan commented on a change in pull request #2874:
URL: https://github.com/apache/hbase/pull/2874#discussion_r41973



##
File path: hbase-shell/src/main/ruby/hbase/admin.rb
##
@@ -1447,6 +1447,17 @@ def alter_namespace(namespace_name, *args)
   @admin.modifyNamespace(nsb.build)
 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
+  res = nsd.getConfigurationValue("hbase.rsgroup.name")
+  res

Review comment:
   no, I tried, but it doesn't work。
   like rsgroup_admin.rb 
 #--
   # get group of server
   def get_rsgroup_of_server(server)
 res = @admin.getRSGroup(
   org.apache.hadoop.hbase.net.Address.fromString(server)
 )
 raise(ArgumentError, 'Server has no group: ' + server) if res.nil?
 res
   end





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org