public static void main(String[] args) throws Exception {
    int numRegions = Integer.parseInt(args[0]);
    long numRows = Long.parseLong(args[1]);

    TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(TABLENAME)
      .setMaxFileSize(10L * 1024 * 1024 * 1024)
      .setValue(TableDescriptorBuilder.SPLIT_POLICY, ConstantSizeRegionSplitPolicy.class.getName())
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY1))
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY2))
      .setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY3)).build();

    Configuration conf = HBaseConfiguration.create();
    Connection conn = ConnectionFactory.createConnection(conf);
    Admin admin = conn.getAdmin();
    if (admin.tableExists(TABLENAME)) {
      admin.disableTable(TABLENAME);
      admin.deleteTable(TABLENAME);
    }
    if (numRegions >= 3) {
      byte[] startKey = new byte[16];
      byte[] endKey = new byte[16];
      Arrays.fill(endKey, (byte) 0xFF);
      admin.createTable(tableDescriptor, startKey, endKey, numRegions);
    } else {
      admin.createTable(tableDescriptor);
    }
    admin.close();

    Table table = conn.getTable(TABLENAME);
    byte[] qf = Bytes.toBytes("qf");
    byte[] value1 = new byte[16];
    byte[] value2 = new byte[256];
    byte[] value3 = new byte[4096];
    for (long i = 0; i < numRows; i++) {
      Put put = new Put(Hashing.md5().hashLong(i).asBytes());
      Bytes.random(value1);
      Bytes.random(value2);
      Bytes.random(value3);
      put.addColumn(FAMILY1, qf, value1);
      put.addColumn(FAMILY2, qf, value2);
      put.addColumn(FAMILY3, qf, value3);
      table.put(put);
      if (i % 10000 == 0) {
        LOG.info(i + " rows put");
      }
    }
    table.close();
    conn.close();
  }
When a log roll is about to happen, we do a flush of the regions who will be affected by the
log roll. These flushes cannot be a selective flushes, otherwise we cannot roll the logs. This
test ensures that we do a full-flush in that scenario.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestPerColumnFamilyFlush.java