private boolean validateHFileContent(Configuration conf) throws IOException {
    FileSystem fileSystem = CommonFSUtils.getCurrentFileSystem(conf);

    ExecutorService threadPool = createThreadPool(conf);
    HFileCorruptionChecker checker;

    try {
      checker = new HFileCorruptionChecker(conf, threadPool, false);

      Path rootDir = CommonFSUtils.getRootDir(conf);
      LOG.info("Validating HFile contents under {}", rootDir);

      Collection<Path> tableDirs = FSUtils.getTableDirs(fileSystem, rootDir);
      checker.checkTables(tableDirs);

      Path archiveRootDir = new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY);
      LOG.info("Validating HFile contents under {}", archiveRootDir);

      List<Path> archiveTableDirs = FSUtils.getTableDirs(fileSystem, archiveRootDir);
      checker.checkTables(archiveTableDirs);
    } finally {
      threadPool.shutdown();

      try {
        threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
      }
    }

    int checkedFiles = checker.getHFilesChecked();
    Collection<Path> corrupted = checker.getCorrupted();

    if (corrupted.isEmpty()) {
      LOG.info("Checked {} HFiles, none of them are corrupted.", checkedFiles);
      LOG.info("There are no incompatible HFiles.");

      return true;
    } else {
      LOG.info("Checked {} HFiles, {} are corrupted.", checkedFiles, corrupted.size());

      for (Path path : corrupted) {
        LOG.info("Corrupted file: {}", path);
      }

      LOG.info("Change data block encodings before upgrading. "
        + "Check https://s.apache.org/prefixtree for instructions.");

      return false;
    }
  }
Check HFile contents are readable by HBase 2.
@param conf used configuration
@return number of HFiles corrupted HBase
@throws IOException if a remote or network exception occurs
hbase-server/src/main/java/org/apache/hadoop/hbase/tool/HFileContentValidator.java