Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hbase-shell/src/main/ruby/hbase/quotas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ def switch_rpc_throttle(enabled)
@admin.switchRpcThrottle(java.lang.Boolean.valueOf(enabled))
end

def is_rpc_throttle_enabled()
@admin.isRpcThrottleEnabled()
end

def switch_exceed_throttle_quota(enabled)
@admin.exceedThrottleQuotaSwitch(java.lang.Boolean.valueOf(enabled))
end
Expand Down
1 change: 1 addition & 0 deletions hbase-shell/src/main/ruby/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ def self.exception_handler(hide_traceback)
list_snapshot_sizes
enable_rpc_throttle
disable_rpc_throttle
rpc_throttle_enabled
enable_exceed_throttle_quota
disable_exceed_throttle_quota
]
Expand Down
41 changes: 41 additions & 0 deletions hbase-shell/src/main/ruby/shell/commands/rpc_throttle_enabled.rb
Original file line number Diff line number Diff line change
@@ -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 RpcThrottleEnabled < Command
def help
<<-EOF
Query the current rpc throttle state.
Returns true if rpc throttle is enabled, false otherwise.

Examples:
hbase> rpc_throttle_enabled
EOF
end

def command
state = !!quotas_admin.is_rpc_throttle_enabled
formatter.row(["Rpc throttle enabled : #{state}"])
state
end
end
end
end
15 changes: 15 additions & 0 deletions hbase-shell/src/test/ruby/hbase/quotas_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,30 @@ def teardown
end

define_test 'switch rpc throttle' do
result = nil
output = capture_stdout { result = command(:rpc_throttle_enabled) }
assert(output.include?('Rpc throttle enabled : true'))
assert(result == true)

result = nil
output = capture_stdout { result = command(:disable_rpc_throttle) }
assert(output.include?('Previous rpc throttle state : true'))
assert(result == true)

result = nil
output = capture_stdout { result = command(:rpc_throttle_enabled) }
assert(output.include?('Rpc throttle enabled : false'))
assert(result == false)

result = nil
output = capture_stdout { result = command(:enable_rpc_throttle) }
assert(output.include?('Previous rpc throttle state : false'))
assert(result == false)

result = nil
output = capture_stdout { result = command(:rpc_throttle_enabled) }
assert(output.include?('Rpc throttle enabled : true'))
assert(result == true)
end

define_test 'can set and remove region server quota' do
Expand Down