File tree Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Expand file tree Collapse file tree 4 files changed +62
-0
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,10 @@ def switch_rpc_throttle(enabled)
375375 @admin . switchRpcThrottle ( java . lang . Boolean . valueOf ( enabled ) )
376376 end
377377
378+ def rpc_throttle_enabled?
379+ @admin . isRpcThrottleEnabled
380+ end
381+
378382 def switch_exceed_throttle_quota ( enabled )
379383 @admin . exceedThrottleQuotaSwitch ( java . lang . Boolean . valueOf ( enabled ) )
380384 end
Original file line number Diff line number Diff line change @@ -574,6 +574,7 @@ def self.exception_handler(hide_traceback)
574574 list_snapshot_sizes
575575 enable_rpc_throttle
576576 disable_rpc_throttle
577+ rpc_throttle_enabled
577578 enable_exceed_throttle_quota
578579 disable_exceed_throttle_quota
579580 ]
Original file line number Diff line number Diff line change 1+ #
2+ #
3+ # Licensed to the Apache Software Foundation (ASF) under one
4+ # or more contributor license agreements. See the NOTICE file
5+ # distributed with this work for additional information
6+ # regarding copyright ownership. The ASF licenses this file
7+ # to you under the Apache License, Version 2.0 (the
8+ # "License"); you may not use this file except in compliance
9+ # with the License. You may obtain a copy of the License at
10+ #
11+ # http://www.apache.org/licenses/LICENSE-2.0
12+ #
13+ # Unless required by applicable law or agreed to in writing, software
14+ # distributed under the License is distributed on an "AS IS" BASIS,
15+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ # See the License for the specific language governing permissions and
17+ # limitations under the License.
18+ #
19+
20+
21+ module Shell
22+ module Commands
23+ # Prints whether rpc throttle is enabled
24+ class RpcThrottleEnabled < Command
25+ def help
26+ <<-EOF
27+ Query the current rpc throttle state.
28+ Return true if rpc throttle is enabled, false otherwise.
29+
30+ Examples:
31+ hbase> rpc_throttle_enabled
32+ EOF
33+ end
34+
35+ def command
36+ state = quotas_admin . rpc_throttle_enabled?
37+ formatter . row ( [ state . to_s ] )
38+ state
39+ end
40+ end
41+ end
42+ end
Original file line number Diff line number Diff line change @@ -245,15 +245,30 @@ def teardown
245245 end
246246
247247 define_test 'switch rpc throttle' do
248+ result = nil
249+ output = capture_stdout { result = command ( :rpc_throttle_enabled ) }
250+ assert ( output . include? ( 'true' ) )
251+ assert ( result == true )
252+
248253 result = nil
249254 output = capture_stdout { result = command ( :disable_rpc_throttle ) }
250255 assert ( output . include? ( 'Previous rpc throttle state : true' ) )
251256 assert ( result == true )
252257
258+ result = nil
259+ output = capture_stdout { result = command ( :rpc_throttle_enabled ) }
260+ assert ( output . include? ( 'false' ) )
261+ assert ( result == false )
262+
253263 result = nil
254264 output = capture_stdout { result = command ( :enable_rpc_throttle ) }
255265 assert ( output . include? ( 'Previous rpc throttle state : false' ) )
256266 assert ( result == false )
267+
268+ result = nil
269+ output = capture_stdout { result = command ( :rpc_throttle_enabled ) }
270+ assert ( output . include? ( 'true' ) )
271+ assert ( result == true )
257272 end
258273
259274 define_test 'can set and remove region server quota' do
You can’t perform that action at this time.
0 commit comments