Commit::Commit() :
parts(new Vector<CommitPart *>()),
partCount(0),
- missingParts(NULL),
fldisComplete(false),
hasLastPart(false),
keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
Commit::Commit(int64_t _sequenceNumber, int64_t _machineId, int64_t _transactionSequenceNumber) :
parts(new Vector<CommitPart *>()),
partCount(0),
- missingParts(NULL),
fldisComplete(true),
hasLastPart(false),
keyValueUpdateSet(new Hashset<KeyValue *, uintptr_t, 0>()),
delete keyValueUpdateSet;
}
delete liveKeys;
- if (missingParts != NULL)
- delete missingParts;
if (dataBytes != NULL)
delete dataBytes;
}
previouslySeenPart->setDead();
previouslySeenPart->releaseRef();
} else if (newPart->isLastPart()) {
- missingParts = new Hashset<int32_t>();
hasLastPart = true;
-
- for (int i = 0; i < newPart->getPartNumber(); i++) {
- if (parts->get(i) == NULL) {
- missingParts->add(i);
- }
- }
}
if (!fldisComplete && hasLastPart) {
-
// We have seen this part so remove it from the set of missing parts
- missingParts->remove(newPart->getPartNumber());
-
- // Check if all the parts have been seen
- if (missingParts->size() == 0) {
-
- // We have all the parts
- fldisComplete = true;
+ uint size = parts->size();
+ fldisComplete = true;
+ for(uint i=0; i < size; i++) {
+ if (parts->get(i) == NULL) {
+ fldisComplete = false;
+ break;
+ }
+ }
+ if (fldisComplete) {
// Decode all the parts and create the key value guard and update sets
decodeCommitData();