return true;
} catch (Exception e) {
// e.printStackTrace();
+
+ for (Long m : localCommunicationTable.keySet()) {
+ updateFromLocal(m);
+ }
}
return false;
// If there is a new key with same name then end
if ((newKey != null) && (arbitratorTable.get(newKey.getKey()) != null)) {
- System.out.println("New Key Fail");
return false;
}
if (transaction.didSendAllParts()) {
transaction.getTransactionStatus().setStatus(TransactionStatus.StatusSentFully);
pendingTransactionQueue.remove(transaction);
-
- for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
- System.out.println("Sent: " + kv + " from: " + localMachineId + " Slot:" + slot.getSequenceNumber() + " Claimed:" + transaction.getSequenceNumber());
- }
}
}
} else {
} catch (ServerException e) {
- System.out.println("Server Failure: " + e.getType());
- for (Transaction transaction : transactionPartsSent.keySet()) {
- for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
- System.out.println("Sent Error: " + kv + " " + e.getType());
- }
- }
-
if (e.getType() != ServerException.TypeInputTimeout) {
// e.printStackTrace();
return newKey == null;
}
- public synchronized boolean updateFromLocal(long machineId) {
+ private synchronized boolean updateFromLocal(long machineId) {
Pair<String, Integer> localCommunicationInformation = localCommunicationTable.get(machineId);
if (localCommunicationInformation == null) {
// Cant talk to that device locally so do nothing
for (Long transactionSequenceNumber : transactionSequenceNumbers) {
Transaction transaction = liveTransactionBySequenceNumberTable.get(transactionSequenceNumber);
- for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
- System.out.println("Arb Seen: " + kv + " " + lastSeqNumArbOn + " " + transactionSequenceNumber + " " + localMachineId + " " + transaction.getArbitrator());
- }
// Check if this machine arbitrates for this transaction if not then we cant arbitrate this transaction
continue;
}
- for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
- System.out.println("Arb Seen: " + kv + " " + lastSeqNumArbOn + " " + transactionSequenceNumber + " " + localMachineId);
- }
-
-
if (offlineTransactionsCommittedAndAtServer.contains(transaction.getId())) {
// We have seen this already locally so dont commit again
continue;
break;
}
- for (KeyValue kv : transaction.getKeyValueUpdateSet()) {
- System.out.println("Arb on: " + kv + " " + lastSeqNumArbOn + " " + transactionSequenceNumber + " " + localMachineId);
- }
-
// update the largest transaction seen by arbitrator from server
if (lastTransactionSeenFromMachineFromServer.get(transaction.getMachineId()) == null) {
// Update what the last transaction committed was for use in batch commit
lastTransactionCommitted = transactionSequenceNumber;
-
- System.out.println("Commit Generated: " + lastTransactionCommitted + " " + localMachineId);
} else {
// Guard evaluated was false so create abort
}
}
-
- for (KeyValue kv : commit.getKeyValueUpdateSet()) {
- System.out.println("Commit Seen: " + kv + " " + commit.getTransactionSequenceNumber() + " " + localMachineId);
- }
-
-
-
-
-
-
-
-
-
-
// Update the last arbitration data that we have seen so far
if (lastArbitrationDataLocalSequenceNumberSeenFromArbitrator.get(commit.getMachineId()) != null) {