public static RegionInfo createRegion(final Configuration conf, final Path rootDir,
    final TableDescriptor tableDescriptor, final RegionInfo newRegion, final RegionFillTask task)
    throws IOException {
    // 1. Create HRegion
    // The WAL subsystem will use the default rootDir rather than the passed in rootDir
    // unless I pass along via the conf.
    Configuration confForWAL = new Configuration(conf);
    confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
    HRegion region = HRegion.createHRegion(newRegion, rootDir, conf, tableDescriptor, null, false);
    try {
      // 2. Custom user code to interact with the created region
      if (task != null) {
        task.fillRegion(region);
      }
    } finally {
      // 3. Close the new region to flush to disk. Close log file too.
      region.close(false, true);
    }
    return region.getRegionInfo();
  }
Create new set of regions on the specified file-system.
@param conf            {@link Configuration}
@param rootDir         Root directory for HBase instance
@param tableDescriptor description of the table
@param newRegion       {@link RegionInfo} that describes the region to create
@param task            {@link RegionFillTask} custom code to populate region after creation
hbase-server/src/main/java/org/apache/hadoop/hbase/util/ModifyRegionUtils.java