Github user ohadshacham commented on a diff in the pull request:
https://github.com/apache/incubator-omid/pull/19#discussion_r166572983
--- Diff:
hbase-client/src/main/java/org/apache/omid/transaction/HBaseTransaction.java ---
@@ -31,25 +31,31 @@
public class HBaseTransaction extends AbstractTransaction<HBaseCellId> {
private static final Logger LOG =
LoggerFactory.getLogger(HBaseTransaction.class);
- public HBaseTransaction(long transactionId, long epoch,
Set<HBaseCellId> writeSet, AbstractTransactionManager tm) {
- super(transactionId, epoch, writeSet, tm);
+ public HBaseTransaction(long transactionId, long epoch,
Set<HBaseCellId> writeSet, Set<HBaseCellId> conflictFreeWriteSet,
AbstractTransactionManager tm) {
+ super(transactionId, epoch, writeSet, conflictFreeWriteSet, tm);
}
- public HBaseTransaction(long transactionId, long readTimestamp,
VisibilityLevel visibilityLevel, long epoch, Set<HBaseCellId> writeSet,
AbstractTransactionManager tm) {
- super(transactionId, readTimestamp, visibilityLevel, epoch,
writeSet, tm);
+ public HBaseTransaction(long transactionId, long readTimestamp,
VisibilityLevel visibilityLevel, long epoch, Set<HBaseCellId> writeSet,
Set<HBaseCellId> conflictFreeWriteSet, AbstractTransactionManager tm) {
+ super(transactionId, readTimestamp, visibilityLevel, epoch,
writeSet, conflictFreeWriteSet, tm);
}
+ private void cleanCell(HBaseCellId cell) {
+ Delete delete = new Delete(cell.getRow());
+ delete.deleteColumn(cell.getFamily(), cell.getQualifier(),
cell.getTimestamp());
+ try {
+ cell.getTable().delete(delete);
+ } catch (IOException e) {
+ LOG.warn("Failed cleanup cell {} for Tx {}. This issue has
been ignored", cell, getTransactionId(), e);
+ }
+ }
@Override
public void cleanup() {
- Set<HBaseCellId> writeSet = getWriteSet();
- for (final HBaseCellId cell : writeSet) {
- Delete delete = new Delete(cell.getRow());
- delete.deleteColumn(cell.getFamily(), cell.getQualifier(),
cell.getTimestamp());
- try {
- cell.getTable().delete(delete);
- } catch (IOException e) {
- LOG.warn("Failed cleanup cell {} for Tx {}. This issue has
been ignored", cell, getTransactionId(), e);
- }
+ for (final HBaseCellId cell : getWriteSet()) {
+ cleanCell(cell);
+ }
+
+ for (final HBaseCellId cell : getConflictFreeWriteSet()) {
--- End diff --
Yes, deleting is actually adding a tombstone and after a rollback these
tombstones should be discarded. Naturally, these mutation are candidates for
conflict analysis unless someone asks differently.
---