This is a thinko on my part, where I was thinking in terms of a
discrete set (UnsignedLong) and assumed RangeSets will coalesce
individual items.
Unfortunately TreeRangeSet has no way of knowing that that the
domain it operates on is discrete and hence will not merge invididual
ranges.
This patch fixes the problem by using [N,N+1) ranges to address
the problem. A follow-up patch should address this in a more
efficient manner.
Change-Id: Iecc313e09ae0cdd51a42f7d39281f7634f0358a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
closedTransactions = ImmutableMap.of();
}
closedTransactions = ImmutableMap.of();
}
- purgedTransactions.add(Range.singleton(ul));
+ purgedTransactions.add(Range.closedOpen(ul, UnsignedLong.ONE.plus(ul)));
LOG.debug("{}: finished purging inherited transaction {}", persistenceId(), id);
envelope.sendSuccess(new TransactionPurgeResponse(id, request.getSequence()), readTime() - now);
});
LOG.debug("{}: finished purging inherited transaction {}", persistenceId(), id);
envelope.sendSuccess(new TransactionPurgeResponse(id, request.getSequence()), readTime() - now);
});
// purged transactions in one go. If it does, we warn about the situation and
LOG.warn("{}: transaction {} not tracked in {}, but not present in active transactions", persistenceId,
id, purgedTransactions);
// purged transactions in one go. If it does, we warn about the situation and
LOG.warn("{}: transaction {} not tracked in {}, but not present in active transactions", persistenceId,
id, purgedTransactions);
- purgedTransactions.add(Range.singleton(ul));
+ purgedTransactions.add(Range.closedOpen(ul, UnsignedLong.ONE.plus(ul)));
return new TransactionPurgeResponse(id, request.getSequence());
}
tree.purgeTransaction(id, () -> {
return new TransactionPurgeResponse(id, request.getSequence());
}
tree.purgeTransaction(id, () -> {
- purgedTransactions.add(Range.singleton(ul));
+ purgedTransactions.add(Range.closedOpen(ul, UnsignedLong.ONE.plus(ul)));
transactions.remove(id);
LOG.debug("{}: finished purging transaction {}", persistenceId(), id);
envelope.sendSuccess(new TransactionPurgeResponse(id, request.getSequence()), readTime() - now);
transactions.remove(id);
LOG.debug("{}: finished purging transaction {}", persistenceId(), id);
envelope.sendSuccess(new TransactionPurgeResponse(id, request.getSequence()), readTime() - now);
}
// XXX: do we need to account for cookies?
}
// XXX: do we need to account for cookies?
- purgedHistories.add(Range.singleton(UnsignedLong.fromLongBits(historyId.getHistoryId())));
+ final UnsignedLong ul = UnsignedLong.fromLongBits(historyId.getHistoryId());
+ purgedHistories.add(Range.closedOpen(ul, UnsignedLong.ONE.plus(ul)));
LOG.debug("{}: Purged history {}", historyId);
}
LOG.debug("{}: Purged history {}", historyId);
}
void onTransactionPurged(final TransactionIdentifier txId) {
final UnsignedLong id = UnsignedLong.fromLongBits(txId.getTransactionId());
closedTransactions.remove(id);
void onTransactionPurged(final TransactionIdentifier txId) {
final UnsignedLong id = UnsignedLong.fromLongBits(txId.getTransactionId());
closedTransactions.remove(id);
- purgedTransactions.add(Range.singleton(id));
+ purgedTransactions.add(Range.closedOpen(id, UnsignedLong.ONE.plus(id)));
}
LOG.debug("{}: purging history {}", persistenceId, id);
}
LOG.debug("{}: purging history {}", persistenceId, id);
- purgedHistories.add(Range.singleton(UnsignedLong.fromLongBits(id.getHistoryId())));
+ final UnsignedLong ul = UnsignedLong.fromLongBits(id.getHistoryId());
+ purgedHistories.add(Range.closedOpen(ul, UnsignedLong.ONE.plus(ul)));
existing.purge(request.getSequence(), envelope, now);
return null;
}
existing.purge(request.getSequence(), envelope, now);
return null;
}