// Create a table.
HBaseAdmin admin = new HBaseAdmin(this.conf);
admin.createTable(desc);
// insert some data into the test table
HTable table = new HTable(conf, new Text(TABLE_NAME));
for (int i = 0; i < NUM_ROWS; i++) {
long id = table.startUpdate(new Text("row_" + String.format("%1$05d", i)));
table.put(id, TEXT_COLUMN1, VALUE);
table.put(id, TEXT_COLUMN2, String.format("%1$05d", i).getBytes());
table.commit(id);
}
// LOG.info("Print table contents using scanner before map/reduce for " + TABLE_NAME);
// scanTable(TABLE_NAME, false);
// LOG.info("Print table contents using scanner+filter before map/reduce for " + TABLE_NAME);
// scanTableWithRowFilter(TABLE_NAME, false);
// Do some identity write operations on one column of the data.
for (int n = 0; n < NUM_REWRITES; n++) {
for (int i = 0; i < NUM_ROWS; i++) {
long id = table.startUpdate(new Text("row_" + String.format("%1$05d", i)));
table.put(id, TEXT_COLUMN2, String.format("%1$05d", i).getBytes());
table.commit(id);
}
}
// Wait for the flush to happen
LOG.info("Waiting, for flushes to complete");
Thread.sleep(5 * 1000);
// Wait for the flush to happen
LOG.info("Done. No flush should happen after this");
// Do another round so to populate the mem cache
for (int i = 0; i < NUM_ROWS; i++) {
long id = table.startUpdate(new Text("row_" + String.format("%1$05d", i)));
table.put(id, TEXT_COLUMN2, String.format("%1$05d", i).getBytes());
table.commit(id);
}
LOG.info("Print table contents using scanner after map/reduce for " + TABLE_NAME);
scanTable(TABLE_NAME, true);
LOG.info("Print table contents using scanner+filter after map/reduce for " + TABLE_NAME);