public static void fixMetaHoleOnlineAndAddReplicas(Configuration conf, RegionInfo hri,
    Collection<ServerName> servers, int numReplicas) throws IOException {
    Connection conn = ConnectionFactory.createConnection(conf);
    Table meta = conn.getTable(TableName.META_TABLE_NAME);
    Put put = MetaTableAccessor.makePutFromRegionInfo(hri);
    if (numReplicas > 1) {
      Random rand = ThreadLocalRandom.current();
      ServerName[] serversArr = servers.toArray(new ServerName[servers.size()]);
      for (int i = 1; i < numReplicas; i++) {
        ServerName sn = serversArr[rand.nextInt(serversArr.length)];
        // the column added here is just to make sure the master is able to
        // see the additional replicas when it is asked to assign. The
        // final value of these columns will be different and will be updated
        // by the actual regionservers that start hosting the respective replicas
        MetaTableAccessor.addLocation(put, sn, sn.getStartcode(), i);
      }
    }
    meta.put(put);
    meta.close();
    conn.close();
  }
Puts the specified RegionInfo into META with replica related columns
hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsckRepair.java