use of org.apache.accumulo.core.client.MutationsRejectedException in project accumulo by apache.
the class StatusMaker method deleteStatusRecord.
/**
* Because there is only one active Manager, and thus one active StatusMaker, the only safe time
* that we can issue the delete for a Status which is closed is immediately after writing it to
* the replication table.
* <p>
* If we try to defer and delete these entries in another thread/process, we will have no
* assurance that the Status message was propagated to the replication table. It is easiest, in
* terms of concurrency, to do this all in one step.
*
* @param k
* The Key to delete
*/
protected void deleteStatusRecord(Key k) {
log.debug("Deleting {} from metadata table as it's no longer needed", k.toStringNoTruncate());
if (metadataWriter == null) {
try {
metadataWriter = client.createBatchWriter(sourceTableName);
} catch (TableNotFoundException e) {
throw new RuntimeException("Metadata table doesn't exist");
}
}
try {
Mutation m = new Mutation(k.getRow());
m.putDelete(k.getColumnFamily(), k.getColumnQualifier());
metadataWriter.addMutation(m);
metadataWriter.flush();
} catch (MutationsRejectedException e) {
log.warn("Failed to delete status mutations for metadata table, will retry", e);
}
}
Aggregations