public static void flushRegionsIfNecessary(Configuration conf)
    throws IOException, InterruptedException {
    String tableName = conf.get(TABLE_NAME);
    Admin hAdmin = null;
    Connection connection = null;
    String durability = conf.get(WAL_DURABILITY);
    // Need to flush if the data is written to hbase and skip wal is enabled.
    if (
      conf.get(BULK_OUTPUT_CONF_KEY) == null && durability != null
        && Durability.SKIP_WAL.name().equalsIgnoreCase(durability)
    ) {
      LOG.info("Flushing all data that skipped the WAL.");
      try {
        connection = ConnectionFactory.createConnection(conf);
        hAdmin = connection.getAdmin();
        hAdmin.flush(TableName.valueOf(tableName));
      } finally {
        if (hAdmin != null) {
          hAdmin.close();
        }
        if (connection != null) {
          connection.close();
        }
      }
    }
  }
If the durability is set to {@link Durability#SKIP_WAL} and the data is imported to hbase, we
need to flush all the regions of the table as the data is held in memory and is also not
present in the Write Ahead Log to replay in scenarios of a crash. This method flushes all the
regions of the table in the scenarios of import data to hbase with {@link Durability#SKIP_WAL}
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java