[
https://issues.apache.org/jira/browse/HBASE-8771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13688741#comment-13688741
]
Demai Ni commented on HBASE-8771:
---------------------------------
folks, many thanks for the comments
@Elliott, if the user already has a scope = 2, the replication will work as
before since the replication code will only check zero vs none-zero. I also
considered to check the value during replication execution time, but feel may
hurt performance a bit, and also become an incompatible change(as it breaks
existing system). So the idea is to do this quick and simple by blocking the
setter. btw, I am working on another HBASE-8663, and can add a field to show
the 'scope' to help user to identify which existing replication_scope to be
reset to 1.
@Chris, checking at shell layer(admin.rb) won't block user to call the API
directly(using another java or ruby app for example). I was also considering
about the HColumnDescriptor constructor, but saw it is marked as 'deprecated'
and setScope() is a public method, so feel that inside setScope() is the
one-shot-for-all place. Your takes? thanks
> 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