Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-17317

[branch-1] The updatePeerConfig method in ReplicationPeersZKImpl didn't update the table-cfs map

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4.0
    • None
    • None
    • None

    Description

      The updatePeerConfig method in ReplicationPeersZKImpl.java

        @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);
          }   
        }
      

      Attachments

        1. HBASE-17317-branch-1.patch
          3 kB
          Guanghao Zhang

        Activity

          People

            zghao Guanghao Zhang
            zghao Guanghao Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: