private void checkPeerInDAStateIfSyncReplication(String peerId) throws DoNotRetryIOException {
    ReplicationPeerDescription desc = peers.get(peerId);
    if (
      desc != null && desc.getPeerConfig().isSyncReplication()
        && !SyncReplicationState.DOWNGRADE_ACTIVE.equals(desc.getSyncReplicationState())
    ) {
      throw new DoNotRetryIOException(
        "Couldn't remove synchronous replication peer with state=" + desc.getSyncReplicationState()
          + ", Transit the synchronous replication state to be DOWNGRADE_ACTIVE firstly.");
    }
  }
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