}
@Override
public void run() throws Exception {
BatchWriter bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
Mutation m = new Mutation(new Text("r1"));
m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
bw.addMutation(m);
bw.close();
getConnector().tableOperations().flush("foo", null, null, false);
UtilWaitThread.sleep(1000);
// minc should fail, so there should be no files
checkRFiles("foo", 1, 1, 0, 0);
// try to scan table
Scanner scanner = getConnector().createScanner("foo", Constants.NO_AUTHS);
int count = 0;
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner) {
count++;
}
if (count != 1)
throw new Exception("Did not see expected # entries " + count);
// remove the bad iterator
getConnector().tableOperations().removeProperty("foo", Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.badi");
UtilWaitThread.sleep(5000);
// minc should complete
checkRFiles("foo", 1, 1, 1, 1);
count = 0;
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner) {
count++;
}
if (count != 1)
throw new Exception("Did not see expected # entries " + count);
// now try putting bad iterator back and deleting the table
getConnector().tableOperations().setProperty("foo", Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.badi", "30," + BadIterator.class.getName());
bw = getConnector().createBatchWriter("foo", new BatchWriterConfig());
m = new Mutation(new Text("r2"));
m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes()));
bw.addMutation(m);
bw.close();