@Test
  public void testFailIfNeedSplitHFile() throws IOException {
    TableName tableName = TableName.valueOf(tn.getMethodName());
    Table table = util.createTable(tableName, FAMILY);

    util.loadTable(table, FAMILY);

    FileSystem fs = util.getTestFileSystem();
    Path sfPath = new Path(fs.getWorkingDirectory(), new Path(Bytes.toString(FAMILY), "file"));
    HFileTestUtil.createHFile(util.getConfiguration(), fs, sfPath, FAMILY, QUALIFIER,
      Bytes.toBytes("aaa"), Bytes.toBytes("zzz"), 1000);

    util.getAdmin().split(tableName);
    util.waitFor(10000, 1000, () -> util.getAdmin().getRegions(tableName).size() > 1);

    Configuration config = new Configuration(util.getConfiguration());
    config.setBoolean(BulkLoadHFilesTool.FAIL_IF_NEED_SPLIT_HFILE, true);
    BulkLoadHFilesTool tool = new BulkLoadHFilesTool(config);

    String[] args = new String[] { fs.getWorkingDirectory().toString(), tableName.toString() };
    assertThrows(IOException.class, () -> tool.run(args));
    util.getHBaseCluster().getRegions(tableName)
      .forEach(r -> assertEquals(1, r.getStore(FAMILY).getStorefiles().size()));
  }
test split storefile with favorite node information
hbase-server/src/test/java/org/apache/hadoop/hbase/tool/TestBulkLoadHFiles.java