txMetricsCollector.gauge("canCommit", 1);
Stopwatch timer = new Stopwatch().start();
if (inProgress.get(tx.getWritePointer()) == null) {
// invalid transaction, either this has timed out and moved to invalid, or something else is wrong.
if (invalid.contains(tx.getWritePointer())) {
throw new TransactionNotInProgressException(
String.format("canCommit() is called for transaction %d that is not in progress (it is known to be invalid)",
tx.getWritePointer()));
} else {
throw new TransactionNotInProgressException(
String.format("canCommit() is called for transaction %d that is not in progress", tx.getWritePointer()));
}
}
Set<ChangeId> set = Sets.newHashSetWithExpectedSize(changeIds.size());