// 2. Send a delete() for each of the HBase qualifiers found in the previous step.
//
// If an insert occurs during these steps, it could be missed by the delete process.
final String familyName = familyLayout.getName();
final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator()
.toHBaseColumnName(KijiColumnName.create(familyName));
final byte[] hbaseRow = entityId.getHBaseRowKey();
// Step 1.
final Get get = new Get(hbaseRow);
get.addFamily(hbaseColumnName.getFamily());
final FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ALL);
filter.addFilter(new KeyOnlyFilter());
filter.addFilter(new ColumnPrefixFilter(hbaseColumnName.getQualifier()));
get.setFilter(filter);
final Result result = mHTable.get(get);
// Step 2.
if (result.isEmpty()) {
LOG.debug("No qualifiers to delete in map family: " + familyName);
} else {
final Delete delete = SchemaPlatformBridge.get()
.createDelete(hbaseRow, HConstants.LATEST_TIMESTAMP);
for (byte[] hbaseQualifier
: result.getFamilyMap(hbaseColumnName.getFamily()).keySet()) {
LOG.debug("Deleting HBase column " + hbaseColumnName.getFamilyAsString()
+ ":" + Bytes.toString(hbaseQualifier));
delete.deleteColumns(hbaseColumnName.getFamily(), hbaseQualifier, upToTimestamp);
}
updateBuffer(delete);
}
}