@Override
  protected void updateLastPushedSequenceIdForSerialPeer(MasterProcedureEnv env)
    throws IOException, ReplicationException {
    if (!oldPeerConfig.isSerial()) {
      assert peerConfig.isSerial();
      // change to serial
      setLastPushedSequenceId(env, peerConfig);
      return;
    }
    if (!peerConfig.isSerial()) {
      // remove the serial flag
      env.getReplicationPeerManager().removeAllLastPushedSeqIds(peerId);
      return;
    }
    // enter here means peerConfig and oldPeerConfig are both serial, let's find out the diffs and
    // process them
    ReplicationQueueStorage queueStorage = env.getReplicationPeerManager().getQueueStorage();
    Connection conn = env.getMasterServices().getConnection();
    Map<String, Long> lastSeqIds = new HashMap<String, Long>();
    List<String> encodedRegionNames = new ArrayList<>();
    for (TableDescriptor td : env.getMasterServices().getTableDescriptors().getAll().values()) {
      if (!td.hasGlobalReplicationScope()) {
        continue;
      }
      TableName tn = td.getTableName();
      if (oldPeerConfig.needToReplicate(tn)) {
        if (!peerConfig.needToReplicate(tn)) {
          // removed from peer config
          for (String encodedRegionName : ReplicationBarrierFamilyFormat
            .getTableEncodedRegionNamesForSerialReplication(conn, tn)) {
            addToList(encodedRegionNames, encodedRegionName, queueStorage);
          }
        }
      } else if (peerConfig.needToReplicate(tn)) {
        // newly added to peer config
        setLastPushedSequenceIdForTable(env, tn, lastSeqIds);
      }
    }
    if (!encodedRegionNames.isEmpty()) {
      queueStorage.removeLastSequenceIds(peerId, encodedRegionNames);
    }
    if (!lastSeqIds.isEmpty()) {
      queueStorage.setLastSequenceIds(peerId, lastSeqIds);
    }
  }
The procedure for updating the config for a replication peer.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/UpdatePeerConfigProcedure.java