Fix non-deterministic error

This commit is contained in:
Meng Xu 2019-12-03 16:55:23 -08:00
parent 3310f67e9e
commit 6b07c271f1
3 changed files with 6 additions and 0 deletions

View File

@ -84,6 +84,7 @@ struct RestoreLoaderData : RestoreRoleData, public ReferenceCounted<RestoreLoade
numSampledMutations = 0;
processedFileParams.clear();
kvOpsPerLP.clear();
sampleMutations.clear();
}
// Only get the appliers that are responsible for a range

View File

@ -364,12 +364,14 @@ void splitKeyRangeForAppliers(Reference<RestoreMasterData> self) {
std::vector<Key> keyrangeSplitter;
keyrangeSplitter.push_back(normalKeys.begin); // First slot
double cumulativeSize = slotSize;
TraceEvent("FastRestore").detail("VersionBatch", self->batchIndex).detail("SamplingSize", self->samplesSize);
while (cumulativeSize < self->samplesSize) {
IndexedSet<Key, int64_t>::iterator lowerBound = self->samples.index(cumulativeSize);
if (lowerBound == self->samples.end()) {
break;
}
keyrangeSplitter.push_back(*lowerBound);
TraceEvent("FastRestore").detail("VersionBatch", self->batchIndex).detail("CumulativeSize", cumulativeSize).detail("SlotSize", slotSize);
cumulativeSize += slotSize;
}
if (keyrangeSplitter.size() < numAppliers) {
@ -491,6 +493,8 @@ ACTOR static Future<Void> initializeVersionBatch(Reference<RestoreMasterData> se
}
wait(sendBatchRequests(&RestoreLoaderInterface::initVersionBatch, self->loadersInterf, requestsToLoaders));
self->resetPerVersionBatch();
return Void();
}

View File

@ -77,6 +77,7 @@ struct RestoreMasterData : RestoreRoleData, public ReferenceCounted<RestoreMaste
~RestoreMasterData() = default;
void resetPerVersionBatch() {
TraceEvent("FastRestore").detail("RestoreMaster", "ResetPerVersionBatch").detail("VersionBatchIndex", batchIndex);
samplesSize = 0;
samples.clear();
}