private Map<LoadQueueItem, ByteBuffer> doBulkLoad(AsyncClusterConnection conn,
    TableName tableName, Path hfofDir, boolean silence, boolean copyFile) throws IOException {
    tableExists(conn, tableName);

    /*
     * Checking hfile format is a time-consuming operation, we should have an option to skip this
     * step when bulkloading millions of HFiles. See HBASE-13985.
     */
    boolean validateHFile = getConf().getBoolean(VALIDATE_HFILES, true);
    if (!validateHFile) {
      LOG.warn("You are skipping HFiles validation, it might cause some data loss if files "
        + "are not correct. If you fail to read data from your table after using this "
        + "option, consider removing the files and bulkload again without this option. "
        + "See HBASE-13985");
    }
    // LQI queue does not need to be threadsafe -- all operations on this queue
    // happen in this thread
    Deque<LoadQueueItem> queue = new ArrayDeque<>();
    ExecutorService pool = null;
    try {
      prepareHFileQueue(getConf(), conn, tableName, hfofDir, queue, validateHFile, silence);

      if (queue.isEmpty()) {
        LOG.warn(
          "Bulk load operation did not find any files to load in directory {}. "
            + "Does it contain files in subdirectories that correspond to column family names?",
          (hfofDir != null ? hfofDir.toUri().toString() : ""));
        return Collections.emptyMap();
      }
      pool = createExecutorService();
      return performBulkLoad(conn, tableName, queue, pool, copyFile);
    } finally {
      cleanup(conn, tableName, queue, pool);
    }
  }
Perform a bulk load of the given directory into the given pre-existing table. This method is
not threadsafe.
@param tableName table to load the hfiles
@param hfofDir   the directory that was provided as the output path of a job using
                 HFileOutputFormat
@param silence   true to ignore unmatched column families
@param copyFile  always copy hfiles if true
hbase-server/src/main/java/org/apache/hadoop/hbase/tool/BulkLoadHFilesTool.java