use of org.apache.cassandra.db.transaction.BatchMutateTransactionUtil.CommitOrNotYetTime in project eiger by wlloyd.
the class ThriftConverter method findAndUpdatePendingTransactions.
/** Find the transactionIds of all pending transaction that could affect this column at the chosenTime
* Also update any checked transactions ids that can affect this transaction
* @param chosenColumn
* @param chosenTime
* @param currentlyVisibleColumn This is not necessary the chosen column, it contains the list of previousVersions
* @return Relevant pending transactionIds, or null if none
*/
private static Set<Long> findAndUpdatePendingTransactions(org.apache.cassandra.db.Column chosenColumn, long chosenTime, org.apache.cassandra.db.Column currentlyVisibleColumn) {
if (!(chosenColumn instanceof PendingTransactionColumn) && (!chosenColumn.isSetLatestValidTime() || chosenTime <= chosenColumn.latestValidTime())) {
//if the chosenColumn isn't a PTC and EVT < chosen < LVT then no pending transactions
assert chosenColumn.earliestValidTime() <= chosenTime;
return null;
} else {
Set<Long> pendingTransactionIds = new HashSet<Long>();
//lock for use of previousVersions
synchronized (currentlyVisibleColumn) {
for (IColumn oldColumn : currentlyVisibleColumn.previousVersions()) {
if (oldColumn.earliestValidTime() > chosenTime) {
continue;
} else {
if (oldColumn instanceof PendingTransactionColumn) {
long transactionId = ((PendingTransactionColumn) oldColumn).getTransactionId();
CommitOrNotYetTime checkResult = BatchMutateTransactionUtil.findCheckedTransactionResult(transactionId);
if (checkResult == null) {
pendingTransactionIds.add(transactionId);
} else {
applyCheckTransactionUpdate(currentlyVisibleColumn, transactionId, checkResult);
}
}
}
}
}
return pendingTransactionIds.size() == 0 ? null : pendingTransactionIds;
}
}
Aggregations