hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Demai Ni (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-8771) ensure replication_scope's value is either local(0) or global(1)
Date Thu, 20 Jun 2013 18:28:21 GMT

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

Demai Ni commented on HBASE-8771:
---------------------------------

[~ctrezzo], another interesting finding while I was playing different approaches (shell vs
constructor). Using maxVersion as example, which has code like below to check value:
{code}
if (maxVersions <= 0) {
      // TODO: Allow maxVersion of 0 to be the way you say "Keep all versions".
      // Until there is support, consider 0 or < 0 -- a configuration error.      
      throw new IllegalArgumentException("Maximum versions must be positive");
    }
{code}
Above code can catch the illegal arg only when user call the HColumnDescriptor constructor,
but won't work in hbase shell or call setMaxVersion() direclty. 

{code:title=set Max Version = -1 in Shell. No Error thrown because shell called setMaxVersions
directly}
hbase(main):016:0> create 't5_dn',{NAME=>'cf1',VERSIONS=>-1}
0 row(s) in 1.0420 seconds

hbase(main):017:0> put 't5_dn','row1','cf1:q1','row1cf1_v1'
0 row(s) in 0.0700 seconds

hbase(main):018:0> scan 't5_dn'
ROW                   COLUMN+CELL                                              
0 row(s) in 0.0090 seconds

hbase(main):019:0> describe 't5_dn'
DESCRIPTION                                          ENABLED                    
't5_dn', {NAME => 'cf1',.... VERSIONS => '-1',...}                                 
                                         
{code}

{code:title=set Max Version = -999 through constructor. Error caught inside }
    HTableDescriptor ht = new HTableDescriptor( "t3_dn" );
    HColumnDescriptor cfd = new HColumnDescriptor(Bytes.toBytes( "cf1"),-999,"NONE",false,false,100,"NONE");
...
Exception in thread "main" java.lang.IllegalArgumentException: Maximum versions must be positive
	at org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:386)
	at org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:334)
	at org.apache.hadoop.hbase.HColumnDescriptor.<init>(HColumnDescriptor.java:302)
	at CreateTable_version.main(CreateTable_version.java:23)
{code}
                
> ensure replication_scope's value is either local(0) or global(1)
> ----------------------------------------------------------------
>
>                 Key: HBASE-8771
>                 URL: https://issues.apache.org/jira/browse/HBASE-8771
>             Project: HBase
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 0.94.8
>            Reporter: Demai Ni
>            Priority: Minor
>             Fix For: 0.94.9
>
>         Attachments: HBASE-8771-0.94.8-v0.patch
>
>
> For replication_scope, only two values are meaningful:
> {code} 
>   public static final int REPLICATION_SCOPE_LOCAL = 0;
>   public static final int REPLICATION_SCOPE_GLOBAL = 1;
> {code} 
> However, there is no checking for that, so currently user can set it to any integer value.
And all non-zero value will be treated as 1(GLOBAL). 
> This jira is to add a checking in HColumnDescriptor#setScope() so that only 0 and 1 will
be accept during create_table or alter_table. 
> In the future, we can leverage replication_scope to store for info. For example: 
> -1: A columnfam is replicated from another cluster in MASTER_SLAVE setup (i.e readonly)
> 2 : A columnfam is set MASTER_MASTER
> Probably a major improve JIRA is needed for the future usage. It will be good to ensure
the scope value at this moment. 
> {code:title=Testing|borderStyle=solid}
> hbase(main):002:0> create 't1_dn',{NAME=>'cf1',REPLICATION_SCOPE=>2}
> ERROR: java.lang.IllegalArgumentException: Replication Scope must be either 0(local)
or 1(global)
> ...
> hbase(main):004:0> alter 't1_dn',{NAME=>'cf1',REPLICATION_SCOPE=>-1}
> ERROR: java.lang.IllegalArgumentException: Replication Scope must be either 0(local)
or 1(global)
> ...
> {code} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message