hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [07/51] [partial] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd.
Date Thu, 20 Apr 2017 15:01:33 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/662ea7dc/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.DisableTableFuture.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.DisableTableFuture.html b/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.DisableTableFuture.html
index b798d4b..8c56a67 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.DisableTableFuture.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/client/HBaseAdmin.DisableTableFuture.html
@@ -3877,425 +3877,371 @@
 <span class="sourceLineNo">3869</span>      throw new ReplicationException("tableCfs is null");<a name="line.3869"></a>
 <span class="sourceLineNo">3870</span>    }<a name="line.3870"></a>
 <span class="sourceLineNo">3871</span>    ReplicationPeerConfig peerConfig = getReplicationPeerConfig(id);<a name="line.3871"></a>
-<span class="sourceLineNo">3872</span>    Map&lt;TableName, List&lt;String&gt;&gt; preTableCfs = peerConfig.getTableCFsMap();<a name="line.3872"></a>
-<span class="sourceLineNo">3873</span>    if (preTableCfs == null) {<a name="line.3873"></a>
-<span class="sourceLineNo">3874</span>      peerConfig.setTableCFsMap(tableCfs);<a name="line.3874"></a>
-<span class="sourceLineNo">3875</span>    } else {<a name="line.3875"></a>
-<span class="sourceLineNo">3876</span>      for (Map.Entry&lt;TableName, ? extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a name="line.3876"></a>
-<span class="sourceLineNo">3877</span>        TableName table = entry.getKey();<a name="line.3877"></a>
-<span class="sourceLineNo">3878</span>        Collection&lt;String&gt; appendCfs = entry.getValue();<a name="line.3878"></a>
-<span class="sourceLineNo">3879</span>        if (preTableCfs.containsKey(table)) {<a name="line.3879"></a>
-<span class="sourceLineNo">3880</span>          List&lt;String&gt; cfs = preTableCfs.get(table);<a name="line.3880"></a>
-<span class="sourceLineNo">3881</span>          if (cfs == null || appendCfs == null || appendCfs.isEmpty()) {<a name="line.3881"></a>
-<span class="sourceLineNo">3882</span>            preTableCfs.put(table, null);<a name="line.3882"></a>
-<span class="sourceLineNo">3883</span>          } else {<a name="line.3883"></a>
-<span class="sourceLineNo">3884</span>            Set&lt;String&gt; cfSet = new HashSet&lt;String&gt;(cfs);<a name="line.3884"></a>
-<span class="sourceLineNo">3885</span>            cfSet.addAll(appendCfs);<a name="line.3885"></a>
-<span class="sourceLineNo">3886</span>            preTableCfs.put(table, Lists.newArrayList(cfSet));<a name="line.3886"></a>
-<span class="sourceLineNo">3887</span>          }<a name="line.3887"></a>
-<span class="sourceLineNo">3888</span>        } else {<a name="line.3888"></a>
-<span class="sourceLineNo">3889</span>          if (appendCfs == null || appendCfs.isEmpty()) {<a name="line.3889"></a>
-<span class="sourceLineNo">3890</span>            preTableCfs.put(table, null);<a name="line.3890"></a>
-<span class="sourceLineNo">3891</span>          } else {<a name="line.3891"></a>
-<span class="sourceLineNo">3892</span>            preTableCfs.put(table, Lists.newArrayList(appendCfs));<a name="line.3892"></a>
-<span class="sourceLineNo">3893</span>          }<a name="line.3893"></a>
-<span class="sourceLineNo">3894</span>        }<a name="line.3894"></a>
-<span class="sourceLineNo">3895</span>      }<a name="line.3895"></a>
-<span class="sourceLineNo">3896</span>    }<a name="line.3896"></a>
-<span class="sourceLineNo">3897</span>    updateReplicationPeerConfig(id, peerConfig);<a name="line.3897"></a>
-<span class="sourceLineNo">3898</span>  }<a name="line.3898"></a>
-<span class="sourceLineNo">3899</span><a name="line.3899"></a>
-<span class="sourceLineNo">3900</span>  @Override<a name="line.3900"></a>
-<span class="sourceLineNo">3901</span>  public void removeReplicationPeerTableCFs(String id,<a name="line.3901"></a>
-<span class="sourceLineNo">3902</span>      Map&lt;TableName, ? extends Collection&lt;String&gt;&gt; tableCfs) throws ReplicationException,<a name="line.3902"></a>
-<span class="sourceLineNo">3903</span>      IOException {<a name="line.3903"></a>
-<span class="sourceLineNo">3904</span>    if (tableCfs == null) {<a name="line.3904"></a>
-<span class="sourceLineNo">3905</span>      throw new ReplicationException("tableCfs is null");<a name="line.3905"></a>
-<span class="sourceLineNo">3906</span>    }<a name="line.3906"></a>
-<span class="sourceLineNo">3907</span>    ReplicationPeerConfig peerConfig = getReplicationPeerConfig(id);<a name="line.3907"></a>
-<span class="sourceLineNo">3908</span>    Map&lt;TableName, List&lt;String&gt;&gt; preTableCfs = peerConfig.getTableCFsMap();<a name="line.3908"></a>
-<span class="sourceLineNo">3909</span>    if (preTableCfs == null) {<a name="line.3909"></a>
-<span class="sourceLineNo">3910</span>      throw new ReplicationException("Table-Cfs for peer" + id + " is null");<a name="line.3910"></a>
-<span class="sourceLineNo">3911</span>    }<a name="line.3911"></a>
-<span class="sourceLineNo">3912</span>    for (Map.Entry&lt;TableName, ? extends Collection&lt;String&gt;&gt; entry : tableCfs.entrySet()) {<a name="line.3912"></a>
-<span class="sourceLineNo">3913</span><a name="line.3913"></a>
-<span class="sourceLineNo">3914</span>      TableName table = entry.getKey();<a name="line.3914"></a>
-<span class="sourceLineNo">3915</span>      Collection&lt;String&gt; removeCfs = entry.getValue();<a name="line.3915"></a>
-<span class="sourceLineNo">3916</span>      if (preTableCfs.containsKey(table)) {<a name="line.3916"></a>
-<span class="sourceLineNo">3917</span>        List&lt;String&gt; cfs = preTableCfs.get(table);<a name="line.3917"></a>
-<span class="sourceLineNo">3918</span>        if (cfs == null &amp;&amp; (removeCfs == null || removeCfs.isEmpty())) {<a name="line.3918"></a>
-<span class="sourceLineNo">3919</span>          preTableCfs.remove(table);<a name="line.3919"></a>
-<span class="sourceLineNo">3920</span>        } else if (cfs != null &amp;&amp; (removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.3920"></a>
-<span class="sourceLineNo">3921</span>          Set&lt;String&gt; cfSet = new HashSet&lt;String&gt;(cfs);<a name="line.3921"></a>
-<span class="sourceLineNo">3922</span>          cfSet.removeAll(removeCfs);<a name="line.3922"></a>
-<span class="sourceLineNo">3923</span>          if (cfSet.isEmpty()) {<a name="line.3923"></a>
-<span class="sourceLineNo">3924</span>            preTableCfs.remove(table);<a name="line.3924"></a>
-<span class="sourceLineNo">3925</span>          } else {<a name="line.3925"></a>
-<span class="sourceLineNo">3926</span>            preTableCfs.put(table, Lists.newArrayList(cfSet));<a name="line.3926"></a>
-<span class="sourceLineNo">3927</span>          }<a name="line.3927"></a>
-<span class="sourceLineNo">3928</span>        } else if (cfs == null &amp;&amp; (removeCfs != null &amp;&amp; !removeCfs.isEmpty())) {<a name="line.3928"></a>
-<span class="sourceLineNo">3929</span>          throw new ReplicationException("Cannot remove cf of table: " + table<a name="line.3929"></a>
-<span class="sourceLineNo">3930</span>              + " which doesn't specify cfs from table-cfs config in peer: " + id);<a name="line.3930"></a>
-<span class="sourceLineNo">3931</span>        } else if (cfs != null &amp;&amp; (removeCfs == null || removeCfs.isEmpty())) {<a name="line.3931"></a>
-<span class="sourceLineNo">3932</span>          throw new ReplicationException("Cannot remove table: " + table<a name="line.3932"></a>
-<span class="sourceLineNo">3933</span>              + " which has specified cfs from table-cfs config in peer: " + id);<a name="line.3933"></a>
-<span class="sourceLineNo">3934</span>        }<a name="line.3934"></a>
-<span class="sourceLineNo">3935</span>      } else {<a name="line.3935"></a>
-<span class="sourceLineNo">3936</span>        throw new ReplicationException("No table: " + table + " in table-cfs config of peer: " + id);<a name="line.3936"></a>
-<span class="sourceLineNo">3937</span>      }<a name="line.3937"></a>
-<span class="sourceLineNo">3938</span>    }<a name="line.3938"></a>
-<span class="sourceLineNo">3939</span>    updateReplicationPeerConfig(id, peerConfig);<a name="line.3939"></a>
-<span class="sourceLineNo">3940</span>  }<a name="line.3940"></a>
-<span class="sourceLineNo">3941</span><a name="line.3941"></a>
-<span class="sourceLineNo">3942</span>  @Override<a name="line.3942"></a>
-<span class="sourceLineNo">3943</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers() throws IOException {<a name="line.3943"></a>
-<span class="sourceLineNo">3944</span>    return listReplicationPeers((Pattern)null);<a name="line.3944"></a>
-<span class="sourceLineNo">3945</span>  }<a name="line.3945"></a>
-<span class="sourceLineNo">3946</span><a name="line.3946"></a>
-<span class="sourceLineNo">3947</span>  @Override<a name="line.3947"></a>
-<span class="sourceLineNo">3948</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers(String regex) throws IOException {<a name="line.3948"></a>
-<span class="sourceLineNo">3949</span>    return listReplicationPeers(Pattern.compile(regex));<a name="line.3949"></a>
-<span class="sourceLineNo">3950</span>  }<a name="line.3950"></a>
-<span class="sourceLineNo">3951</span><a name="line.3951"></a>
-<span class="sourceLineNo">3952</span>  @Override<a name="line.3952"></a>
-<span class="sourceLineNo">3953</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers(Pattern pattern)<a name="line.3953"></a>
-<span class="sourceLineNo">3954</span>      throws IOException {<a name="line.3954"></a>
-<span class="sourceLineNo">3955</span>    return executeCallable(new MasterCallable&lt;List&lt;ReplicationPeerDescription&gt;&gt;(getConnection(),<a name="line.3955"></a>
-<span class="sourceLineNo">3956</span>        getRpcControllerFactory()) {<a name="line.3956"></a>
-<span class="sourceLineNo">3957</span>      @Override<a name="line.3957"></a>
-<span class="sourceLineNo">3958</span>      protected List&lt;ReplicationPeerDescription&gt; rpcCall() throws Exception {<a name="line.3958"></a>
-<span class="sourceLineNo">3959</span>        List&lt;ReplicationProtos.ReplicationPeerDescription&gt; peersList = master.listReplicationPeers(<a name="line.3959"></a>
-<span class="sourceLineNo">3960</span>          getRpcController(), RequestConverter.buildListReplicationPeersRequest(pattern))<a name="line.3960"></a>
-<span class="sourceLineNo">3961</span>            .getPeerDescList();<a name="line.3961"></a>
-<span class="sourceLineNo">3962</span>        List&lt;ReplicationPeerDescription&gt; result = new ArrayList&lt;&gt;(peersList.size());<a name="line.3962"></a>
-<span class="sourceLineNo">3963</span>        for (ReplicationProtos.ReplicationPeerDescription peer : peersList) {<a name="line.3963"></a>
-<span class="sourceLineNo">3964</span>          result.add(ReplicationSerDeHelper.toReplicationPeerDescription(peer));<a name="line.3964"></a>
-<span class="sourceLineNo">3965</span>        }<a name="line.3965"></a>
-<span class="sourceLineNo">3966</span>        return result;<a name="line.3966"></a>
-<span class="sourceLineNo">3967</span>      }<a name="line.3967"></a>
-<span class="sourceLineNo">3968</span>    });<a name="line.3968"></a>
-<span class="sourceLineNo">3969</span>  }<a name="line.3969"></a>
-<span class="sourceLineNo">3970</span><a name="line.3970"></a>
-<span class="sourceLineNo">3971</span>  @Override<a name="line.3971"></a>
-<span class="sourceLineNo">3972</span>  public void drainRegionServers(List&lt;ServerName&gt; servers) throws IOException {<a name="line.3972"></a>
-<span class="sourceLineNo">3973</span>    final List&lt;HBaseProtos.ServerName&gt; pbServers = new ArrayList&lt;&gt;(servers.size());<a name="line.3973"></a>
-<span class="sourceLineNo">3974</span>    for (ServerName server : servers) {<a name="line.3974"></a>
-<span class="sourceLineNo">3975</span>      // Parse to ServerName to do simple validation.<a name="line.3975"></a>
-<span class="sourceLineNo">3976</span>      ServerName.parseServerName(server.toString());<a name="line.3976"></a>
-<span class="sourceLineNo">3977</span>      pbServers.add(ProtobufUtil.toServerName(server));<a name="line.3977"></a>
-<span class="sourceLineNo">3978</span>    }<a name="line.3978"></a>
-<span class="sourceLineNo">3979</span><a name="line.3979"></a>
-<span class="sourceLineNo">3980</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.3980"></a>
-<span class="sourceLineNo">3981</span>      @Override<a name="line.3981"></a>
-<span class="sourceLineNo">3982</span>      public Void rpcCall() throws ServiceException {<a name="line.3982"></a>
-<span class="sourceLineNo">3983</span>        DrainRegionServersRequest req =<a name="line.3983"></a>
-<span class="sourceLineNo">3984</span>            DrainRegionServersRequest.newBuilder().addAllServerName(pbServers).build();<a name="line.3984"></a>
-<span class="sourceLineNo">3985</span>        master.drainRegionServers(getRpcController(), req);<a name="line.3985"></a>
-<span class="sourceLineNo">3986</span>        return null;<a name="line.3986"></a>
-<span class="sourceLineNo">3987</span>      }<a name="line.3987"></a>
-<span class="sourceLineNo">3988</span>    });<a name="line.3988"></a>
+<span class="sourceLineNo">3872</span>    ReplicationSerDeHelper.appendTableCFsToReplicationPeerConfig(tableCfs, peerConfig);<a name="line.3872"></a>
+<span class="sourceLineNo">3873</span>    updateReplicationPeerConfig(id, peerConfig);<a name="line.3873"></a>
+<span class="sourceLineNo">3874</span>  }<a name="line.3874"></a>
+<span class="sourceLineNo">3875</span><a name="line.3875"></a>
+<span class="sourceLineNo">3876</span>  @Override<a name="line.3876"></a>
+<span class="sourceLineNo">3877</span>  public void removeReplicationPeerTableCFs(String id,<a name="line.3877"></a>
+<span class="sourceLineNo">3878</span>      Map&lt;TableName, ? extends Collection&lt;String&gt;&gt; tableCfs) throws ReplicationException,<a name="line.3878"></a>
+<span class="sourceLineNo">3879</span>      IOException {<a name="line.3879"></a>
+<span class="sourceLineNo">3880</span>    if (tableCfs == null) {<a name="line.3880"></a>
+<span class="sourceLineNo">3881</span>      throw new ReplicationException("tableCfs is null");<a name="line.3881"></a>
+<span class="sourceLineNo">3882</span>    }<a name="line.3882"></a>
+<span class="sourceLineNo">3883</span>    ReplicationPeerConfig peerConfig = getReplicationPeerConfig(id);<a name="line.3883"></a>
+<span class="sourceLineNo">3884</span>    ReplicationSerDeHelper.removeTableCFsFromReplicationPeerConfig(tableCfs, peerConfig, id);<a name="line.3884"></a>
+<span class="sourceLineNo">3885</span>    updateReplicationPeerConfig(id, peerConfig);<a name="line.3885"></a>
+<span class="sourceLineNo">3886</span>  }<a name="line.3886"></a>
+<span class="sourceLineNo">3887</span><a name="line.3887"></a>
+<span class="sourceLineNo">3888</span>  @Override<a name="line.3888"></a>
+<span class="sourceLineNo">3889</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers() throws IOException {<a name="line.3889"></a>
+<span class="sourceLineNo">3890</span>    return listReplicationPeers((Pattern)null);<a name="line.3890"></a>
+<span class="sourceLineNo">3891</span>  }<a name="line.3891"></a>
+<span class="sourceLineNo">3892</span><a name="line.3892"></a>
+<span class="sourceLineNo">3893</span>  @Override<a name="line.3893"></a>
+<span class="sourceLineNo">3894</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers(String regex) throws IOException {<a name="line.3894"></a>
+<span class="sourceLineNo">3895</span>    return listReplicationPeers(Pattern.compile(regex));<a name="line.3895"></a>
+<span class="sourceLineNo">3896</span>  }<a name="line.3896"></a>
+<span class="sourceLineNo">3897</span><a name="line.3897"></a>
+<span class="sourceLineNo">3898</span>  @Override<a name="line.3898"></a>
+<span class="sourceLineNo">3899</span>  public List&lt;ReplicationPeerDescription&gt; listReplicationPeers(Pattern pattern)<a name="line.3899"></a>
+<span class="sourceLineNo">3900</span>      throws IOException {<a name="line.3900"></a>
+<span class="sourceLineNo">3901</span>    return executeCallable(new MasterCallable&lt;List&lt;ReplicationPeerDescription&gt;&gt;(getConnection(),<a name="line.3901"></a>
+<span class="sourceLineNo">3902</span>        getRpcControllerFactory()) {<a name="line.3902"></a>
+<span class="sourceLineNo">3903</span>      @Override<a name="line.3903"></a>
+<span class="sourceLineNo">3904</span>      protected List&lt;ReplicationPeerDescription&gt; rpcCall() throws Exception {<a name="line.3904"></a>
+<span class="sourceLineNo">3905</span>        List&lt;ReplicationProtos.ReplicationPeerDescription&gt; peersList = master.listReplicationPeers(<a name="line.3905"></a>
+<span class="sourceLineNo">3906</span>          getRpcController(), RequestConverter.buildListReplicationPeersRequest(pattern))<a name="line.3906"></a>
+<span class="sourceLineNo">3907</span>            .getPeerDescList();<a name="line.3907"></a>
+<span class="sourceLineNo">3908</span>        List&lt;ReplicationPeerDescription&gt; result = new ArrayList&lt;&gt;(peersList.size());<a name="line.3908"></a>
+<span class="sourceLineNo">3909</span>        for (ReplicationProtos.ReplicationPeerDescription peer : peersList) {<a name="line.3909"></a>
+<span class="sourceLineNo">3910</span>          result.add(ReplicationSerDeHelper.toReplicationPeerDescription(peer));<a name="line.3910"></a>
+<span class="sourceLineNo">3911</span>        }<a name="line.3911"></a>
+<span class="sourceLineNo">3912</span>        return result;<a name="line.3912"></a>
+<span class="sourceLineNo">3913</span>      }<a name="line.3913"></a>
+<span class="sourceLineNo">3914</span>    });<a name="line.3914"></a>
+<span class="sourceLineNo">3915</span>  }<a name="line.3915"></a>
+<span class="sourceLineNo">3916</span><a name="line.3916"></a>
+<span class="sourceLineNo">3917</span>  @Override<a name="line.3917"></a>
+<span class="sourceLineNo">3918</span>  public void drainRegionServers(List&lt;ServerName&gt; servers) throws IOException {<a name="line.3918"></a>
+<span class="sourceLineNo">3919</span>    final List&lt;HBaseProtos.ServerName&gt; pbServers = new ArrayList&lt;&gt;(servers.size());<a name="line.3919"></a>
+<span class="sourceLineNo">3920</span>    for (ServerName server : servers) {<a name="line.3920"></a>
+<span class="sourceLineNo">3921</span>      // Parse to ServerName to do simple validation.<a name="line.3921"></a>
+<span class="sourceLineNo">3922</span>      ServerName.parseServerName(server.toString());<a name="line.3922"></a>
+<span class="sourceLineNo">3923</span>      pbServers.add(ProtobufUtil.toServerName(server));<a name="line.3923"></a>
+<span class="sourceLineNo">3924</span>    }<a name="line.3924"></a>
+<span class="sourceLineNo">3925</span><a name="line.3925"></a>
+<span class="sourceLineNo">3926</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.3926"></a>
+<span class="sourceLineNo">3927</span>      @Override<a name="line.3927"></a>
+<span class="sourceLineNo">3928</span>      public Void rpcCall() throws ServiceException {<a name="line.3928"></a>
+<span class="sourceLineNo">3929</span>        DrainRegionServersRequest req =<a name="line.3929"></a>
+<span class="sourceLineNo">3930</span>            DrainRegionServersRequest.newBuilder().addAllServerName(pbServers).build();<a name="line.3930"></a>
+<span class="sourceLineNo">3931</span>        master.drainRegionServers(getRpcController(), req);<a name="line.3931"></a>
+<span class="sourceLineNo">3932</span>        return null;<a name="line.3932"></a>
+<span class="sourceLineNo">3933</span>      }<a name="line.3933"></a>
+<span class="sourceLineNo">3934</span>    });<a name="line.3934"></a>
+<span class="sourceLineNo">3935</span>  }<a name="line.3935"></a>
+<span class="sourceLineNo">3936</span><a name="line.3936"></a>
+<span class="sourceLineNo">3937</span>  @Override<a name="line.3937"></a>
+<span class="sourceLineNo">3938</span>  public List&lt;ServerName&gt; listDrainingRegionServers() throws IOException {<a name="line.3938"></a>
+<span class="sourceLineNo">3939</span>    return executeCallable(new MasterCallable&lt;List&lt;ServerName&gt;&gt;(getConnection(),<a name="line.3939"></a>
+<span class="sourceLineNo">3940</span>              getRpcControllerFactory()) {<a name="line.3940"></a>
+<span class="sourceLineNo">3941</span>      @Override<a name="line.3941"></a>
+<span class="sourceLineNo">3942</span>      public List&lt;ServerName&gt; rpcCall() throws ServiceException {<a name="line.3942"></a>
+<span class="sourceLineNo">3943</span>        ListDrainingRegionServersRequest req = ListDrainingRegionServersRequest.newBuilder().build();<a name="line.3943"></a>
+<span class="sourceLineNo">3944</span>        List&lt;ServerName&gt; servers = new ArrayList&lt;&gt;();<a name="line.3944"></a>
+<span class="sourceLineNo">3945</span>        for (HBaseProtos.ServerName server : master.listDrainingRegionServers(null, req)<a name="line.3945"></a>
+<span class="sourceLineNo">3946</span>            .getServerNameList()) {<a name="line.3946"></a>
+<span class="sourceLineNo">3947</span>          servers.add(ProtobufUtil.toServerName(server));<a name="line.3947"></a>
+<span class="sourceLineNo">3948</span>        }<a name="line.3948"></a>
+<span class="sourceLineNo">3949</span>        return servers;<a name="line.3949"></a>
+<span class="sourceLineNo">3950</span>      }<a name="line.3950"></a>
+<span class="sourceLineNo">3951</span>    });<a name="line.3951"></a>
+<span class="sourceLineNo">3952</span>  }<a name="line.3952"></a>
+<span class="sourceLineNo">3953</span><a name="line.3953"></a>
+<span class="sourceLineNo">3954</span>  @Override<a name="line.3954"></a>
+<span class="sourceLineNo">3955</span>  public void removeDrainFromRegionServers(List&lt;ServerName&gt; servers) throws IOException {<a name="line.3955"></a>
+<span class="sourceLineNo">3956</span>    final List&lt;HBaseProtos.ServerName&gt; pbServers = new ArrayList&lt;&gt;(servers.size());<a name="line.3956"></a>
+<span class="sourceLineNo">3957</span>    for (ServerName server : servers) {<a name="line.3957"></a>
+<span class="sourceLineNo">3958</span>      pbServers.add(ProtobufUtil.toServerName(server));<a name="line.3958"></a>
+<span class="sourceLineNo">3959</span>    }<a name="line.3959"></a>
+<span class="sourceLineNo">3960</span><a name="line.3960"></a>
+<span class="sourceLineNo">3961</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.3961"></a>
+<span class="sourceLineNo">3962</span>      @Override<a name="line.3962"></a>
+<span class="sourceLineNo">3963</span>      public Void rpcCall() throws ServiceException {<a name="line.3963"></a>
+<span class="sourceLineNo">3964</span>        RemoveDrainFromRegionServersRequest req = RemoveDrainFromRegionServersRequest.newBuilder()<a name="line.3964"></a>
+<span class="sourceLineNo">3965</span>            .addAllServerName(pbServers).build();<a name="line.3965"></a>
+<span class="sourceLineNo">3966</span>        master.removeDrainFromRegionServers(getRpcController(), req);<a name="line.3966"></a>
+<span class="sourceLineNo">3967</span>        return null;<a name="line.3967"></a>
+<span class="sourceLineNo">3968</span>      }<a name="line.3968"></a>
+<span class="sourceLineNo">3969</span>    });<a name="line.3969"></a>
+<span class="sourceLineNo">3970</span>  }<a name="line.3970"></a>
+<span class="sourceLineNo">3971</span><a name="line.3971"></a>
+<span class="sourceLineNo">3972</span>  @Override<a name="line.3972"></a>
+<span class="sourceLineNo">3973</span>  public List&lt;TableCFs&gt; listReplicatedTableCFs() throws IOException {<a name="line.3973"></a>
+<span class="sourceLineNo">3974</span>    List&lt;TableCFs&gt; replicatedTableCFs = new ArrayList&lt;&gt;();<a name="line.3974"></a>
+<span class="sourceLineNo">3975</span>    HTableDescriptor[] tables = listTables();<a name="line.3975"></a>
+<span class="sourceLineNo">3976</span>    for (HTableDescriptor table : tables) {<a name="line.3976"></a>
+<span class="sourceLineNo">3977</span>      HColumnDescriptor[] columns = table.getColumnFamilies();<a name="line.3977"></a>
+<span class="sourceLineNo">3978</span>      Map&lt;String, Integer&gt; cfs = new HashMap&lt;&gt;();<a name="line.3978"></a>
+<span class="sourceLineNo">3979</span>      for (HColumnDescriptor column : columns) {<a name="line.3979"></a>
+<span class="sourceLineNo">3980</span>        if (column.getScope() != HConstants.REPLICATION_SCOPE_LOCAL) {<a name="line.3980"></a>
+<span class="sourceLineNo">3981</span>          cfs.put(column.getNameAsString(), column.getScope());<a name="line.3981"></a>
+<span class="sourceLineNo">3982</span>        }<a name="line.3982"></a>
+<span class="sourceLineNo">3983</span>      }<a name="line.3983"></a>
+<span class="sourceLineNo">3984</span>      if (!cfs.isEmpty()) {<a name="line.3984"></a>
+<span class="sourceLineNo">3985</span>        replicatedTableCFs.add(new TableCFs(table.getTableName(), cfs));<a name="line.3985"></a>
+<span class="sourceLineNo">3986</span>      }<a name="line.3986"></a>
+<span class="sourceLineNo">3987</span>    }<a name="line.3987"></a>
+<span class="sourceLineNo">3988</span>    return replicatedTableCFs;<a name="line.3988"></a>
 <span class="sourceLineNo">3989</span>  }<a name="line.3989"></a>
 <span class="sourceLineNo">3990</span><a name="line.3990"></a>
 <span class="sourceLineNo">3991</span>  @Override<a name="line.3991"></a>
-<span class="sourceLineNo">3992</span>  public List&lt;ServerName&gt; listDrainingRegionServers() throws IOException {<a name="line.3992"></a>
-<span class="sourceLineNo">3993</span>    return executeCallable(new MasterCallable&lt;List&lt;ServerName&gt;&gt;(getConnection(),<a name="line.3993"></a>
-<span class="sourceLineNo">3994</span>              getRpcControllerFactory()) {<a name="line.3994"></a>
-<span class="sourceLineNo">3995</span>      @Override<a name="line.3995"></a>
-<span class="sourceLineNo">3996</span>      public List&lt;ServerName&gt; rpcCall() throws ServiceException {<a name="line.3996"></a>
-<span class="sourceLineNo">3997</span>        ListDrainingRegionServersRequest req = ListDrainingRegionServersRequest.newBuilder().build();<a name="line.3997"></a>
-<span class="sourceLineNo">3998</span>        List&lt;ServerName&gt; servers = new ArrayList&lt;&gt;();<a name="line.3998"></a>
-<span class="sourceLineNo">3999</span>        for (HBaseProtos.ServerName server : master.listDrainingRegionServers(null, req)<a name="line.3999"></a>
-<span class="sourceLineNo">4000</span>            .getServerNameList()) {<a name="line.4000"></a>
-<span class="sourceLineNo">4001</span>          servers.add(ProtobufUtil.toServerName(server));<a name="line.4001"></a>
-<span class="sourceLineNo">4002</span>        }<a name="line.4002"></a>
-<span class="sourceLineNo">4003</span>        return servers;<a name="line.4003"></a>
-<span class="sourceLineNo">4004</span>      }<a name="line.4004"></a>
-<span class="sourceLineNo">4005</span>    });<a name="line.4005"></a>
-<span class="sourceLineNo">4006</span>  }<a name="line.4006"></a>
-<span class="sourceLineNo">4007</span><a name="line.4007"></a>
-<span class="sourceLineNo">4008</span>  @Override<a name="line.4008"></a>
-<span class="sourceLineNo">4009</span>  public void removeDrainFromRegionServers(List&lt;ServerName&gt; servers) throws IOException {<a name="line.4009"></a>
-<span class="sourceLineNo">4010</span>    final List&lt;HBaseProtos.ServerName&gt; pbServers = new ArrayList&lt;&gt;(servers.size());<a name="line.4010"></a>
-<span class="sourceLineNo">4011</span>    for (ServerName server : servers) {<a name="line.4011"></a>
-<span class="sourceLineNo">4012</span>      pbServers.add(ProtobufUtil.toServerName(server));<a name="line.4012"></a>
+<span class="sourceLineNo">3992</span>  public void enableTableReplication(final TableName tableName) throws IOException {<a name="line.3992"></a>
+<span class="sourceLineNo">3993</span>    if (tableName == null) {<a name="line.3993"></a>
+<span class="sourceLineNo">3994</span>      throw new IllegalArgumentException("Table name cannot be null");<a name="line.3994"></a>
+<span class="sourceLineNo">3995</span>    }<a name="line.3995"></a>
+<span class="sourceLineNo">3996</span>    if (!tableExists(tableName)) {<a name="line.3996"></a>
+<span class="sourceLineNo">3997</span>      throw new TableNotFoundException("Table '" + tableName.getNameAsString()<a name="line.3997"></a>
+<span class="sourceLineNo">3998</span>          + "' does not exists.");<a name="line.3998"></a>
+<span class="sourceLineNo">3999</span>    }<a name="line.3999"></a>
+<span class="sourceLineNo">4000</span>    byte[][] splits = getTableSplits(tableName);<a name="line.4000"></a>
+<span class="sourceLineNo">4001</span>    checkAndSyncTableDescToPeers(tableName, splits);<a name="line.4001"></a>
+<span class="sourceLineNo">4002</span>    setTableRep(tableName, true);<a name="line.4002"></a>
+<span class="sourceLineNo">4003</span>  }<a name="line.4003"></a>
+<span class="sourceLineNo">4004</span><a name="line.4004"></a>
+<span class="sourceLineNo">4005</span>  @Override<a name="line.4005"></a>
+<span class="sourceLineNo">4006</span>  public void disableTableReplication(final TableName tableName) throws IOException {<a name="line.4006"></a>
+<span class="sourceLineNo">4007</span>    if (tableName == null) {<a name="line.4007"></a>
+<span class="sourceLineNo">4008</span>      throw new IllegalArgumentException("Table name is null");<a name="line.4008"></a>
+<span class="sourceLineNo">4009</span>    }<a name="line.4009"></a>
+<span class="sourceLineNo">4010</span>    if (!tableExists(tableName)) {<a name="line.4010"></a>
+<span class="sourceLineNo">4011</span>      throw new TableNotFoundException("Table '" + tableName.getNamespaceAsString()<a name="line.4011"></a>
+<span class="sourceLineNo">4012</span>          + "' does not exists.");<a name="line.4012"></a>
 <span class="sourceLineNo">4013</span>    }<a name="line.4013"></a>
-<span class="sourceLineNo">4014</span><a name="line.4014"></a>
-<span class="sourceLineNo">4015</span>    executeCallable(new MasterCallable&lt;Void&gt;(getConnection(), getRpcControllerFactory()) {<a name="line.4015"></a>
-<span class="sourceLineNo">4016</span>      @Override<a name="line.4016"></a>
-<span class="sourceLineNo">4017</span>      public Void rpcCall() throws ServiceException {<a name="line.4017"></a>
-<span class="sourceLineNo">4018</span>        RemoveDrainFromRegionServersRequest req = RemoveDrainFromRegionServersRequest.newBuilder()<a name="line.4018"></a>
-<span class="sourceLineNo">4019</span>            .addAllServerName(pbServers).build();<a name="line.4019"></a>
-<span class="sourceLineNo">4020</span>        master.removeDrainFromRegionServers(getRpcController(), req);<a name="line.4020"></a>
-<span class="sourceLineNo">4021</span>        return null;<a name="line.4021"></a>
-<span class="sourceLineNo">4022</span>      }<a name="line.4022"></a>
-<span class="sourceLineNo">4023</span>    });<a name="line.4023"></a>
-<span class="sourceLineNo">4024</span>  }<a name="line.4024"></a>
-<span class="sourceLineNo">4025</span><a name="line.4025"></a>
-<span class="sourceLineNo">4026</span>  @Override<a name="line.4026"></a>
-<span class="sourceLineNo">4027</span>  public List&lt;TableCFs&gt; listReplicatedTableCFs() throws IOException {<a name="line.4027"></a>
-<span class="sourceLineNo">4028</span>    List&lt;TableCFs&gt; replicatedTableCFs = new ArrayList&lt;&gt;();<a name="line.4028"></a>
-<span class="sourceLineNo">4029</span>    HTableDescriptor[] tables = listTables();<a name="line.4029"></a>
-<span class="sourceLineNo">4030</span>    for (HTableDescriptor table : tables) {<a name="line.4030"></a>
-<span class="sourceLineNo">4031</span>      HColumnDescriptor[] columns = table.getColumnFamilies();<a name="line.4031"></a>
-<span class="sourceLineNo">4032</span>      Map&lt;String, Integer&gt; cfs = new HashMap&lt;&gt;();<a name="line.4032"></a>
-<span class="sourceLineNo">4033</span>      for (HColumnDescriptor column : columns) {<a name="line.4033"></a>
-<span class="sourceLineNo">4034</span>        if (column.getScope() != HConstants.REPLICATION_SCOPE_LOCAL) {<a name="line.4034"></a>
-<span class="sourceLineNo">4035</span>          cfs.put(column.getNameAsString(), column.getScope());<a name="line.4035"></a>
-<span class="sourceLineNo">4036</span>        }<a name="line.4036"></a>
-<span class="sourceLineNo">4037</span>      }<a name="line.4037"></a>
-<span class="sourceLineNo">4038</span>      if (!cfs.isEmpty()) {<a name="line.4038"></a>
-<span class="sourceLineNo">4039</span>        replicatedTableCFs.add(new TableCFs(table.getTableName(), cfs));<a name="line.4039"></a>
-<span class="sourceLineNo">4040</span>      }<a name="line.4040"></a>
-<span class="sourceLineNo">4041</span>    }<a name="line.4041"></a>
-<span class="sourceLineNo">4042</span>    return replicatedTableCFs;<a name="line.4042"></a>
-<span class="sourceLineNo">4043</span>  }<a name="line.4043"></a>
-<span class="sourceLineNo">4044</span><a name="line.4044"></a>
-<span class="sourceLineNo">4045</span>  @Override<a name="line.4045"></a>
-<span class="sourceLineNo">4046</span>  public void enableTableReplication(final TableName tableName) throws IOException {<a name="line.4046"></a>
-<span class="sourceLineNo">4047</span>    if (tableName == null) {<a name="line.4047"></a>
-<span class="sourceLineNo">4048</span>      throw new IllegalArgumentException("Table name cannot be null");<a name="line.4048"></a>
-<span class="sourceLineNo">4049</span>    }<a name="line.4049"></a>
-<span class="sourceLineNo">4050</span>    if (!tableExists(tableName)) {<a name="line.4050"></a>
-<span class="sourceLineNo">4051</span>      throw new TableNotFoundException("Table '" + tableName.getNameAsString()<a name="line.4051"></a>
-<span class="sourceLineNo">4052</span>          + "' does not exists.");<a name="line.4052"></a>
-<span class="sourceLineNo">4053</span>    }<a name="line.4053"></a>
-<span class="sourceLineNo">4054</span>    byte[][] splits = getTableSplits(tableName);<a name="line.4054"></a>
-<span class="sourceLineNo">4055</span>    checkAndSyncTableDescToPeers(tableName, splits);<a name="line.4055"></a>
-<span class="sourceLineNo">4056</span>    setTableRep(tableName, true);<a name="line.4056"></a>
-<span class="sourceLineNo">4057</span>  }<a name="line.4057"></a>
-<span class="sourceLineNo">4058</span><a name="line.4058"></a>
-<span class="sourceLineNo">4059</span>  @Override<a name="line.4059"></a>
-<span class="sourceLineNo">4060</span>  public void disableTableReplication(final TableName tableName) throws IOException {<a name="line.4060"></a>
-<span class="sourceLineNo">4061</span>    if (tableName == null) {<a name="line.4061"></a>
-<span class="sourceLineNo">4062</span>      throw new IllegalArgumentException("Table name is null");<a name="line.4062"></a>
-<span class="sourceLineNo">4063</span>    }<a name="line.4063"></a>
-<span class="sourceLineNo">4064</span>    if (!tableExists(tableName)) {<a name="line.4064"></a>
-<span class="sourceLineNo">4065</span>      throw new TableNotFoundException("Table '" + tableName.getNamespaceAsString()<a name="line.4065"></a>
-<span class="sourceLineNo">4066</span>          + "' does not exists.");<a name="line.4066"></a>
-<span class="sourceLineNo">4067</span>    }<a name="line.4067"></a>
-<span class="sourceLineNo">4068</span>    setTableRep(tableName, false);<a name="line.4068"></a>
-<span class="sourceLineNo">4069</span>  }<a name="line.4069"></a>
-<span class="sourceLineNo">4070</span><a name="line.4070"></a>
-<span class="sourceLineNo">4071</span>  /**<a name="line.4071"></a>
-<span class="sourceLineNo">4072</span>   * Copies the REPLICATION_SCOPE of table descriptor passed as an argument. Before copy, the method<a name="line.4072"></a>
-<span class="sourceLineNo">4073</span>   * ensures that the name of table and column-families should match.<a name="line.4073"></a>
-<span class="sourceLineNo">4074</span>   * @param peerHtd descriptor on peer cluster<a name="line.4074"></a>
-<span class="sourceLineNo">4075</span>   * @param localHtd - The HTableDescriptor of table from source cluster.<a name="line.4075"></a>
-<span class="sourceLineNo">4076</span>   * @return true If the name of table and column families match and REPLICATION_SCOPE copied<a name="line.4076"></a>
-<span class="sourceLineNo">4077</span>   *         successfully. false If there is any mismatch in the names.<a name="line.4077"></a>
-<span class="sourceLineNo">4078</span>   */<a name="line.4078"></a>
-<span class="sourceLineNo">4079</span>  private boolean copyReplicationScope(final HTableDescriptor peerHtd,<a name="line.4079"></a>
-<span class="sourceLineNo">4080</span>      final HTableDescriptor localHtd) {<a name="line.4080"></a>
-<span class="sourceLineNo">4081</span>    // Copy the REPLICATION_SCOPE only when table names and the names of<a name="line.4081"></a>
-<span class="sourceLineNo">4082</span>    // Column-Families are same.<a name="line.4082"></a>
-<span class="sourceLineNo">4083</span>    int result = peerHtd.getTableName().compareTo(localHtd.getTableName());<a name="line.4083"></a>
+<span class="sourceLineNo">4014</span>    setTableRep(tableName, false);<a name="line.4014"></a>
+<span class="sourceLineNo">4015</span>  }<a name="line.4015"></a>
+<span class="sourceLineNo">4016</span><a name="line.4016"></a>
+<span class="sourceLineNo">4017</span>  /**<a name="line.4017"></a>
+<span class="sourceLineNo">4018</span>   * Copies the REPLICATION_SCOPE of table descriptor passed as an argument. Before copy, the method<a name="line.4018"></a>
+<span class="sourceLineNo">4019</span>   * ensures that the name of table and column-families should match.<a name="line.4019"></a>
+<span class="sourceLineNo">4020</span>   * @param peerHtd descriptor on peer cluster<a name="line.4020"></a>
+<span class="sourceLineNo">4021</span>   * @param localHtd - The HTableDescriptor of table from source cluster.<a name="line.4021"></a>
+<span class="sourceLineNo">4022</span>   * @return true If the name of table and column families match and REPLICATION_SCOPE copied<a name="line.4022"></a>
+<span class="sourceLineNo">4023</span>   *         successfully. false If there is any mismatch in the names.<a name="line.4023"></a>
+<span class="sourceLineNo">4024</span>   */<a name="line.4024"></a>
+<span class="sourceLineNo">4025</span>  private boolean copyReplicationScope(final HTableDescriptor peerHtd,<a name="line.4025"></a>
+<span class="sourceLineNo">4026</span>      final HTableDescriptor localHtd) {<a name="line.4026"></a>
+<span class="sourceLineNo">4027</span>    // Copy the REPLICATION_SCOPE only when table names and the names of<a name="line.4027"></a>
+<span class="sourceLineNo">4028</span>    // Column-Families are same.<a name="line.4028"></a>
+<span class="sourceLineNo">4029</span>    int result = peerHtd.getTableName().compareTo(localHtd.getTableName());<a name="line.4029"></a>
+<span class="sourceLineNo">4030</span><a name="line.4030"></a>
+<span class="sourceLineNo">4031</span>    if (result == 0) {<a name="line.4031"></a>
+<span class="sourceLineNo">4032</span>      Iterator&lt;HColumnDescriptor&gt; remoteHCDIter = peerHtd.getFamilies().iterator();<a name="line.4032"></a>
+<span class="sourceLineNo">4033</span>      Iterator&lt;HColumnDescriptor&gt; localHCDIter = localHtd.getFamilies().iterator();<a name="line.4033"></a>
+<span class="sourceLineNo">4034</span><a name="line.4034"></a>
+<span class="sourceLineNo">4035</span>      while (remoteHCDIter.hasNext() &amp;&amp; localHCDIter.hasNext()) {<a name="line.4035"></a>
+<span class="sourceLineNo">4036</span>        HColumnDescriptor remoteHCD = remoteHCDIter.next();<a name="line.4036"></a>
+<span class="sourceLineNo">4037</span>        HColumnDescriptor localHCD = localHCDIter.next();<a name="line.4037"></a>
+<span class="sourceLineNo">4038</span><a name="line.4038"></a>
+<span class="sourceLineNo">4039</span>        String remoteHCDName = remoteHCD.getNameAsString();<a name="line.4039"></a>
+<span class="sourceLineNo">4040</span>        String localHCDName = localHCD.getNameAsString();<a name="line.4040"></a>
+<span class="sourceLineNo">4041</span><a name="line.4041"></a>
+<span class="sourceLineNo">4042</span>        if (remoteHCDName.equals(localHCDName)) {<a name="line.4042"></a>
+<span class="sourceLineNo">4043</span>          remoteHCD.setScope(localHCD.getScope());<a name="line.4043"></a>
+<span class="sourceLineNo">4044</span>        } else {<a name="line.4044"></a>
+<span class="sourceLineNo">4045</span>          result = -1;<a name="line.4045"></a>
+<span class="sourceLineNo">4046</span>          break;<a name="line.4046"></a>
+<span class="sourceLineNo">4047</span>        }<a name="line.4047"></a>
+<span class="sourceLineNo">4048</span>      }<a name="line.4048"></a>
+<span class="sourceLineNo">4049</span>      if (remoteHCDIter.hasNext() || localHCDIter.hasNext()) {<a name="line.4049"></a>
+<span class="sourceLineNo">4050</span>        return false;<a name="line.4050"></a>
+<span class="sourceLineNo">4051</span>      }<a name="line.4051"></a>
+<span class="sourceLineNo">4052</span>    }<a name="line.4052"></a>
+<span class="sourceLineNo">4053</span><a name="line.4053"></a>
+<span class="sourceLineNo">4054</span>    return result == 0;<a name="line.4054"></a>
+<span class="sourceLineNo">4055</span>  }<a name="line.4055"></a>
+<span class="sourceLineNo">4056</span><a name="line.4056"></a>
+<span class="sourceLineNo">4057</span>  /**<a name="line.4057"></a>
+<span class="sourceLineNo">4058</span>   * Compare the contents of the descriptor with another one passed as a parameter for replication<a name="line.4058"></a>
+<span class="sourceLineNo">4059</span>   * purpose. The REPLICATION_SCOPE field is ignored during comparison.<a name="line.4059"></a>
+<span class="sourceLineNo">4060</span>   * @param peerHtd descriptor on peer cluster<a name="line.4060"></a>
+<span class="sourceLineNo">4061</span>   * @param localHtd descriptor on source cluster which needs to be replicated.<a name="line.4061"></a>
+<span class="sourceLineNo">4062</span>   * @return true if the contents of the two descriptors match (ignoring just REPLICATION_SCOPE).<a name="line.4062"></a>
+<span class="sourceLineNo">4063</span>   * @see java.lang.Object#equals(java.lang.Object)<a name="line.4063"></a>
+<span class="sourceLineNo">4064</span>   */<a name="line.4064"></a>
+<span class="sourceLineNo">4065</span>  private boolean compareForReplication(HTableDescriptor peerHtd, HTableDescriptor localHtd) {<a name="line.4065"></a>
+<span class="sourceLineNo">4066</span>    if (peerHtd == localHtd) {<a name="line.4066"></a>
+<span class="sourceLineNo">4067</span>      return true;<a name="line.4067"></a>
+<span class="sourceLineNo">4068</span>    }<a name="line.4068"></a>
+<span class="sourceLineNo">4069</span>    if (peerHtd == null) {<a name="line.4069"></a>
+<span class="sourceLineNo">4070</span>      return false;<a name="line.4070"></a>
+<span class="sourceLineNo">4071</span>    }<a name="line.4071"></a>
+<span class="sourceLineNo">4072</span>    boolean result = false;<a name="line.4072"></a>
+<span class="sourceLineNo">4073</span><a name="line.4073"></a>
+<span class="sourceLineNo">4074</span>    // Create a copy of peer HTD as we need to change its replication<a name="line.4074"></a>
+<span class="sourceLineNo">4075</span>    // scope to match with the local HTD.<a name="line.4075"></a>
+<span class="sourceLineNo">4076</span>    HTableDescriptor peerHtdCopy = new HTableDescriptor(peerHtd);<a name="line.4076"></a>
+<span class="sourceLineNo">4077</span><a name="line.4077"></a>
+<span class="sourceLineNo">4078</span>    result = copyReplicationScope(peerHtdCopy, localHtd);<a name="line.4078"></a>
+<span class="sourceLineNo">4079</span><a name="line.4079"></a>
+<span class="sourceLineNo">4080</span>    // If copy was successful, compare the two tables now.<a name="line.4080"></a>
+<span class="sourceLineNo">4081</span>    if (result) {<a name="line.4081"></a>
+<span class="sourceLineNo">4082</span>      result = (peerHtdCopy.compareTo(localHtd) == 0);<a name="line.4082"></a>
+<span class="sourceLineNo">4083</span>    }<a name="line.4083"></a>
 <span class="sourceLineNo">4084</span><a name="line.4084"></a>
-<span class="sourceLineNo">4085</span>    if (result == 0) {<a name="line.4085"></a>
-<span class="sourceLineNo">4086</span>      Iterator&lt;HColumnDescriptor&gt; remoteHCDIter = peerHtd.getFamilies().iterator();<a name="line.4086"></a>
-<span class="sourceLineNo">4087</span>      Iterator&lt;HColumnDescriptor&gt; localHCDIter = localHtd.getFamilies().iterator();<a name="line.4087"></a>
-<span class="sourceLineNo">4088</span><a name="line.4088"></a>
-<span class="sourceLineNo">4089</span>      while (remoteHCDIter.hasNext() &amp;&amp; localHCDIter.hasNext()) {<a name="line.4089"></a>
-<span class="sourceLineNo">4090</span>        HColumnDescriptor remoteHCD = remoteHCDIter.next();<a name="line.4090"></a>
-<span class="sourceLineNo">4091</span>        HColumnDescriptor localHCD = localHCDIter.next();<a name="line.4091"></a>
-<span class="sourceLineNo">4092</span><a name="line.4092"></a>
-<span class="sourceLineNo">4093</span>        String remoteHCDName = remoteHCD.getNameAsString();<a name="line.4093"></a>
-<span class="sourceLineNo">4094</span>        String localHCDName = localHCD.getNameAsString();<a name="line.4094"></a>
-<span class="sourceLineNo">4095</span><a name="line.4095"></a>
-<span class="sourceLineNo">4096</span>        if (remoteHCDName.equals(localHCDName)) {<a name="line.4096"></a>
-<span class="sourceLineNo">4097</span>          remoteHCD.setScope(localHCD.getScope());<a name="line.4097"></a>
-<span class="sourceLineNo">4098</span>        } else {<a name="line.4098"></a>
-<span class="sourceLineNo">4099</span>          result = -1;<a name="line.4099"></a>
-<span class="sourceLineNo">4100</span>          break;<a name="line.4100"></a>
-<span class="sourceLineNo">4101</span>        }<a name="line.4101"></a>
-<span class="sourceLineNo">4102</span>      }<a name="line.4102"></a>
-<span class="sourceLineNo">4103</span>      if (remoteHCDIter.hasNext() || localHCDIter.hasNext()) {<a name="line.4103"></a>
-<span class="sourceLineNo">4104</span>        return false;<a name="line.4104"></a>
-<span class="sourceLineNo">4105</span>      }<a name="line.4105"></a>
-<span class="sourceLineNo">4106</span>    }<a name="line.4106"></a>
-<span class="sourceLineNo">4107</span><a name="line.4107"></a>
-<span class="sourceLineNo">4108</span>    return result == 0;<a name="line.4108"></a>
-<span class="sourceLineNo">4109</span>  }<a name="line.4109"></a>
-<span class="sourceLineNo">4110</span><a name="line.4110"></a>
-<span class="sourceLineNo">4111</span>  /**<a name="line.4111"></a>
-<span class="sourceLineNo">4112</span>   * Compare the contents of the descriptor with another one passed as a parameter for replication<a name="line.4112"></a>
-<span class="sourceLineNo">4113</span>   * purpose. The REPLICATION_SCOPE field is ignored during comparison.<a name="line.4113"></a>
-<span class="sourceLineNo">4114</span>   * @param peerHtd descriptor on peer cluster<a name="line.4114"></a>
-<span class="sourceLineNo">4115</span>   * @param localHtd descriptor on source cluster which needs to be replicated.<a name="line.4115"></a>
-<span class="sourceLineNo">4116</span>   * @return true if the contents of the two descriptors match (ignoring just REPLICATION_SCOPE).<a name="line.4116"></a>
-<span class="sourceLineNo">4117</span>   * @see java.lang.Object#equals(java.lang.Object)<a name="line.4117"></a>
-<span class="sourceLineNo">4118</span>   */<a name="line.4118"></a>
-<span class="sourceLineNo">4119</span>  private boolean compareForReplication(HTableDescriptor peerHtd, HTableDescriptor localHtd) {<a name="line.4119"></a>
-<span class="sourceLineNo">4120</span>    if (peerHtd == localHtd) {<a name="line.4120"></a>
-<span class="sourceLineNo">4121</span>      return true;<a name="line.4121"></a>
-<span class="sourceLineNo">4122</span>    }<a name="line.4122"></a>
-<span class="sourceLineNo">4123</span>    if (peerHtd == null) {<a name="line.4123"></a>
-<span class="sourceLineNo">4124</span>      return false;<a name="line.4124"></a>
-<span class="sourceLineNo">4125</span>    }<a name="line.4125"></a>
-<span class="sourceLineNo">4126</span>    boolean result = false;<a name="line.4126"></a>
-<span class="sourceLineNo">4127</span><a name="line.4127"></a>
-<span class="sourceLineNo">4128</span>    // Create a copy of peer HTD as we need to change its replication<a name="line.4128"></a>
-<span class="sourceLineNo">4129</span>    // scope to match with the local HTD.<a name="line.4129"></a>
-<span class="sourceLineNo">4130</span>    HTableDescriptor peerHtdCopy = new HTableDescriptor(peerHtd);<a name="line.4130"></a>
-<span class="sourceLineNo">4131</span><a name="line.4131"></a>
-<span class="sourceLineNo">4132</span>    result = copyReplicationScope(peerHtdCopy, localHtd);<a name="line.4132"></a>
+<span class="sourceLineNo">4085</span>    return result;<a name="line.4085"></a>
+<span class="sourceLineNo">4086</span>  }<a name="line.4086"></a>
+<span class="sourceLineNo">4087</span><a name="line.4087"></a>
+<span class="sourceLineNo">4088</span>  /**<a name="line.4088"></a>
+<span class="sourceLineNo">4089</span>   * Connect to peer and check the table descriptor on peer:<a name="line.4089"></a>
+<span class="sourceLineNo">4090</span>   * &lt;ol&gt;<a name="line.4090"></a>
+<span class="sourceLineNo">4091</span>   * &lt;li&gt;Create the same table on peer when not exist.&lt;/li&gt;<a name="line.4091"></a>
+<span class="sourceLineNo">4092</span>   * &lt;li&gt;Throw an exception if the table already has replication enabled on any of the column<a name="line.4092"></a>
+<span class="sourceLineNo">4093</span>   * families.&lt;/li&gt;<a name="line.4093"></a>
+<span class="sourceLineNo">4094</span>   * &lt;li&gt;Throw an exception if the table exists on peer cluster but descriptors are not same.&lt;/li&gt;<a name="line.4094"></a>
+<span class="sourceLineNo">4095</span>   * &lt;/ol&gt;<a name="line.4095"></a>
+<span class="sourceLineNo">4096</span>   * @param tableName name of the table to sync to the peer<a name="line.4096"></a>
+<span class="sourceLineNo">4097</span>   * @param splits table split keys<a name="line.4097"></a>
+<span class="sourceLineNo">4098</span>   * @throws IOException<a name="line.4098"></a>
+<span class="sourceLineNo">4099</span>   */<a name="line.4099"></a>
+<span class="sourceLineNo">4100</span>  private void checkAndSyncTableDescToPeers(final TableName tableName, final byte[][] splits)<a name="line.4100"></a>
+<span class="sourceLineNo">4101</span>      throws IOException {<a name="line.4101"></a>
+<span class="sourceLineNo">4102</span>    List&lt;ReplicationPeerDescription&gt; peers = listReplicationPeers();<a name="line.4102"></a>
+<span class="sourceLineNo">4103</span>    if (peers == null || peers.size() &lt;= 0) {<a name="line.4103"></a>
+<span class="sourceLineNo">4104</span>      throw new IllegalArgumentException("Found no peer cluster for replication.");<a name="line.4104"></a>
+<span class="sourceLineNo">4105</span>    }<a name="line.4105"></a>
+<span class="sourceLineNo">4106</span><a name="line.4106"></a>
+<span class="sourceLineNo">4107</span>    for (ReplicationPeerDescription peerDesc : peers) {<a name="line.4107"></a>
+<span class="sourceLineNo">4108</span>      if (needToReplicate(tableName, peerDesc)) {<a name="line.4108"></a>
+<span class="sourceLineNo">4109</span>        Configuration peerConf = getPeerClusterConfiguration(peerDesc);<a name="line.4109"></a>
+<span class="sourceLineNo">4110</span>        try (Connection conn = ConnectionFactory.createConnection(peerConf);<a name="line.4110"></a>
+<span class="sourceLineNo">4111</span>            Admin repHBaseAdmin = conn.getAdmin()) {<a name="line.4111"></a>
+<span class="sourceLineNo">4112</span>          HTableDescriptor localHtd = getTableDescriptor(tableName);<a name="line.4112"></a>
+<span class="sourceLineNo">4113</span>          HTableDescriptor peerHtd = null;<a name="line.4113"></a>
+<span class="sourceLineNo">4114</span>          if (!repHBaseAdmin.tableExists(tableName)) {<a name="line.4114"></a>
+<span class="sourceLineNo">4115</span>            repHBaseAdmin.createTable(localHtd, splits);<a name="line.4115"></a>
+<span class="sourceLineNo">4116</span>          } else {<a name="line.4116"></a>
+<span class="sourceLineNo">4117</span>            peerHtd = repHBaseAdmin.getTableDescriptor(tableName);<a name="line.4117"></a>
+<span class="sourceLineNo">4118</span>            if (peerHtd == null) {<a name="line.4118"></a>
+<span class="sourceLineNo">4119</span>              throw new IllegalArgumentException("Failed to get table descriptor for table "<a name="line.4119"></a>
+<span class="sourceLineNo">4120</span>                  + tableName.getNameAsString() + " from peer cluster " + peerDesc.getPeerId());<a name="line.4120"></a>
+<span class="sourceLineNo">4121</span>            }<a name="line.4121"></a>
+<span class="sourceLineNo">4122</span>            if (!compareForReplication(peerHtd, localHtd)) {<a name="line.4122"></a>
+<span class="sourceLineNo">4123</span>              throw new IllegalArgumentException("Table " + tableName.getNameAsString()<a name="line.4123"></a>
+<span class="sourceLineNo">4124</span>                  + " exists in peer cluster " + peerDesc.getPeerId()<a name="line.4124"></a>
+<span class="sourceLineNo">4125</span>                  + ", but the table descriptors are not same when compared with source cluster."<a name="line.4125"></a>
+<span class="sourceLineNo">4126</span>                  + " Thus can not enable the table's replication switch.");<a name="line.4126"></a>
+<span class="sourceLineNo">4127</span>            }<a name="line.4127"></a>
+<span class="sourceLineNo">4128</span>          }<a name="line.4128"></a>
+<span class="sourceLineNo">4129</span>        }<a name="line.4129"></a>
+<span class="sourceLineNo">4130</span>      }<a name="line.4130"></a>
+<span class="sourceLineNo">4131</span>    }<a name="line.4131"></a>
+<span class="sourceLineNo">4132</span>  }<a name="line.4132"></a>
 <span class="sourceLineNo">4133</span><a name="line.4133"></a>
-<span class="sourceLineNo">4134</span>    // If copy was successful, compare the two tables now.<a name="line.4134"></a>
-<span class="sourceLineNo">4135</span>    if (result) {<a name="line.4135"></a>
-<span class="sourceLineNo">4136</span>      result = (peerHtdCopy.compareTo(localHtd) == 0);<a name="line.4136"></a>
-<span class="sourceLineNo">4137</span>    }<a name="line.4137"></a>
-<span class="sourceLineNo">4138</span><a name="line.4138"></a>
-<span class="sourceLineNo">4139</span>    return result;<a name="line.4139"></a>
-<span class="sourceLineNo">4140</span>  }<a name="line.4140"></a>
-<span class="sourceLineNo">4141</span><a name="line.4141"></a>
-<span class="sourceLineNo">4142</span>  /**<a name="line.4142"></a>
-<span class="sourceLineNo">4143</span>   * Connect to peer and check the table descriptor on peer:<a name="line.4143"></a>
-<span class="sourceLineNo">4144</span>   * &lt;ol&gt;<a name="line.4144"></a>
-<span class="sourceLineNo">4145</span>   * &lt;li&gt;Create the same table on peer when not exist.&lt;/li&gt;<a name="line.4145"></a>
-<span class="sourceLineNo">4146</span>   * &lt;li&gt;Throw an exception if the table already has replication enabled on any of the column<a name="line.4146"></a>
-<span class="sourceLineNo">4147</span>   * families.&lt;/li&gt;<a name="line.4147"></a>
-<span class="sourceLineNo">4148</span>   * &lt;li&gt;Throw an exception if the table exists on peer cluster but descriptors are not same.&lt;/li&gt;<a name="line.4148"></a>
-<span class="sourceLineNo">4149</span>   * &lt;/ol&gt;<a name="line.4149"></a>
-<span class="sourceLineNo">4150</span>   * @param tableName name of the table to sync to the peer<a name="line.4150"></a>
-<span class="sourceLineNo">4151</span>   * @param splits table split keys<a name="line.4151"></a>
-<span class="sourceLineNo">4152</span>   * @throws IOException<a name="line.4152"></a>
-<span class="sourceLineNo">4153</span>   */<a name="line.4153"></a>
-<span class="sourceLineNo">4154</span>  private void checkAndSyncTableDescToPeers(final TableName tableName, final byte[][] splits)<a name="line.4154"></a>
-<span class="sourceLineNo">4155</span>      throws IOException {<a name="line.4155"></a>
-<span class="sourceLineNo">4156</span>    List&lt;ReplicationPeerDescription&gt; peers = listReplicationPeers();<a name="line.4156"></a>
-<span class="sourceLineNo">4157</span>    if (peers == null || peers.size() &lt;= 0) {<a name="line.4157"></a>
-<span class="sourceLineNo">4158</span>      throw new IllegalArgumentException("Found no peer cluster for replication.");<a name="line.4158"></a>
-<span class="sourceLineNo">4159</span>    }<a name="line.4159"></a>
+<span class="sourceLineNo">4134</span>  /**<a name="line.4134"></a>
+<span class="sourceLineNo">4135</span>   * Decide whether the table need replicate to the peer cluster according to the peer config<a name="line.4135"></a>
+<span class="sourceLineNo">4136</span>   * @param table name of the table<a name="line.4136"></a>
+<span class="sourceLineNo">4137</span>   * @param peerConfig config for the peer<a name="line.4137"></a>
+<span class="sourceLineNo">4138</span>   * @return true if the table need replicate to the peer cluster<a name="line.4138"></a>
+<span class="sourceLineNo">4139</span>   */<a name="line.4139"></a>
+<span class="sourceLineNo">4140</span>  private boolean needToReplicate(TableName table, ReplicationPeerDescription peer) {<a name="line.4140"></a>
+<span class="sourceLineNo">4141</span>    ReplicationPeerConfig peerConfig = peer.getPeerConfig();<a name="line.4141"></a>
+<span class="sourceLineNo">4142</span>    Set&lt;String&gt; namespaces = peerConfig.getNamespaces();<a name="line.4142"></a>
+<span class="sourceLineNo">4143</span>    Map&lt;TableName, List&lt;String&gt;&gt; tableCFsMap = peerConfig.getTableCFsMap();<a name="line.4143"></a>
+<span class="sourceLineNo">4144</span>    // If null means user has explicitly not configured any namespaces and table CFs<a name="line.4144"></a>
+<span class="sourceLineNo">4145</span>    // so all the tables data are applicable for replication<a name="line.4145"></a>
+<span class="sourceLineNo">4146</span>    if (namespaces == null &amp;&amp; tableCFsMap == null) {<a name="line.4146"></a>
+<span class="sourceLineNo">4147</span>      return true;<a name="line.4147"></a>
+<span class="sourceLineNo">4148</span>    }<a name="line.4148"></a>
+<span class="sourceLineNo">4149</span>    if (namespaces != null &amp;&amp; namespaces.contains(table.getNamespaceAsString())) {<a name="line.4149"></a>
+<span class="sourceLineNo">4150</span>      return true;<a name="line.4150"></a>
+<span class="sourceLineNo">4151</span>    }<a name="line.4151"></a>
+<span class="sourceLineNo">4152</span>    if (tableCFsMap != null &amp;&amp; tableCFsMap.containsKey(table)) {<a name="line.4152"></a>
+<span class="sourceLineNo">4153</span>      return true;<a name="line.4153"></a>
+<span class="sourceLineNo">4154</span>    }<a name="line.4154"></a>
+<span class="sourceLineNo">4155</span>    LOG.debug("Table " + table.getNameAsString()<a name="line.4155"></a>
+<span class="sourceLineNo">4156</span>        + " doesn't need replicate to peer cluster, peerId=" + peer.getPeerId() + ", clusterKey="<a name="line.4156"></a>
+<span class="sourceLineNo">4157</span>        + peerConfig.getClusterKey());<a name="line.4157"></a>
+<span class="sourceLineNo">4158</span>    return false;<a name="line.4158"></a>
+<span class="sourceLineNo">4159</span>  }<a name="line.4159"></a>
 <span class="sourceLineNo">4160</span><a name="line.4160"></a>
-<span class="sourceLineNo">4161</span>    for (ReplicationPeerDescription peerDesc : peers) {<a name="line.4161"></a>
-<span class="sourceLineNo">4162</span>      if (needToReplicate(tableName, peerDesc)) {<a name="line.4162"></a>
-<span class="sourceLineNo">4163</span>        Configuration peerConf = getPeerClusterConfiguration(peerDesc);<a name="line.4163"></a>
-<span class="sourceLineNo">4164</span>        try (Connection conn = ConnectionFactory.createConnection(peerConf);<a name="line.4164"></a>
-<span class="sourceLineNo">4165</span>            Admin repHBaseAdmin = conn.getAdmin()) {<a name="line.4165"></a>
-<span class="sourceLineNo">4166</span>          HTableDescriptor localHtd = getTableDescriptor(tableName);<a name="line.4166"></a>
-<span class="sourceLineNo">4167</span>          HTableDescriptor peerHtd = null;<a name="line.4167"></a>
-<span class="sourceLineNo">4168</span>          if (!repHBaseAdmin.tableExists(tableName)) {<a name="line.4168"></a>
-<span class="sourceLineNo">4169</span>            repHBaseAdmin.createTable(localHtd, splits);<a name="line.4169"></a>
-<span class="sourceLineNo">4170</span>          } else {<a name="line.4170"></a>
-<span class="sourceLineNo">4171</span>            peerHtd = repHBaseAdmin.getTableDescriptor(tableName);<a name="line.4171"></a>
-<span class="sourceLineNo">4172</span>            if (peerHtd == null) {<a name="line.4172"></a>
-<span class="sourceLineNo">4173</span>              throw new IllegalArgumentException("Failed to get table descriptor for table "<a name="line.4173"></a>
-<span class="sourceLineNo">4174</span>                  + tableName.getNameAsString() + " from peer cluster " + peerDesc.getPeerId());<a name="line.4174"></a>
-<span class="sourceLineNo">4175</span>            }<a name="line.4175"></a>
-<span class="sourceLineNo">4176</span>            if (!compareForReplication(peerHtd, localHtd)) {<a name="line.4176"></a>
-<span class="sourceLineNo">4177</span>              throw new IllegalArgumentException("Table " + tableName.getNameAsString()<a name="line.4177"></a>
-<span class="sourceLineNo">4178</span>                  + " exists in peer cluster " + peerDesc.getPeerId()<a name="line.4178"></a>
-<span class="sourceLineNo">4179</span>                  + ", but the table descriptors are not same when compared with source cluster."<a name="line.4179"></a>
-<span class="sourceLineNo">4180</span>                  + " Thus can not enable the table's replication switch.");<a name="line.4180"></a>
-<span class="sourceLineNo">4181</span>            }<a name="line.4181"></a>
-<span class="sourceLineNo">4182</span>          }<a name="line.4182"></a>
-<span class="sourceLineNo">4183</span>        }<a name="line.4183"></a>
-<span class="sourceLineNo">4184</span>      }<a name="line.4184"></a>
-<span class="sourceLineNo">4185</span>    }<a name="line.4185"></a>
-<span class="sourceLineNo">4186</span>  }<a name="line.4186"></a>
-<span class="sourceLineNo">4187</span><a name="line.4187"></a>
-<span class="sourceLineNo">4188</span>  /**<a name="line.4188"></a>
-<span class="sourceLineNo">4189</span>   * Decide whether the table need replicate to the peer cluster according to the peer config<a name="line.4189"></a>
-<span class="sourceLineNo">4190</span>   * @param table name of the table<a name="line.4190"></a>
-<span class="sourceLineNo">4191</span>   * @param peerConfig config for the peer<a name="line.4191"></a>
-<span class="sourceLineNo">4192</span>   * @return true if the table need replicate to the peer cluster<a name="line.4192"></a>
-<span class="sourceLineNo">4193</span>   */<a name="line.4193"></a>
-<span class="sourceLineNo">4194</span>  private boolean needToReplicate(TableName table, ReplicationPeerDescription peer) {<a name="line.4194"></a>
-<span class="sourceLineNo">4195</span>    ReplicationPeerConfig peerConfig = peer.getPeerConfig();<a name="line.4195"></a>
-<span class="sourceLineNo">4196</span>    Set&lt;String&gt; namespaces = peerConfig.getNamespaces();<a name="line.4196"></a>
-<span class="sourceLineNo">4197</span>    Map&lt;TableName, List&lt;String&gt;&gt; tableCFsMap = peerConfig.getTableCFsMap();<a name="line.4197"></a>
-<span class="sourceLineNo">4198</span>    // If null means user has explicitly not configured any namespaces and table CFs<a name="line.4198"></a>
-<span class="sourceLineNo">4199</span>    // so all the tables data are applicable for replication<a name="line.4199"></a>
-<span class="sourceLineNo">4200</span>    if (namespaces == null &amp;&amp; tableCFsMap == null) {<a name="line.4200"></a>
-<span class="sourceLineNo">4201</span>      return true;<a name="line.4201"></a>
-<span class="sourceLineNo">4202</span>    }<a name="line.4202"></a>
-<span class="sourceLineNo">4203</span>    if (namespaces != null &amp;&amp; namespaces.contains(table.getNamespaceAsString())) {<a name="line.4203"></a>
-<span class="sourceLineNo">4204</span>      return true;<a name="line.4204"></a>
-<span class="sourceLineNo">4205</span>    }<a name="line.4205"></a>
-<span class="sourceLineNo">4206</span>    if (tableCFsMap != null &amp;&amp; tableCFsMap.containsKey(table)) {<a name="line.4206"></a>
-<span class="sourceLineNo">4207</span>      return true;<a name="line.4207"></a>
-<span class="sourceLineNo">4208</span>    }<a name="line.4208"></a>
-<span class="sourceLineNo">4209</span>    LOG.debug("Table " + table.getNameAsString()<a name="line.4209"></a>
-<span class="sourceLineNo">4210</span>        + " doesn't need replicate to peer cluster, peerId=" + peer.getPeerId() + ", clusterKey="<a name="line.4210"></a>
-<span class="sourceLineNo">4211</span>        + peerConfig.getClusterKey());<a name="line.4211"></a>
-<span class="sourceLineNo">4212</span>    return false;<a name="line.4212"></a>
-<span class="sourceLineNo">4213</span>  }<a name="line.4213"></a>
-<span class="sourceLineNo">4214</span><a name="line.4214"></a>
-<span class="sourceLineNo">4215</span>  /**<a name="line.4215"></a>
-<span class="sourceLineNo">4216</span>   * Set the table's replication switch if the table's replication switch is already not set.<a name="line.4216"></a>
-<span class="sourceLineNo">4217</span>   * @param tableName name of the table<a name="line.4217"></a>
-<span class="sourceLineNo">4218</span>   * @param enableRep is replication switch enable or disable<a name="line.4218"></a>
-<span class="sourceLineNo">4219</span>   * @throws IOException if a remote or network exception occurs<a name="line.4219"></a>
-<span class="sourceLineNo">4220</span>   */<a name="line.4220"></a>
-<span class="sourceLineNo">4221</span>  private void setTableRep(final TableName tableName, boolean enableRep) throws IOException {<a name="line.4221"></a>
-<span class="sourceLineNo">4222</span>    HTableDescriptor htd = getTableDescriptor(tableName);<a name="line.4222"></a>
-<span class="sourceLineNo">4223</span>    ReplicationState currentReplicationState = getTableReplicationState(htd);<a name="line.4223"></a>
-<span class="sourceLineNo">4224</span>    if (enableRep &amp;&amp; currentReplicationState != ReplicationState.ENABLED<a name="line.4224"></a>
-<span class="sourceLineNo">4225</span>        || !enableRep &amp;&amp; currentReplicationState != ReplicationState.DISABLED) {<a name="line.4225"></a>
-<span class="sourceLineNo">4226</span>      for (HColumnDescriptor hcd : htd.getFamilies()) {<a name="line.4226"></a>
-<span class="sourceLineNo">4227</span>        hcd.setScope(enableRep ? HConstants.REPLICATION_SCOPE_GLOBAL<a name="line.4227"></a>
-<span class="sourceLineNo">4228</span>            : HConstants.REPLICATION_SCOPE_LOCAL);<a name="line.4228"></a>
-<span class="sourceLineNo">4229</span>      }<a name="line.4229"></a>
-<span class="sourceLineNo">4230</span>      modifyTable(tableName, htd);<a name="line.4230"></a>
-<span class="sourceLineNo">4231</span>    }<a name="line.4231"></a>
-<span class="sourceLineNo">4232</span>  }<a name="line.4232"></a>
+<span class="sourceLineNo">4161</span>  /**<a name="line.4161"></a>
+<span class="sourceLineNo">4162</span>   * Set the table's replication switch if the table's replication switch is already not set.<a name="line.4162"></a>
+<span class="sourceLineNo">4163</span>   * @param tableName name of the table<a name="line.4163"></a>
+<span class="sourceLineNo">4164</span>   * @param enableRep is replication switch enable or disable<a name="line.4164"></a>
+<span class="sourceLineNo">4165</span>   * @throws IOException if a remote or network exception occurs<a name="line.4165"></a>
+<span class="sourceLineNo">4166</span>   */<a name="line.4166"></a>
+<span class="sourceLineNo">4167</span>  private void setTableRep(final TableName tableName, boolean enableRep) throws IOException {<a name="line.4167"></a>
+<span class="sourceLineNo">4168</span>    HTableDescriptor htd = getTableDescriptor(tableName);<a name="line.4168"></a>
+<span class="sourceLineNo">4169</span>    ReplicationState currentReplicationState = getTableReplicationState(htd);<a name="line.4169"></a>
+<span class="sourceLineNo">4170</span>    if (enableRep &amp;&amp; currentReplicationState != ReplicationState.ENABLED<a name="line.4170"></a>
+<span class="sourceLineNo">4171</span>        || !enableRep &amp;&amp; currentReplicationState != ReplicationState.DISABLED) {<a name="line.4171"></a>
+<span class="sourceLineNo">4172</span>      for (HColumnDescriptor hcd : htd.getFamilies()) {<a name="line.4172"></a>
+<span class="sourceLineNo">4173</span>        hcd.setScope(enableRep ? HConstants.REPLICATION_SCOPE_GLOBAL<a name="line.4173"></a>
+<span class="sourceLineNo">4174</span>            : HConstants.REPLICATION_SCOPE_LOCAL);<a name="line.4174"></a>
+<span class="sourceLineNo">4175</span>      }<a name="line.4175"></a>
+<span class="sourceLineNo">4176</span>      modifyTable(tableName, htd);<a name="line.4176"></a>
+<span class="sourceLineNo">4177</span>    }<a name="line.4177"></a>
+<span class="sourceLineNo">4178</span>  }<a name="line.4178"></a>
+<span class="sourceLineNo">4179</span><a name="line.4179"></a>
+<span class="sourceLineNo">4180</span>  /**<a name="line.4180"></a>
+<span class="sourceLineNo">4181</span>   * This enum indicates the current state of the replication for a given table.<a name="line.4181"></a>
+<span class="sourceLineNo">4182</span>   */<a name="line.4182"></a>
+<span class="sourceLineNo">4183</span>  private enum ReplicationState {<a name="line.4183"></a>
+<span class="sourceLineNo">4184</span>    ENABLED, // all column families enabled<a name="line.4184"></a>
+<span class="sourceLineNo">4185</span>    MIXED, // some column families enabled, some disabled<a name="line.4185"></a>
+<span class="sourceLineNo">4186</span>    DISABLED // all column families disabled<a name="line.4186"></a>
+<span class="sourceLineNo">4187</span>  }<a name="line.4187"></a>
+<span class="sourceLineNo">4188</span><a name="line.4188"></a>
+<span class="sourceLineNo">4189</span>  /**<a name="line.4189"></a>
+<span class="sourceLineNo">4190</span>   * @param htd table descriptor details for the table to check<a name="line.4190"></a>
+<span class="sourceLineNo">4191</span>   * @return ReplicationState the current state of the table.<a name="line.4191"></a>
+<span class="sourceLineNo">4192</span>   */<a name="line.4192"></a>
+<span class="sourceLineNo">4193</span>  private ReplicationState getTableReplicationState(HTableDescriptor htd) {<a name="line.4193"></a>
+<span class="sourceLineNo">4194</span>    boolean hasEnabled = false;<a name="line.4194"></a>
+<span class="sourceLineNo">4195</span>    boolean hasDisabled = false;<a name="line.4195"></a>
+<span class="sourceLineNo">4196</span><a name="line.4196"></a>
+<span class="sourceLineNo">4197</span>    for (HColumnDescriptor hcd : htd.getFamilies()) {<a name="line.4197"></a>
+<span class="sourceLineNo">4198</span>      if (hcd.getScope() != HConstants.REPLICATION_SCOPE_GLOBAL<a name="line.4198"></a>
+<span class="sourceLineNo">4199</span>          &amp;&amp; hcd.getScope() != HConstants.REPLICATION_SCOPE_SERIAL) {<a name="line.4199"></a>
+<span class="sourceLineNo">4200</span>        hasDisabled = true;<a name="line.4200"></a>
+<span class="sourceLineNo">4201</span>      } else {<a name="line.4201"></a>
+<span class="sourceLineNo">4202</span>        hasEnabled = true;<a name="line.4202"></a>
+<span class="sourceLineNo">4203</span>      }<a name="line.4203"></a>
+<span class="sourceLineNo">4204</span>    }<a name="line.4204"></a>
+<span class="sourceLineNo">4205</span><a name="line.4205"></a>
+<span class="sourceLineNo">4206</span>    if (hasEnabled &amp;&amp; hasDisabled) return ReplicationState.MIXED;<a name="line.4206"></a>
+<span class="sourceLineNo">4207</span>    if (hasEnabled) return ReplicationState.ENABLED;<a name="line.4207"></a>
+<span class="sourceLineNo">4208</span>    return ReplicationState.DISABLED;<a name="line.4208"></a>
+<span class="sourceLineNo">4209</span>  }<a name="line.4209"></a>
+<span class="sourceLineNo">4210</span><a name="line.4210"></a>
+<span class="sourceLineNo">4211</span>  /**<a name="line.4211"></a>
+<span class="sourceLineNo">4212</span>   * Returns the configuration needed to talk to the remote slave cluster.<a name="line.4212"></a>
+<span class="sourceLineNo">4213</span>   * @param peer the description of replication peer<a name="line.4213"></a>
+<span class="sourceLineNo">4214</span>   * @return the configuration for the peer cluster, null if it was unable to get the configuration<a name="line.4214"></a>
+<span class="sourceLineNo">4215</span>   * @throws IOException<a name="line.4215"></a>
+<span class="sourceLineNo">4216</span>   */<a name="line.4216"></a>
+<span class="sourceLineNo">4217</span>  private Configuration getPeerClusterConfiguration(ReplicationPeerDescription peer)<a name="line.4217"></a>
+<span class="sourceLineNo">4218</span>      throws IOException {<a name="line.4218"></a>
+<span class="sourceLineNo">4219</span>    ReplicationPeerConfig peerConfig = peer.getPeerConfig();<a name="line.4219"></a>
+<span class="sourceLineNo">4220</span>    Configuration otherConf;<a name="line.4220"></a>
+<span class="sourceLineNo">4221</span>    try {<a name="line.4221"></a>
+<span class="sourceLineNo">4222</span>      otherConf = HBaseConfiguration.createClusterConf(this.conf, peerConfig.getClusterKey());<a name="line.4222"></a>
+<span class="sourceLineNo">4223</span>    } catch (IOException e) {<a name="line.4223"></a>
+<span class="sourceLineNo">4224</span>      throw new IOException("Can't get peer configuration for peerId=" + peer.getPeerId(), e);<a name="line.4224"></a>
+<span class="sourceLineNo">4225</span>    }<a name="line.4225"></a>
+<span class="sourceLineNo">4226</span><a name="line.4226"></a>
+<span class="sourceLineNo">4227</span>    if (!peerConfig.getConfiguration().isEmpty()) {<a name="line.4227"></a>
+<span class="sourceLineNo">4228</span>      CompoundConfiguration compound = new CompoundConfiguration();<a name="line.4228"></a>
+<span class="sourceLineNo">4229</span>      compound.add(otherConf);<a name="line.4229"></a>
+<span class="sourceLineNo">4230</span>      compound.addStringMap(peerConfig.getConfiguration());<a name="line.4230"></a>
+<span class="sourceLineNo">4231</span>      return compound;<a name="line.4231"></a>
+<span class="sourceLineNo">4232</span>    }<a name="line.4232"></a>
 <span class="sourceLineNo">4233</span><a name="line.4233"></a>
-<span class="sourceLineNo">4234</span>  /**<a name="line.4234"></a>
-<span class="sourceLineNo">4235</span>   * This enum indicates the current state of the replication for a given table.<a name="line.4235"></a>
-<span class="sourceLineNo">4236</span>   */<a name="line.4236"></a>
-<span class="sourceLineNo">4237</span>  private enum ReplicationState {<a name="line.4237"></a>
-<span class="sourceLineNo">4238</span>    ENABLED, // all column families enabled<a name="line.4238"></a>
-<span class="sourceLineNo">4239</span>    MIXED, // some column families enabled, some disabled<a name="line.4239"></a>
-<span class="sourceLineNo">4240</span>    DISABLED // all column families disabled<a name="line.4240"></a>
-<span class="sourceLineNo">4241</span>  }<a name="line.4241"></a>
-<span class="sourceLineNo">4242</span><a name="line.4242"></a>
-<span class="sourceLineNo">4243</span>  /**<a name="line.4243"></a>
-<span class="sourceLineNo">4244</span>   * @param htd table descriptor details for the table to check<a name="line.4244"></a>
-<span class="sourceLineNo">4245</span>   * @return ReplicationState the current state of the table.<a name="line.4245"></a>
-<span class="sourceLineNo">4246</span>   */<a name="line.4246"></a>
-<span class="sourceLineNo">4247</span>  private ReplicationState getTableReplicationState(HTableDescriptor htd) {<a name="line.4247"></a>
-<span class="sourceLineNo">4248</span>    boolean hasEnabled = false;<a name="line.4248"></a>
-<span class="sourceLineNo">4249</span>    boolean hasDisabled = false;<a name="line.4249"></a>
-<span class="sourceLineNo">4250</span><a name="line.4250"></a>
-<span class="sourceLineNo">4251</span>    for (HColumnDescriptor hcd : htd.getFamilies()) {<a name="line.4251"></a>
-<span class="sourceLineNo">4252</span>      if (hcd.getScope() != HConstants.REPLICATION_SCOPE_GLOBAL<a name="line.4252"></a>
-<span class="sourceLineNo">4253</span>          &amp;&amp; hcd.getScope() != HConstants.REPLICATION_SCOPE_SERIAL) {<a name="line.4253"></a>
-<span class="sourceLineNo">4254</span>        hasDisabled = true;<a name="line.4254"></a>
-<span class="sourceLineNo">4255</span>      } else {<a name="line.4255"></a>
-<span class="sourceLineNo">4256</span>        hasEnabled = true;<a name="line.4256"></a>
-<span class="sourceLineNo">4257</span>      }<a name="line.4257"></a>
-<span class="sourceLineNo">4258</span>    }<a name="line.4258"></a>
-<span class="sourceLineNo">4259</span><a name="line.4259"></a>
-<span class="sourceLineNo">4260</span>    if (hasEnabled &amp;&amp; hasDisabled) return ReplicationState.MIXED;<a name="line.4260"></a>
-<span class="sourceLineNo">4261</span>    if (hasEnabled) return ReplicationState.ENABLED;<a name="line.4261"></a>
-<span class="sourceLineNo">4262</span>    return ReplicationState.DISABLED;<a name="line.4262"></a>
-<span class="sourceLineNo">4263</span>  }<a name="line.4263"></a>
-<span class="sourceLineNo">4264</span><a name="line.4264"></a>
-<span class="sourceLineNo">4265</span>  /**<a name="line.4265"></a>
-<span class="sourceLineNo">4266</span>   * Returns the configuration needed to talk to the remote slave cluster.<a name="line.4266"></a>
-<span class="sourceLineNo">4267</span>   * @param peer the description of replication peer<a name="line.4267"></a>
-<span class="sourceLineNo">4268</span>   * @return the configuration for the peer cluster, null if it was unable to get the configuration<a name="line.4268"></a>
-<span class="sourceLineNo">4269</span>   * @throws IOException<a name="line.4269"></a>
-<span class="sourceLineNo">4270</span>   */<a name="line.4270"></a>
-<span class="sourceLineNo">4271</span>  private Configuration getPeerClusterConfiguration(ReplicationPeerDescription peer)<a name="line.4271"></a>
-<span class="sourceLineNo">4272</span>      throws IOException {<a name="line.4272"></a>
-<span class="sourceLineNo">4273</span>    ReplicationPeerConfig peerConfig = peer.getPeerConfig();<a name="line.4273"></a>
-<span class="sourceLineNo">4274</span>    Configuration otherConf;<a name="line.4274"></a>
-<span class="sourceLineNo">4275</span>    try {<a name="line.4275"></a>
-<span class="sourceLineNo">4276</span>      otherConf = HBaseConfiguration.createClusterConf(this.conf, peerConfig.getClusterKey());<a name="line.4276"></a>
-<span class="sourceLineNo">4277</span>    } catch (IOException e) {<a name="line.4277"></a>
-<span class="sourceLineNo">4278</span>      throw new IOException("Can't get peer configuration for peerId=" + peer.getPeerId(), e);<a name="line.4278"></a>
-<span class="sourceLineNo">4279</span>    }<a name="line.4279"></a>
-<span class="sourceLineNo">4280</span><a name="line.4280"></a>
-<span class="sourceLineNo">4281</span>    if (!peerConfig.getConfiguration().isEmpty()) {<a name="line.4281"></a>
-<span class="sourceLineNo">4282</span>      CompoundConfiguration compound = new CompoundConfiguration();<a name="line.4282"></a>
-<span class="sourceLineNo">4283</span>      compound.add(otherConf);<a name="line.4283"></a>
-<span class="sourceLineNo">4284</span>      compound.addStringMap(peerConfig.getConfiguration());<a name="line.4284"></a>
-<span class="sourceLineNo">4285</span>      return compound;<a name="line.4285"></a>
-<span class="sourceLineNo">4286</span>    }<a name="line.4286"></a>
-<span class="sourceLineNo">4287</span><a name="line.4287"></a>
-<span class="sourceLineNo">4288</span>    return otherConf;<a name="line.4288"></a>
-<span class="sourceLineNo">4289</span>  }<a name="line.4289"></a>
-<span class="sourceLineNo">4290</span>}<a name="line.4290"></a>
+<span class="sourceLineNo">4234</span>    return otherConf;<a name="line.4234"></a>
+<span class="sourceLineNo">4235</span>  }<a name="line.4235"></a>
+<span class="sourceLineNo">4236</span>}<a name="line.4236"></a>
 
 
 


Mime
View raw message