I am trying to delete entries in my Accumulo table with the RowDeletingIterator, but the entries are not removed when I scan the table afterwards. Assuming there's a row_id
entry in table tableName
here is what I'm doing:
Connection connection = new ZooKeeperInstance(instance, zookeepers).getConnector(username, new PasswordToken(password));
String tableName = "tableName";
connection.tableOperations().create(tableName);
connection.tableOperations().attachIterator(tableName, new IteratorSetting(1, RowDeletingIterator.class));
// Write record with row key "row_id"
String row_id = "row_id";
Text colf = new Text("");
Text colq = new Text("data");
ColumnVisibility colv = new ColumnVisibility("");
BatchWriter writer = connection.createBatchWriter(tableName, new BatchWriterConfig()
.setMaxMemory(memBuf)
.setMaxLatency(timeout, TimeUnit.MILLISECONDS)
.setMaxWriteThreads(numThreads));
Mutation mutation = new Mutation(row_id);
mutation.put(colf, colq, colv, System.nanoTime(), new Value("stuff".getBytes()));
writer.addMutation(mutation);
writer.close();
... //More work takes place
// Delete the record with row key "row_id"
BatchWriter batchWriter = connection.createBatchWriter(tableName, new BatchWriterConfig()
.setMaxMemory(memBuf)
.setMaxLatency(timeout, TimeUnit.MILLISECONDS)
.setMaxWriteThreads(numThreads));
Mutation mutation = new Mutation(row_id);
mutation.put(new Text(), new Text(), new ColumnVisibility(), RowDeletingIterator.DELETE_ROW_VALUE);
batchWriter.addMutation(mutation);
batchWriter.close();