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

Kevin Risden commented on HBASE-12867:
--------------------------------------

{quote}
I think we don't need to add a new command. Current add_peer command should be 
overwritable.
{quote}

I originally thought that too but if we want to ensure that the add_peer 
command is backwards compatible for HBase 0.98 then there would need to be a 
new command or potentially used a named argument for the classname. Here is a 
simple example:

{code}
shell > add_peer 'my-peer-id', 'org.apache.hadoop.hbase.MyReplicationEndpoint'
{code}

Since DATA, CONFIG, and TABLE_CFS are optional that would just become an id and 
a classname. The current add_peer implementation assumes that the second 
argument string is the clusterKey. Without doing string parsing, it would be 
impossible to tell if the second argument is either a classname or a 
clusterKey. So I think that would make overwriting add_peer difficult if we 
need to support backwards compatibility.

A related thought that I can look into is if there is support for a named 
parameter in jruby. This would allow the appearance of add_peer being 
overwritten and still maintain the backwards compatibility of add_peer without 
ending up with the example shown above. This would require either the 
clusterKey to be specified or the CLASSNAME. Here are two examples:

{code}
shell > add_peer 'my-peer-id', CLASSNAME = 
'org.apache.hadoop.hbase.MyReplicationEndpoint'
{code}

{code}
shell > add_peer 'my-peer-id', CLASSNAME = 
'org.apache.hadoop.hbase.MyReplicationEndpoint', DATA => { "key1" => 1 }, 
CONFIG => { "config1" => "value1", "config2" => "value2" }, TABLE_CFS => { 
"table1", "table2", "table3" => {"cf1", "cf2"} }
{code}

Maybe backwards compatibility isn't required for HBase 2.x, but for 1.x and 
0.98.x there should be a way to add a custom replication endpoint peer from the 
shell and still be able to use the add_peer command how it has been used in the 
past.

{quote}
Also, the help for add_peer mentions that the id must be a short which is not 
the case anymore.
{quote}

Ok the documentation was copied from add_peer so that can be changed.

> Shell does not support custom replication endpoint specification
> ----------------------------------------------------------------
>
>                 Key: HBASE-12867
>                 URL: https://issues.apache.org/jira/browse/HBASE-12867
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Andrew Purtell
>            Assignee: Jingcheng Du
>              Labels: beginner, beginners
>             Fix For: 1.0.0, 2.0.0, 1.1.0, 0.98.11
>
>         Attachments: HBASE-12867.patch
>
>
> On HBASE-12254 and also at 
> https://github.com/risdenk/hbase-custom-replication-endpoint-example 
> [~risdenk] made the following observations and suggestions regarding custom 
> replication endpoints that I think are a reasonable blueprint for improvement:
> {quote}
> I was trying out the pluggable replication endpoint feature and found the 
> following:
> - you must use the ReplicationAdmin to add the new ReplicationEndpoint
> - hbase shell add_peer command doesn't support specifying a custom class
> - hbase shell add_peer relies on the newly deprecated ReplicationAdmin 
> addPeer methods
> - ReplicationAdmin addPeer tableCfs is now a Map<TableName, ? extends 
> Collection<String>> instead of a string
> {quote}
> We should fix the add_peer command in the shell at least.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to