diff --git a/fdbclient/RestoreWorkerInterface.actor.h b/fdbclient/RestoreWorkerInterface.actor.h index 5486404a90..f107b881da 100644 --- a/fdbclient/RestoreWorkerInterface.actor.h +++ b/fdbclient/RestoreWorkerInterface.actor.h @@ -211,9 +211,7 @@ struct RestoreAsset { UID uid; - RestoreAsset() { - uid = deterministicRandom()->randomUniqueID(); - } + RestoreAsset() { uid = deterministicRandom()->randomUniqueID(); } bool operator==(const RestoreAsset& r) const { return fileIndex == r.fileIndex && filename == r.filename && offset == r.offset && len == r.len && @@ -236,8 +234,9 @@ struct RestoreAsset { std::string toString() { std::stringstream ss; - ss << "UID:" << uid.toString() << " begin:" << beginVersion << " end:" << endVersion << " range:" << range.toString() - << " filename:" << filename << " fileIndex:" << fileIndex << " offset:" << offset << " len:" << len; + ss << "UID:" << uid.toString() << " begin:" << beginVersion << " end:" << endVersion + << " range:" << range.toString() << " filename:" << filename << " fileIndex:" << fileIndex + << " offset:" << offset << " len:" << len; return ss.str(); } @@ -256,7 +255,7 @@ struct LoadingParam { Key url; Version prevVersion; Version rangeVersion; // range file's version - //Version endVersion; // range file's mutations are all at the endVersion + // Version endVersion; // range file's mutations are all at the endVersion int64_t blockSize; RestoreAsset asset; @@ -272,7 +271,7 @@ struct LoadingParam { template void serialize(Ar& ar) { - //serializer(ar, isRangeFile, url, prevVersion, endVersion, blockSize, asset); + // serializer(ar, isRangeFile, url, prevVersion, endVersion, blockSize, asset); serializer(ar, isRangeFile, url, prevVersion, rangeVersion, blockSize, asset); } @@ -281,7 +280,7 @@ struct LoadingParam { // str << "isRangeFile:" << isRangeFile << " url:" << url.toString() << " prevVersion:" << prevVersion // << " endVersion:" << endVersion << " blockSize:" << blockSize << " RestoreAsset:" << asset.toString(); str << "isRangeFile:" << isRangeFile << " url:" << url.toString() << " prevVersion:" << prevVersion - << " rangeVersion:" << rangeVersion << " blockSize:" << blockSize << " RestoreAsset:" << asset.toString(); + << " rangeVersion:" << rangeVersion << " blockSize:" << blockSize << " RestoreAsset:" << asset.toString(); return str.str(); } }; diff --git a/fdbserver/RestoreLoader.actor.cpp b/fdbserver/RestoreLoader.actor.cpp index 0fac96b704..8f9e57c1b6 100644 --- a/fdbserver/RestoreLoader.actor.cpp +++ b/fdbserver/RestoreLoader.actor.cpp @@ -153,8 +153,8 @@ ACTOR Future _processLoadingParam(LoadingParam param, Reference(param.blockSize, param.asset.len - j); if (param.isRangeFile) { - fileParserFutures.push_back( - _parseRangeFileToMutationsOnLoader(kvOpsPerLPIter, samplesIter, self->bc, param.rangeVersion, subAsset)); + fileParserFutures.push_back(_parseRangeFileToMutationsOnLoader(kvOpsPerLPIter, samplesIter, self->bc, + param.rangeVersion, subAsset)); } else { // TODO: Sanity check the log file's range is overlapped with the restored version range fileParserFutures.push_back(_parseLogFileToMutationsOnLoader(&processedFileOffset, &mutationMap, @@ -246,7 +246,9 @@ ACTOR Future sendMutationsToApplier(Reference self, Ver } Version commitVersion = kvOp->first; if (!(commitVersion >= asset.beginVersion && commitVersion <= asset.endVersion)) { // Debug purpose - TraceEvent(SevError, "FastRestore_SendMutationsToApplier").detail("CommitVersion", commitVersion).detail("RestoreAsset", asset.toString()); + TraceEvent(SevError, "FastRestore_SendMutationsToApplier") + .detail("CommitVersion", commitVersion) + .detail("RestoreAsset", asset.toString()); } ASSERT(commitVersion >= asset.beginVersion); ASSERT(commitVersion <= asset.endVersion); // endVersion is an empty commit to ensure progress diff --git a/fdbserver/RestoreMaster.actor.cpp b/fdbserver/RestoreMaster.actor.cpp index f34263becc..311d77d596 100644 --- a/fdbserver/RestoreMaster.actor.cpp +++ b/fdbserver/RestoreMaster.actor.cpp @@ -37,8 +37,7 @@ ACTOR static Future clearDB(Database cx); ACTOR static Future collectBackupFiles(Reference bc, std::vector* rangeFiles, - std::vector* logFiles, Database cx, - RestoreRequest request); + std::vector* logFiles, Database cx, RestoreRequest request); ACTOR static Future processRestoreRequest(Reference self, Database cx, RestoreRequest request); ACTOR static Future startProcessRestoreRequests(Reference self, Database cx); @@ -288,7 +287,7 @@ ACTOR static Future loadFilesOnLoaders(Reference self, LoadingParam param; param.prevVersion = 0; // Each file's NotifiedVersion starts from 0 - //param.endVersion = file.isRange ? file.version : file.endVersion; + // param.endVersion = file.isRange ? file.version : file.endVersion; param.url = request.url; param.isRangeFile = file.isRange; param.rangeVersion = file.isRange ? file.version : -1; @@ -453,8 +452,8 @@ ACTOR static Future>> collectRestoreRequest // Collect the backup files' description into output_files by reading the backupContainer bc. ACTOR static Future collectBackupFiles(Reference bc, std::vector* rangeFiles, - std::vector* logFiles, Database cx, - RestoreRequest request) { + std::vector* logFiles, Database cx, + RestoreRequest request) { state BackupDescription desc = wait(bc->describeBackup()); // Convert version to real time for operators to read the BackupDescription desc. diff --git a/fdbserver/RestoreMaster.actor.h b/fdbserver/RestoreMaster.actor.h index 7e67ce4925..04b5245fbd 100644 --- a/fdbserver/RestoreMaster.actor.h +++ b/fdbserver/RestoreMaster.actor.h @@ -58,9 +58,7 @@ struct VersionBatch { } // RestoreAsset and VersionBatch both use endVersion as exclusive in version range - bool isInVersionRange(Version version) const { - return version >= beginVersion && version < endVersion; - } + bool isInVersionRange(Version version) const { return version >= beginVersion && version < endVersion; } }; struct RestoreMasterData : RestoreRoleData, public ReferenceCounted { @@ -106,17 +104,22 @@ struct RestoreMasterData : RestoreRoleData, public ReferenceCounted= vb.second.endVersion || f.beginVersion < vb.second.beginVersion); - TraceEvent(invalidVersion ? SevError : SevInfo, "FastRestoreVersionBatches").detail("BatchIndex", i).detail("RangeFile", f.toString()); + bool invalidVersion = (f.beginVersion != f.endVersion) || (f.beginVersion >= vb.second.endVersion || + f.beginVersion < vb.second.beginVersion); + TraceEvent(invalidVersion ? SevError : SevInfo, "FastRestoreVersionBatches") + .detail("BatchIndex", i) + .detail("RangeFile", f.toString()); } for (auto& f : vb.second.logFiles) { bool outOfRange = (f.beginVersion >= vb.second.endVersion || f.endVersion <= vb.second.beginVersion); - TraceEvent(outOfRange ? SevError : SevInfo, "FastRestoreVersionBatches").detail("BatchIndex", i).detail("LogFile", f.toString()); + TraceEvent(outOfRange ? SevError : SevInfo, "FastRestoreVersionBatches") + .detail("BatchIndex", i) + .detail("LogFile", f.toString()); } ++i; } @@ -171,7 +174,7 @@ struct RestoreMasterData : RestoreRoleData, public ReferenceCounted batchSizeThreshold void buildVersionBatches(const std::vector& rangeFiles, const std::vector& logFiles, - std::map* versionBatches) { + std::map* versionBatches) { // Version batch range [beginVersion, endVersion) Version beginVersion = 0; Version endVersion = 0; @@ -217,8 +220,8 @@ struct RestoreMasterData : RestoreRoleData, public ReferenceCountedemplace(vb.beginVersion, vb); // copy vb to versionBatch // start finding the next version batch