void preAddPeer(String peerId, ReplicationPeerConfig peerConfig)
    throws ReplicationException, IOException {
    if (peerId.contains("-")) {
      throw new DoNotRetryIOException("Found invalid peer name: " + peerId);
    }
    checkPeerConfig(peerConfig);
    if (peerConfig.isSyncReplication()) {
      checkSyncReplicationPeerConfigConflict(peerConfig);
    }
    if (peers.containsKey(peerId)) {
      throw new DoNotRetryIOException("Replication peer " + peerId + " already exists");
    }

    // lazy create table
    initializeQueueStorage();
    // make sure that there is no queues with the same peer id. This may happen when we create a
    // peer with the same id with a old deleted peer. If the replication queues for the old peer
    // have not been cleaned up yet then we should not create the new peer, otherwise the old wal
    // file may also be replicated.
    checkQueuesDeleted(peerId);
  }
Manages and performs all replication admin operations.
<p>
Used to add/remove a replication peer.
<p>
Implement {@link ConfigurationObserver} mainly for recreating {@link ReplicationPeerStorage}, for
supporting migrating across different replication peer storages without restarting master.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/ReplicationPeerManager.java