private void verifyHFileFavoriteNode(Path p, AsyncTableRegionLocator regionLocator, FileSystem fs)
    throws IOException {
    Configuration conf = util.getConfiguration();

    try (HFile.Reader reader = HFile.createReader(fs, p, new CacheConfig(conf), true, conf);) {

      final byte[] firstRowkey = reader.getFirstRowKey().get();
      final HRegionLocation hRegionLocation =
        FutureUtils.get(regionLocator.getRegionLocation(firstRowkey));

      final String targetHostName = hRegionLocation.getHostname();

      if (fs instanceof DistributedFileSystem) {
        String pathStr = p.toUri().getPath();
        LocatedBlocks blocks =
          ((DistributedFileSystem) fs).getClient().getLocatedBlocks(pathStr, 0L);

        boolean isFavoriteNode = false;
        List<LocatedBlock> locatedBlocks = blocks.getLocatedBlocks();
        int index = 0;
        do {
          if (index > 0) {
            assertTrue("failed use favored nodes", isFavoriteNode);
          }
          isFavoriteNode = false;
          final LocatedBlock block = locatedBlocks.get(index);

          final DatanodeInfo[] locations = getLocatedBlockLocations(block);
          for (DatanodeInfo location : locations) {

            final String hostName = location.getHostName();
            if (
              targetHostName.equals(hostName.equals("127.0.0.1")
                ? InetAddress.getLocalHost().getHostName()
                : "127.0.0.1") || targetHostName.equals(hostName)
            ) {
              isFavoriteNode = true;
              break;
            }
          }

          index++;
        } while (index < locatedBlocks.size());
        if (index > 0) {
          assertTrue("failed use favored nodes", isFavoriteNode);
        }

      }

    }
  }
test split storefile with favorite node information
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestBulkLoadHFiles.java