FastRestore:Refactor code to enable pipeline on Applier

This commit is contained in:
Meng Xu 2020-01-14 13:23:33 -08:00
parent f436ea806e
commit 35bc92b9a4
2 changed files with 1 additions and 19 deletions

View File

@ -44,21 +44,7 @@ struct RestoreApplierData : RestoreRoleData, public ReferenceCounted<RestoreAppl
// processedFileState: key: RestoreAsset; value: largest version of mutation received on the applier // processedFileState: key: RestoreAsset; value: largest version of mutation received on the applier
std::map<RestoreAsset, NotifiedVersion> processedFileState; std::map<RestoreAsset, NotifiedVersion> processedFileState;
Optional<Future<Void>> dbApplier; Optional<Future<Void>> dbApplier;
VersionedMutationsMap kvOps; // Mutations at each version
// rangeToApplier is in master and loader. Loader uses it to determine which applier a mutation should be sent
// KeyRef is the inclusive lower bound of the key range the applier (UID) is responsible for
std::map<Key, UID> rangeToApplier;
// keyOpsCount is the number of operations per key that is used to determine the key-range boundary for appliers
std::map<Key, int> keyOpsCount;
// For master applier to hold the lower bound of key ranges for each appliers
std::vector<Key> keyRangeLowerBounds;
// TODO: This block of variables may be moved to RestoreRoleData
bool inProgressApplyToDB = false;
// Mutations at each version
VersionedMutationsMap kvOps;
void addref() { return ReferenceCounted<RestoreApplierData>::addref(); } void addref() { return ReferenceCounted<RestoreApplierData>::addref(); }
void delref() { return ReferenceCounted<RestoreApplierData>::delref(); } void delref() { return ReferenceCounted<RestoreApplierData>::delref(); }
@ -83,7 +69,6 @@ struct RestoreApplierData : RestoreRoleData, public ReferenceCounted<RestoreAppl
void resetPerVersionBatch() { void resetPerVersionBatch() {
TraceEvent("FastRestore").detail("ResetPerVersionBatchOnApplier", nodeID); TraceEvent("FastRestore").detail("ResetPerVersionBatchOnApplier", nodeID);
inProgressApplyToDB = false;
kvOps.clear(); kvOps.clear();
dbApplier = Optional<Future<Void>>(); dbApplier = Optional<Future<Void>>();
} }

View File

@ -52,8 +52,6 @@ struct RestoreLoaderData : RestoreRoleData, public ReferenceCounted<RestoreLoade
// Sampled mutations to be sent back to restore master // Sampled mutations to be sent back to restore master
std::map<LoadingParam, MutationsVec> sampleMutations; std::map<LoadingParam, MutationsVec> sampleMutations;
// keyOpsCount is the number of operations per key which is used to determine the key-range boundary for appliers
std::map<Standalone<KeyRef>, int> keyOpsCount;
int numSampledMutations; // The total number of mutations received from sampled data. int numSampledMutations; // The total number of mutations received from sampled data.
Reference<IBackupContainer> bc; // Backup container is used to read backup files Reference<IBackupContainer> bc; // Backup container is used to read backup files
@ -80,7 +78,6 @@ struct RestoreLoaderData : RestoreRoleData, public ReferenceCounted<RestoreLoade
void resetPerVersionBatch() { void resetPerVersionBatch() {
TraceEvent("FastRestore").detail("ResetPerVersionBatchOnLoader", nodeID); TraceEvent("FastRestore").detail("ResetPerVersionBatchOnLoader", nodeID);
rangeToApplier.clear(); rangeToApplier.clear();
keyOpsCount.clear();
numSampledMutations = 0; numSampledMutations = 0;
processedFileParams.clear(); processedFileParams.clear();
kvOpsPerLP.clear(); kvOpsPerLP.clear();