You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Karthik Palanisamy (Jira)" <ji...@apache.org> on 2019/12/05 00:54:00 UTC

[jira] [Comment Edited] (HBASE-23360) [CLI] Fix help command "set_quota"

    [ https://issues.apache.org/jira/browse/HBASE-23360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16988351#comment-16988351 ] 

Karthik Palanisamy edited comment on HBASE-23360 at 12/5/19 12:53 AM:
----------------------------------------------------------------------

{code:java}
hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => '10M/sec'{code}
When users setting a quota they will pass THROTTLE_TYPE as either READ/WRITE but internally we transform given THROTTLE_TYPE into one of the following TYPE based on LIMIT unit.

Write operation THROTTLE_TYPE:
{code:java}
WRITE_NUMBER
WRITE_CAPACITY_UNIT
WRITE_SIZE{code}

  
{code:java}
quotas.rb

def _parse_limit(str_limit, type_cls, type)
  str_limit = str_limit.downcase
  match = /^(\d+)(req|cu|[bkmgtp])\/(sec|min|hour|day)$/.match(str_limit)
  if match
    limit = match[1].to_i
    if match[2] == 'req'
      type = type_cls.valueOf(type + '_NUMBER')
    elsif match[2] == 'cu'
      type = type_cls.valueOf(type + '_CAPACITY_UNIT')
    else
      limit = _size_from_str(limit, match[2])
      type = type_cls.valueOf(type + '_SIZE')
    end
{code}
So unsetting THROTTLE_TYPE users will think to use same READ/WRITE THROTTLE_TYPE because they may not aware of our internal transformation and eventually this command will fail. 
{code:java}
hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => NONE{code}

  


was (Author: kpalanisamy):
{code:java}
hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => '10M/sec'{code}
When users setting a quota they will pass THROTTLE_TYPE as either READ/WRITE but internally we transform given THROTTLE_TYPE into one of the following TYPE based on LIMIT unit.

Write operation THROTTLE_TYPE:
WRITE_NUMBER
WRITE_CAPACITY_UNIT
WRITE_SIZE
 
{code:java}
quotas.rb

def _parse_limit(str_limit, type_cls, type)
  str_limit = str_limit.downcase
  match = /^(\d+)(req|cu|[bkmgtp])\/(sec|min|hour|day)$/.match(str_limit)
  if match
    limit = match[1].to_i
    if match[2] == 'req'
      type = type_cls.valueOf(type + '_NUMBER')
    elsif match[2] == 'cu'
      type = type_cls.valueOf(type + '_CAPACITY_UNIT')
    else
      limit = _size_from_str(limit, match[2])
      type = type_cls.valueOf(type + '_SIZE')
    end
{code}
So unsetting THROTTLE_TYPE users will think to use same READ/WRITE THROTTLE_TYPE because they may not aware of our internal transformation and eventually this command will fail. 
hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => NONE
 

> [CLI] Fix help command "set_quota"
> ----------------------------------
>
>                 Key: HBASE-23360
>                 URL: https://issues.apache.org/jira/browse/HBASE-23360
>             Project: HBase
>          Issue Type: Bug
>          Components: shell
>    Affects Versions: 3.0.0
>            Reporter: Karthik Palanisamy
>            Assignee: Karthik Palanisamy
>            Priority: Minor
>
> To remove a quota by throttle_type,
> {code:java}
> hbase> help "set_quota"
> ...
> hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE, USER => 'u1', LIMIT => NONE
> ....
> {code}
> but the actual command should be, 
> {code:java}
> hbase> set_quota TYPE => THROTTLE, THROTTLE_TYPE => WRITE_NUMBER, USER => 'u1', LIMIT => NONE{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)