#include "commit.h"
Commit::Commit() :
- parts(new HashMap<int32_t, CommitPart *>()),
+ parts(new Hashtable<int32_t, CommitPart *>()),
missingParts(NULL),
fldisComplete(false),
hasLastPart(false),
Commit::Commit(int64_t _sequenceNumber, int64_t _machineId, int64_t _transactionSequenceNumber) :
- parts(new HashMap<int32_t, CommitPart *>()),
+ parts(new Hashtable<int32_t, CommitPart *>()),
missingParts(NULL),
fldisComplete(true),
hasLastPart(false),
return transactionSequenceNumber;
}
- Map<Integer, CommitPart> getParts() {
+ Hashtable<Integer, CommitPart> getParts() {
return parts;
}
return bbEncode.array();
}
- void setKVsMap(Map<IoTString, KeyValue> newKVs) {
+ void setKVsMap(Hashtable<IoTString, KeyValue> newKVs) {
keyValueUpdateSet.clear();
liveKeys.clear();
return older;
}
- Map<IoTString, KeyValue> kvSet = new HashMap<IoTString, KeyValue>();
+ Hashtable<IoTString, KeyValue> kvSet = new Hashtable<IoTString, KeyValue>();
for (KeyValue kv : older.getKeyValueUpdateSet()) {
kvSet.put(kv.getKey(), kv);
}
Slot lastSlotAttemptedToSend = NULL;
bool lastIsNewKey = false;
int lastNewSize = 0;
- Map<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
+ Hashtable<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
List<Entry> lastPendingSendArbitrationEntriesToDelete = NULL;
NewKey lastNewKey = NULL;
/* Data Structures */
- Map<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
- Map<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
- Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
- Map<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
- HashMap<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
- HashMap<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
- Map<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
- Map<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
- Map<Long, Map<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
- Map<Long, Map<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
- Map<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
- Map<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
- Map<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
- Map<Long, Map<Long, Commit>> liveCommitsTable = NULL;
- Map<IoTString, Commit> liveCommitsByKeyTable = NULL;
- Map<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
+ Hashtable<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
+ Hashtable<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
+ Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
+ Hashtable<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
+ Hashtable<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
+ Hashtable<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
+ Hashtable<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
+ Hashtable<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
+ Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
+ Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
+ Hashtable<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
+ Hashtable<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
+ Hashtable<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
+ Hashtable<Long, Hashtable<Long, Commit>> liveCommitsTable = NULL;
+ Hashtable<IoTString, Commit> liveCommitsByKeyTable = NULL;
+ Hashtable<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
Vector<Long> rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server
List<Transaction> pendingTransactionQueue = NULL;
List<ArbitrationRound> pendingSendArbitrationRounds = NULL;
List<Entry> pendingSendArbitrationEntriesToDelete = NULL;
- Map<Transaction, List<Integer>> transactionPartsSent = NULL;
- Map<Long, TransactionStatus> outstandingTransactionStatus = NULL;
- Map<Long, Abort> liveAbortsGeneratedByLocal = NULL;
+ Hashtable<Transaction, List<Integer>> transactionPartsSent = NULL;
+ Hashtable<Long, TransactionStatus> outstandingTransactionStatus = NULL;
+ Hashtable<Long, Abort> liveAbortsGeneratedByLocal = NULL;
Set<Pair<int64_t, int64_t>> offlineTransactionsCommittedAndAtServer = NULL;
- Map<Long, Pair<String, Integer>> localCommunicationTable = NULL;
- Map<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
- Map<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
+ Hashtable<Long, Pair<String, Integer>> localCommunicationTable = NULL;
+ Hashtable<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
+ Hashtable<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
Table(String baseurl, String password, int64_t _localMachineId, int listeningPort) {
oldestLiveSlotSequenceNumver = 1;
// init data structs
- committedKeyValueTable = new HashMap<IoTString, KeyValue>();
- speculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
- pendingTransactionSpeculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
- liveNewKeyTable = new HashMap<IoTString, NewKey>();
- lastMessageTable = new HashMap<Long, Pair<Long, Liveness>>();
- rejectedMessageWatchListTable = new HashMap<Long, HashSet<RejectedMessage>>();
- arbitratorTable = new HashMap<IoTString, Long>();
- liveAbortTable = new HashMap<Pair<int64_t, int64_t>, Abort>();
- newTransactionParts = new HashMap<Long, Map<Pair<Long, Integer>, TransactionPart>>();
- newCommitParts = new HashMap<Long, Map<Pair<Long, Integer>, CommitPart>>();
- lastArbitratedTransactionNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
- liveTransactionBySequenceNumberTable = new HashMap<Long, Transaction>();
- liveTransactionByTransactionIdTable = new HashMap<Pair<int64_t, int64_t>, Transaction>();
- liveCommitsTable = new HashMap<Long, Map<Long, Commit>>();
- liveCommitsByKeyTable = new HashMap<IoTString, Commit>();
- lastCommitSeenSequenceNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
+ committedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ speculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ pendingTransactionSpeculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ liveNewKeyTable = new Hashtable<IoTString, NewKey>();
+ lastMessageTable = new Hashtable<Long, Pair<Long, Liveness>>();
+ rejectedMessageWatchListTable = new Hashtable<Long, HashSet<RejectedMessage>>();
+ arbitratorTable = new Hashtable<IoTString, Long>();
+ liveAbortTable = new Hashtable<Pair<int64_t, int64_t>, Abort>();
+ newTransactionParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>>();
+ newCommitParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>>();
+ lastArbitratedTransactionNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
+ liveTransactionBySequenceNumberTable = new Hashtable<Long, Transaction>();
+ liveTransactionByTransactionIdTable = new Hashtable<Pair<int64_t, int64_t>, Transaction>();
+ liveCommitsTable = new Hashtable<Long, Hashtable<Long, Commit>>();
+ liveCommitsByKeyTable = new Hashtable<IoTString, Commit>();
+ lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
rejectedSlotList = new Vector<Long>();
pendingTransactionQueue = new ArrayList<Transaction>();
pendingSendArbitrationEntriesToDelete = new ArrayList<Entry>();
- transactionPartsSent = new HashMap<Transaction, List<Integer>>();
- outstandingTransactionStatus = new HashMap<Long, TransactionStatus>();
- liveAbortsGeneratedByLocal = new HashMap<Long, Abort>();
+ transactionPartsSent = new Hashtable<Transaction, List<Integer>>();
+ outstandingTransactionStatus = new Hashtable<Long, TransactionStatus>();
+ liveAbortsGeneratedByLocal = new Hashtable<Long, Abort>();
offlineTransactionsCommittedAndAtServer = new HashSet<Pair<int64_t, int64_t>>();
- localCommunicationTable = new HashMap<Long, Pair<String, Integer>>();
- lastTransactionSeenFromMachineFromServer = new HashMap<int64_t, int64_t>();
+ localCommunicationTable = new Hashtable<Long, Pair<String, Integer>>();
+ lastTransactionSeenFromMachineFromServer = new Hashtable<int64_t, int64_t>();
pendingSendArbitrationRounds = new ArrayList<ArbitrationRound>();
- lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new HashMap<int64_t, int64_t>();
+ lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new Hashtable<int64_t, int64_t>();
// Other init stuff
lastInsertedNewKey = insertedNewKey;
lastNewSize = newSize;
lastNewKey = newKey;
- lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+ lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
// if (!fromRetry) {
- // lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+ // lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
// lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
// }
}
// Get the commits to send back
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
if (commitForClientTable != NULL) {
List<Long> commitLocalSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
Collections.sort(commitLocalSequenceNumbers);
// Iterate through all the machine Ids that we received new parts for
for (Long machineId : newTransactionParts.keySet()) {
- Map<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
+ Hashtable<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
// Iterate through all the parts for that machine Id
for (Pair<Long, Integer> partId : parts.keySet()) {
Collections.sort(transactionSequenceNumbers);
// Collection of key value pairs that are
- Map<IoTString, KeyValue> speculativeTableTmp = new HashMap<IoTString, KeyValue>();
+ Hashtable<IoTString, KeyValue> speculativeTableTmp = new Hashtable<IoTString, KeyValue>();
// The last transaction arbitrated on
int64_t lastTransactionCommitted = -1;
// Iterate through all the machine Ids that we received new parts for
for (Long machineId : newCommitParts.keySet()) {
- Map<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
+ Hashtable<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
// Iterate through all the parts for that machine Id
for (Pair<Long, Integer> partId : parts.keySet()) {
CommitPart part = parts.get(partId);
// Get the transaction object for that sequence number
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
if (commitForClientTable == NULL) {
// This is the first commit from this device
- commitForClientTable = new HashMap<Long, Commit>();
+ commitForClientTable = new Hashtable<Long, Commit>();
liveCommitsTable.put(part.getMachineId(), commitForClientTable);
}
for (Long arbitratorId : liveCommitsTable.keySet()) {
// Get all the commits for a specific arbitrator
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
// Sort the commits in order
List<Long> commitSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
}
// This part is still alive
- Map<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
+ Hashtable<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
if (transactionPart == NULL) {
// Dont have a table for this machine Id yet so make one
- transactionPart = new HashMap<Pair<Long, Integer>, TransactionPart>();
+ transactionPart = new Hashtable<Pair<Long, Integer>, TransactionPart>();
newTransactionParts.put(entry.getMachineId(), transactionPart);
}
- Map<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
+ Hashtable<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
if (commitPart == NULL) {
// Don't have a table for this machine Id yet so make one
- commitPart = new HashMap<Pair<Long, Integer>, CommitPart>();
+ commitPart = new Hashtable<Pair<Long, Integer>, CommitPart>();
newCommitParts.put(entry.getMachineId(), commitPart);
}
private Slot lastSlotAttemptedToSend = NULL;
private bool lastIsNewKey = false;
private int lastNewSize = 0;
- private Map<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
+ private Hashtable<Transaction, List<Integer>> lastTransactionPartsSent = NULL;
private List<Entry> lastPendingSendArbitrationEntriesToDelete = NULL;
private NewKey lastNewKey = NULL;
/* Data Structures */
- private Map<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
- private Map<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
- private Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
- private Map<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
- private HashMap<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
- private HashMap<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
- private Map<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
- private Map<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
- private Map<Long, Map<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
- private Map<Long, Map<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
- private Map<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
- private Map<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
- private Map<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
- private Map<Long, Map<Long, Commit>> liveCommitsTable = NULL;
- private Map<IoTString, Commit> liveCommitsByKeyTable = NULL;
- private Map<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
+ private Hashtable<IoTString, KeyValue> committedKeyValueTable = NULL; // Table of committed key value pairs
+ private Hashtable<IoTString, KeyValue> speculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value
+ private Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable = NULL; // Table of speculated key value pairs, if there is a speculative value from the pending transactions
+ private Hashtable<IoTString, NewKey> liveNewKeyTable = NULL; // Table of live new keys
+ private Hashtable<Long, Pair<Long, Liveness>> lastMessageTable = NULL; // Last message sent by a client machine id -> (Seq Num, Slot or LastMessage);
+ private Hashtable<Long, HashSet<RejectedMessage>> rejectedMessageWatchListTable = NULL; // Table of machine Ids and the set of rejected messages they have not seen yet
+ private Hashtable<IoTString, Long> arbitratorTable = NULL; // Table of keys and their arbitrators
+ private Hashtable<Pair<int64_t, int64_t>, Abort> liveAbortTable = NULL; // Table live abort messages
+ private Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>> newTransactionParts = NULL; // transaction parts that are seen in this latest round of slots from the server
+ private Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>> newCommitParts = NULL; // commit parts that are seen in this latest round of slots from the server
+ private Hashtable<int64_t, int64_t> lastArbitratedTransactionNumberByArbitratorTable = NULL; // Last transaction sequence number that an arbitrator arbitrated on
+ private Hashtable<Long, Transaction> liveTransactionBySequenceNumberTable = NULL; // live transaction grouped by the sequence number
+ private Hashtable<Pair<int64_t, int64_t>, Transaction> liveTransactionByTransactionIdTable = NULL; // live transaction grouped by the transaction ID
+ private Hashtable<Long, Hashtable<Long, Commit>> liveCommitsTable = NULL;
+ private Hashtable<IoTString, Commit> liveCommitsByKeyTable = NULL;
+ private Hashtable<int64_t, int64_t> lastCommitSeenSequenceNumberByArbitratorTable = NULL;
private Vector<Long> rejectedSlotList = NULL; // List of rejected slots that have yet to be sent to the server
private List<Transaction> pendingTransactionQueue = NULL;
private List<ArbitrationRound> pendingSendArbitrationRounds = NULL;
private List<Entry> pendingSendArbitrationEntriesToDelete = NULL;
- private Map<Transaction, List<Integer>> transactionPartsSent = NULL;
- private Map<Long, TransactionStatus> outstandingTransactionStatus = NULL;
- private Map<Long, Abort> liveAbortsGeneratedByLocal = NULL;
+ private Hashtable<Transaction, List<Integer>> transactionPartsSent = NULL;
+ private Hashtable<Long, TransactionStatus> outstandingTransactionStatus = NULL;
+ private Hashtable<Long, Abort> liveAbortsGeneratedByLocal = NULL;
private Set<Pair<int64_t, int64_t>> offlineTransactionsCommittedAndAtServer = NULL;
- private Map<Long, Pair<String, Integer>> localCommunicationTable = NULL;
- private Map<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
- private Map<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
+ private Hashtable<Long, Pair<String, Integer>> localCommunicationTable = NULL;
+ private Hashtable<int64_t, int64_t> lastTransactionSeenFromMachineFromServer = NULL;
+ private Hashtable<int64_t, int64_t> lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = NULL;
public Table(String baseurl, String password, int64_t _localMachineId, int listeningPort) {
oldestLiveSlotSequenceNumver = 1;
// init data structs
- committedKeyValueTable = new HashMap<IoTString, KeyValue>();
- speculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
- pendingTransactionSpeculatedKeyValueTable = new HashMap<IoTString, KeyValue>();
- liveNewKeyTable = new HashMap<IoTString, NewKey>();
- lastMessageTable = new HashMap<Long, Pair<Long, Liveness>>();
- rejectedMessageWatchListTable = new HashMap<Long, HashSet<RejectedMessage>>();
- arbitratorTable = new HashMap<IoTString, Long>();
- liveAbortTable = new HashMap<Pair<int64_t, int64_t>, Abort>();
- newTransactionParts = new HashMap<Long, Map<Pair<Long, Integer>, TransactionPart>>();
- newCommitParts = new HashMap<Long, Map<Pair<Long, Integer>, CommitPart>>();
- lastArbitratedTransactionNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
- liveTransactionBySequenceNumberTable = new HashMap<Long, Transaction>();
- liveTransactionByTransactionIdTable = new HashMap<Pair<int64_t, int64_t>, Transaction>();
- liveCommitsTable = new HashMap<Long, Map<Long, Commit>>();
- liveCommitsByKeyTable = new HashMap<IoTString, Commit>();
- lastCommitSeenSequenceNumberByArbitratorTable = new HashMap<int64_t, int64_t>();
+ committedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ speculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ pendingTransactionSpeculatedKeyValueTable = new Hashtable<IoTString, KeyValue>();
+ liveNewKeyTable = new Hashtable<IoTString, NewKey>();
+ lastMessageTable = new Hashtable<Long, Pair<Long, Liveness>>();
+ rejectedMessageWatchListTable = new Hashtable<Long, HashSet<RejectedMessage>>();
+ arbitratorTable = new Hashtable<IoTString, Long>();
+ liveAbortTable = new Hashtable<Pair<int64_t, int64_t>, Abort>();
+ newTransactionParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, TransactionPart>>();
+ newCommitParts = new Hashtable<Long, Hashtable<Pair<Long, Integer>, CommitPart>>();
+ lastArbitratedTransactionNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
+ liveTransactionBySequenceNumberTable = new Hashtable<Long, Transaction>();
+ liveTransactionByTransactionIdTable = new Hashtable<Pair<int64_t, int64_t>, Transaction>();
+ liveCommitsTable = new Hashtable<Long, Hashtable<Long, Commit>>();
+ liveCommitsByKeyTable = new Hashtable<IoTString, Commit>();
+ lastCommitSeenSequenceNumberByArbitratorTable = new Hashtable<int64_t, int64_t>();
rejectedSlotList = new Vector<Long>();
pendingTransactionQueue = new ArrayList<Transaction>();
pendingSendArbitrationEntriesToDelete = new ArrayList<Entry>();
- transactionPartsSent = new HashMap<Transaction, List<Integer>>();
- outstandingTransactionStatus = new HashMap<Long, TransactionStatus>();
- liveAbortsGeneratedByLocal = new HashMap<Long, Abort>();
+ transactionPartsSent = new Hashtable<Transaction, List<Integer>>();
+ outstandingTransactionStatus = new Hashtable<Long, TransactionStatus>();
+ liveAbortsGeneratedByLocal = new Hashtable<Long, Abort>();
offlineTransactionsCommittedAndAtServer = new HashSet<Pair<int64_t, int64_t>>();
- localCommunicationTable = new HashMap<Long, Pair<String, Integer>>();
- lastTransactionSeenFromMachineFromServer = new HashMap<int64_t, int64_t>();
+ localCommunicationTable = new Hashtable<Long, Pair<String, Integer>>();
+ lastTransactionSeenFromMachineFromServer = new Hashtable<int64_t, int64_t>();
pendingSendArbitrationRounds = new ArrayList<ArbitrationRound>();
- lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new HashMap<int64_t, int64_t>();
+ lastArbitrationDataLocalSequenceNumberSeenFromArbitrator = new Hashtable<int64_t, int64_t>();
// Other init stuff
lastInsertedNewKey = insertedNewKey;
lastNewSize = newSize;
lastNewKey = newKey;
- lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+ lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
// if (!fromRetry) {
- // lastTransactionPartsSent = new HashMap<Transaction, List<Integer>>(transactionPartsSent);
+ // lastTransactionPartsSent = new Hashtable<Transaction, List<Integer>>(transactionPartsSent);
// lastPendingSendArbitrationEntriesToDelete = new ArrayList<Entry>(pendingSendArbitrationEntriesToDelete);
// }
}
// Get the commits to send back
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(localMachineId);
if (commitForClientTable != NULL) {
List<Long> commitLocalSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
Collections.sort(commitLocalSequenceNumbers);
// Iterate through all the machine Ids that we received new parts for
for (Long machineId : newTransactionParts.keySet()) {
- Map<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
+ Hashtable<Pair<Long, Integer>, TransactionPart> parts = newTransactionParts.get(machineId);
// Iterate through all the parts for that machine Id
for (Pair<Long, Integer> partId : parts.keySet()) {
Collections.sort(transactionSequenceNumbers);
// Collection of key value pairs that are
- Map<IoTString, KeyValue> speculativeTableTmp = new HashMap<IoTString, KeyValue>();
+ Hashtable<IoTString, KeyValue> speculativeTableTmp = new Hashtable<IoTString, KeyValue>();
// The last transaction arbitrated on
int64_t lastTransactionCommitted = -1;
// Iterate through all the machine Ids that we received new parts for
for (Long machineId : newCommitParts.keySet()) {
- Map<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
+ Hashtable<Pair<Long, Integer>, CommitPart> parts = newCommitParts.get(machineId);
// Iterate through all the parts for that machine Id
for (Pair<Long, Integer> partId : parts.keySet()) {
CommitPart part = parts.get(partId);
// Get the transaction object for that sequence number
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(part.getMachineId());
if (commitForClientTable == NULL) {
// This is the first commit from this device
- commitForClientTable = new HashMap<Long, Commit>();
+ commitForClientTable = new Hashtable<Long, Commit>();
liveCommitsTable.put(part.getMachineId(), commitForClientTable);
}
for (Long arbitratorId : liveCommitsTable.keySet()) {
// Get all the commits for a specific arbitrator
- Map<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
+ Hashtable<Long, Commit> commitForClientTable = liveCommitsTable.get(arbitratorId);
// Sort the commits in order
List<Long> commitSequenceNumbers = new ArrayList<Long>(commitForClientTable.keySet());
}
// This part is still alive
- Map<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
+ Hashtable<Pair<Long, Integer>, TransactionPart> transactionPart = newTransactionParts.get(entry.getMachineId());
if (transactionPart == NULL) {
// Dont have a table for this machine Id yet so make one
- transactionPart = new HashMap<Pair<Long, Integer>, TransactionPart>();
+ transactionPart = new Hashtable<Pair<Long, Integer>, TransactionPart>();
newTransactionParts.put(entry.getMachineId(), transactionPart);
}
- Map<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
+ Hashtable<Pair<Long, Integer>, CommitPart> commitPart = newCommitParts.get(entry.getMachineId());
if (commitPart == NULL) {
// Don't have a table for this machine Id yet so make one
- commitPart = new HashMap<Pair<Long, Integer>, CommitPart>();
+ commitPart = new Hashtable<Pair<Long, Integer>, CommitPart>();
newCommitParts.put(entry.getMachineId(), commitPart);
}
class Transaction {
- Map<Integer, TransactionPart> parts = NULL;
+ Hashtable<Integer, TransactionPart> parts = NULL;
Set<Integer> missingParts = NULL;
List<Integer> partsPendingSend = NULL;
bool isComplete = false;
bool hadServerFailure = false;
Transaction() {
- parts = new HashMap<Integer, TransactionPart>();
+ parts = new Hashtable<Integer, TransactionPart>();
keyValueGuardSet = new HashSet<KeyValue>();
keyValueUpdateSet = new HashSet<KeyValue>();
partsPendingSend = new ArrayList<Integer>();
return clientLocalSequenceNumber;
}
- Map<Integer, TransactionPart> getParts() {
+ Hashtable<Integer, TransactionPart> getParts() {
return parts;
}
}
}
- bool evaluateGuard(Map<IoTString, KeyValue> committedKeyValueTable, Map<IoTString, KeyValue> speculatedKeyValueTable, Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
+ bool evaluateGuard(Hashtable<IoTString, KeyValue> committedKeyValueTable, Hashtable<IoTString, KeyValue> speculatedKeyValueTable, Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
for (KeyValue kvGuard : keyValueGuardSet) {
// First check if the key is in the speculative table, this is the value of the latest assumption
bool hadServerFailure = false;
public Transaction() {
- parts = new HashMap<Integer, TransactionPart>();
+ parts = new Hashtable<Integer, TransactionPart>();
keyValueGuardSet = new HashSet<KeyValue>();
keyValueUpdateSet = new HashSet<KeyValue>();
partsPendingSend = new ArrayList<Integer>();
return clientLocalSequenceNumber;
}
- public Map<Integer, TransactionPart> getParts() {
+ public Hashtable<Integer, TransactionPart> getParts() {
return parts;
}
}
}
- public bool evaluateGuard(Map<IoTString, KeyValue> committedKeyValueTable, Map<IoTString, KeyValue> speculatedKeyValueTable, Map<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
+ public bool evaluateGuard(Hashtable<IoTString, KeyValue> committedKeyValueTable, Hashtable<IoTString, KeyValue> speculatedKeyValueTable, Hashtable<IoTString, KeyValue> pendingTransactionSpeculatedKeyValueTable) {
for (KeyValue kvGuard : keyValueGuardSet) {
// First check if the key is in the speculative table, this is the value of the latest assumption