ReplicationPeerDescription preTransitPeerSyncReplicationState(String peerId,
    SyncReplicationState state) throws DoNotRetryIOException {
    ReplicationPeerDescription desc = checkPeerExists(peerId);
    SyncReplicationState fromState = desc.getSyncReplicationState();
    EnumSet<SyncReplicationState> allowedToStates = allowedTransition.get(fromState);
    if (allowedToStates == null || !allowedToStates.contains(state)) {
      throw new DoNotRetryIOException("Can not transit current cluster state from " + fromState
        + " to " + state + " for peer id=" + peerId);
    }
    return desc;
  }
Returns the old desciption of the peer
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/ReplicationPeerManager.java