// Abort has not been seen by the client it is for yet so we need to
// keep track of it
+
Abort *previouslySeenAbort = liveAbortTable->put(new Pair<int64_t, int64_t>(entry->getAbortId()), entry);
if (previouslySeenAbort != NULL) {
previouslySeenAbort->setDead(); // Delete old version of the abort since we got a rescued newer version
if ((entry->getSequenceNumber() != -1) && (lastMessageTable->get(entry->getTransactionMachineId())->getFirst() >= entry->getSequenceNumber())) {
// The machine already saw this so it is dead
entry->setDead();
- liveAbortTable->remove(&entry->getAbortId());
+ Pair<int64_t, int64_t> abortid = entry->getAbortId();
+ liveAbortTable->remove(&abortid);
if (entry->getTransactionArbitrator() == localMachineId) {
liveAbortsGeneratedByLocal->remove(entry->getArbitratorLocalSequenceNumber());
}
// Set dead a transaction if we can
- Transaction *transactionToSetDead = liveTransactionByTransactionIdTable->remove(Pair<int64_t, int64_t>(entry->getTransactionMachineId(), entry->getTransactionClientLocalSequenceNumber()));
+ Pair<int64_t, int64_t> deadPair = Pair<int64_t, int64_t>(entry->getTransactionMachineId(), entry->getTransactionClientLocalSequenceNumber());
+
+ Transaction *transactionToSetDead = liveTransactionByTransactionIdTable->remove(&deadPair);
if (transactionToSetDead != NULL) {
liveTransactionBySequenceNumberTable->remove(transactionToSetDead->getSequenceNumber());
}
// Update the last transaction sequence number that the arbitrator
// arbitrated on
- int64_t lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable->get(entry->getTransactionArbitrator());
- if ((lastTransactionNumber == NULL) || (lastTransactionNumber < entry->getTransactionSequenceNumber())) {
+ if (!lastArbitratedTransactionNumberByArbitratorTable->contains(entry->getTransactionArbitrator()) ||
+ (lastArbitratedTransactionNumberByArbitratorTable->get(entry->getTransactionArbitrator()) < entry->getTransactionSequenceNumber())) {
// Is a valid one
if (entry->getTransactionSequenceNumber() != -1) {
lastArbitratedTransactionNumberByArbitratorTable->put(entry->getTransactionArbitrator(), entry->getTransactionSequenceNumber());
void Table::processEntry(TransactionPart *entry) {
// Check if we have already seen this transaction and set it dead OR
// if it is not alive
- int64_t lastTransactionNumber = lastArbitratedTransactionNumberByArbitratorTable->get(entry->getArbitratorId());
- if ((lastTransactionNumber != NULL) && (lastTransactionNumber >= entry->getSequenceNumber())) {
+ if (lastArbitratedTransactionNumberByArbitratorTable->contains(entry->getArbitratorId()) && (lastArbitratedTransactionNumberByArbitratorTable->get(entry->getArbitratorId()) >= entry->getSequenceNumber())) {
// This transaction is dead, it was already committed or aborted
entry->setDead();
return;
}
// Set dead the abort
- for (Iterator<Map->Entry<Pair<int64_t, int64_t>, Abort *> > i = liveAbortTable->entrySet()->iterator(); i->hasNext();) {
- Abort *abort = i->next()->getValue();
+ SetIterator<Pair<int64_t, int64_t> *, Abort *, uintptr_t, 0, pairHashFunction, pairEquals> * abortit = getKeyIterator(liveAbortTable);
+
+ while(abortit->hasNext()) {
+ Pair<int64_t, int64_t> * key = abortit->next();
+ Abort *abort = liveAbortTable->get(key);
if ((abort->getTransactionMachineId() == machineId) && (abort->getSequenceNumber() <= seqNum)) {
abort->setDead();
- i->remove();
+ abortit->remove();
if (abort->getTransactionArbitrator() == localMachineId) {
liveAbortsGeneratedByLocal->remove(abort->getArbitratorLocalSequenceNumber());
}
}
}
+ delete abortit;
if (machineId == localMachineId) {
// Our own messages are immediately dead->
char livenessType = liveness->getType();