public void run() {
try {
// Now try to open a scanner on the meta table. Should stall until
// meta server comes back up.
HTable t = new HTable(conf, HConstants.META_TABLE_NAME);
Scanner s =
t.getScanner(HConstants.COLUMN_FAMILY_ARRAY,
HConstants.EMPTY_START_ROW);
s.close();
} catch (IOException e) {
LOG.fatal("could not re-open meta table because", e);
fail();
}
Scanner scanner = null;
try {
// Verify that the client can find the data after the region has moved
// to a different server
scanner =
table.getScanner(HConstants.COLUMN_FAMILY_ARRAY,
HConstants.EMPTY_START_ROW);
LOG.info("Obtained scanner " + scanner);
for (RowResult r : scanner) {
assertTrue(Bytes.equals(r.getRow(), row));
assertEquals(1, r.size());
byte[] bytes = r.get(HConstants.COLUMN_FAMILY).getValue();
assertNotNull(bytes);
assertTrue(tableName.equals(Bytes.toString(bytes)));
}
LOG.info("Success!");
} catch (Exception e) {
e.printStackTrace();
fail();
} finally {
if (scanner != null) {
LOG.info("Closing scanner " + scanner);
scanner.close();
}
}
}
};
return new Thread(runnable);