You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Guanghao Zhang (JIRA)" <ji...@apache.org> on 2016/12/14 10:11:58 UTC

[jira] [Created] (HBASE-17317) [branch-1] The updatePeerConfig method in ReplicationPeersZKImpl didn't update the table-cfs map

Guanghao Zhang created HBASE-17317:
--------------------------------------

             Summary: [branch-1] The updatePeerConfig method in ReplicationPeersZKImpl didn't update the table-cfs map
                 Key: HBASE-17317
                 URL: https://issues.apache.org/jira/browse/HBASE-17317
             Project: HBase
          Issue Type: Task
    Affects Versions: 1.4.0
            Reporter: Guanghao Zhang
            Assignee: Guanghao Zhang


The updatePeerConfig method in ReplicationPeersZKImpl.java
{code}
  @Override
  public void updatePeerConfig(String id, ReplicationPeerConfig newConfig)
    throws ReplicationException {
    ReplicationPeer peer = getPeer(id);
    if (peer == null){
      throw new ReplicationException("Could not find peer Id " + id);
    }   
    ReplicationPeerConfig existingConfig = peer.getPeerConfig();
    if (newConfig.getClusterKey() != null && !newConfig.getClusterKey().isEmpty() &&
        !newConfig.getClusterKey().equals(existingConfig.getClusterKey())){
      throw new ReplicationException("Changing the cluster key on an existing peer is not allowed."
          + " Existing key '" + existingConfig.getClusterKey() + "' does not match new key '"
          + newConfig.getClusterKey() +
      "'");
    }   
    String existingEndpointImpl = existingConfig.getReplicationEndpointImpl();
    if (newConfig.getReplicationEndpointImpl() != null &&
        !newConfig.getReplicationEndpointImpl().isEmpty() &&
        !newConfig.getReplicationEndpointImpl().equals(existingEndpointImpl)){
      throw new ReplicationException("Changing the replication endpoint implementation class " +
          "on an existing peer is not allowed. Existing class '"
          + existingConfig.getReplicationEndpointImpl()
          + "' does not match new class '" + newConfig.getReplicationEndpointImpl() + "'");
    }   
    //Update existingConfig's peer config and peer data with the new values, but don't touch config
    // or data that weren't explicitly changed
    existingConfig.getConfiguration().putAll(newConfig.getConfiguration());
    existingConfig.getPeerData().putAll(newConfig.getPeerData());
   // Bug. We should update table-cfs map, too.
    try {
      ZKUtil.setData(this.zookeeper, getPeerNode(id),
          ReplicationSerDeHelper.toByteArray(existingConfig));
    }   
    catch(KeeperException ke){
      throw new ReplicationException("There was a problem trying to save changes to the " +
          "replication peer " + id, ke);
    }   
  }
{code}



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