updateLiveTransactionsAndStatus();
return true;
} catch (Exception *e) {
- for (int64_t m : localCommunicationTable->keySet()) {
+ SetIterator<int64_t> * kit = getKeyIterator(localCommunicationTable);
+ while(kit->hasNext()) {
+ int64_t m = kit->next();
updateFromLocal(m);
}
+ delete kit;
}
return false;
}
}
}
+ pendingTransactionQueue->setSize(oldindex);
}
- pendingTransactionQueue->setSize(oldindex);
updateLiveStateFromLocal();
}
}
- for (Transaction *transaction : lastTransactionPartsSent->keySet()) {
+ SetIterator<Transaction *> * trit = getKeyIterator(lastTransactionPartsSent);
+ while(trit->hasNext()) {
+ Transaction *transaction = trit->next();
transaction->resetServerFailure();
// Update which transactions parts still need to be sent
transaction->removeSentParts(lastTransactionPartsSent->get(transaction));
pendingTransactionQueue->remove(transaction);
}
}
+ delete trit;
} else {
newSlots = sendSlotsReturn.getThird();
bool isInserted = false;
}
// Process each entry in the slot
- for (Entry *entry : s->getEntries()) {
+ Vector<Entry *> * ventries=s->getEntries();
+ uint vesize = ventries->size();
+ for(uint vei = 0; vei < vesize; vei++) {
+ Entry *entry = ventries->get(vei);
if (entry->getType() == TypeLastMessage) {
LastMessage *lastMessage = (LastMessage *)entry;
if ((lastMessage->getMachineID() == localMachineId) && (lastMessage->getSequenceNumber() == lastSlotAttemptedToSend->getSequenceNumber())) {
}
// Remove the aborts and commit parts that were sent from the pending to send queue
- for (Iterator<ArbitrationRound *> *iter = pendingSendArbitrationRounds->iterator(); iter->hasNext(); ) {
- ArbitrationRound *round = iter->next();
+ uint size = pendingSendArbitrationRounds->size();
+ uint oldcount = 0;
+ for (uint i=0; i < size; i++)
+ ArbitrationRound *round = pendingSendArbitrartionRounds->get(i);
round->removeParts(pendingSendArbitrationEntriesToDelete);
- if (round->isDoneSending()) {
+ if (!round->isDoneSending()) {
// Sent all the parts
- iter->remove();
+ pendingSendArbitrartionRounds->set(oldcount++,
+ pendingSendArbitrartionRounds->get(i));
}
}
+ pendingSendArbitrationRounds->setSize(oldcount);
for (Transaction *transaction : transactionPartsSent->keySet()) {
transaction->resetServerFailure();
if (hadPartialSendToServer) {
bool isInserted = false;
- uint size = s->size();
+ uint size = array->size();
for(uint i=0; i < size; i++) {
Slot *s = array->get(i);
if ((s->getSequenceNumber() == slot->getSequenceNumber()) && (s->getMachineID() == localMachineId)) {
// Clear the transactions, aborts and commits that were sent previously
transactionPartsSent->clear();
pendingSendArbitrationEntriesToDelete->clear();
-
- for (ArbitrationRound *round : pendingSendArbitrationRounds) {
+ uint size = pendingSendArbitrationRounds->size();
+ for (uint i=0; i<size; i++)
+ ArbitrartionRound *round = pendingSendArbitrationRounds->get(i);
bool isFull = false;
round->generateParts();
Vector<Entry *> *parts = round->getParts();
// Insert pending arbitration data
- for (Entry *arbitrationData : parts) {
-
+ uint vsize = parts->size();
+ for (uint vi=0; vi<vsize; vi++) {
+ Entry *arbitrationData = parts->get(vi);
+
// If it is an abort then we need to set some information
- if (arbitrationData instanceof Abort) {
+ if (arbitrationData->getType() == TypeAbort) {
((Abort *)arbitrationData)->setSequenceNumber(slot->getSequenceNumber());
}
// Iterate through all the machine Ids that we received new parts
// for
for (int64_t machineId : newTransactionParts->keySet()) {
- Hashtable<Pair<int64_t int32_t>, TransactionPart *> *parts = newTransactionParts->get(machineId);
+ Hashtable<Pair<int64_t, int32_t>, TransactionPart *, uintptr_t, 0, pairHashFunction, pairEquals> *parts = newTransactionParts->get(machineId);
// Iterate through all the parts for that machine Id
for (Pair<int64_t, int32_t> partId : parts->keySet()) {