@Override
  protected PeerModificationState nextStateAfterRefresh() {
    if (peerConfig.isSerial()) {
      if (oldPeerConfig.isSerial()) {
        // both serial, then if the ns/table-cfs configs are not changed, just go with the normal
        // way, otherwise we need to reopen the regions for the newly added tables.
        return ReplicationUtils.isNamespacesAndTableCFsEqual(peerConfig, oldPeerConfig)
          ? super.nextStateAfterRefresh()
          : PeerModificationState.SERIAL_PEER_REOPEN_REGIONS;
      } else {
        // we change the peer to serial, need to reopen all regions
        return PeerModificationState.SERIAL_PEER_REOPEN_REGIONS;
      }
    } else {
      if (oldPeerConfig.isSerial()) {
        // we remove the serial flag for peer, then we do not need to reopen all regions, but we
        // need to remove the last pushed sequence ids.
        return PeerModificationState.SERIAL_PEER_UPDATE_LAST_PUSHED_SEQ_ID;
      } else {
        // not serial for both, just go with the normal way.
        return super.nextStateAfterRefresh();
      }
    }
  }
The procedure for updating the config for a replication peer.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/UpdatePeerConfigProcedure.java