private void cleanup(MasterProcedureEnv env) throws ProcedureSuspendedException {
    ZKReplicationQueueStorageForMigration oldStorage = new ZKReplicationQueueStorageForMigration(
      env.getMasterServices().getZooKeeper(), env.getMasterConfiguration());
    try {
      oldStorage.deleteAllData();
      env.getReplicationPeerManager().deleteLegacyRegionReplicaReplicationPeer();
    } catch (KeeperException | ReplicationException e) {
      throw suspend(env.getMasterConfiguration(),
        backoff -> LOG.warn(
          "failed to delete old replication queue data, sleep {} secs and retry later",
          backoff / 1000, e));
    }
  }
A procedure for migrating replication queue data from zookeeper to hbase:replication table.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/replication/MigrateReplicationQueueFromZkToTableProcedure.java