FR:fix compilation error

This commit is contained in:
Meng Xu 2020-08-04 23:04:38 -07:00
parent 7992cef025
commit 879998d01b
5 changed files with 19 additions and 13 deletions

View File

@ -53,6 +53,7 @@ struct RestoreSendVersionedMutationsRequest;
struct RestoreSysInfo; struct RestoreSysInfo;
struct RestoreApplierInterface; struct RestoreApplierInterface;
struct RestoreFinishRequest; struct RestoreFinishRequest;
struct RestoreSamplesRequest;
// RestoreSysInfo includes information each (type of) restore roles should know. // RestoreSysInfo includes information each (type of) restore roles should know.
// At this moment, it only include appliers. We keep the name for future extension. // At this moment, it only include appliers. We keep the name for future extension.
@ -206,7 +207,7 @@ struct RestoreApplierInterface : RestoreRoleInterface {
struct RestoreControllerInterface : RestoreRoleInterface { struct RestoreControllerInterface : RestoreRoleInterface {
constexpr static FileIdentifier file_identifier = 54253047; constexpr static FileIdentifier file_identifier = 54253047;
RequestStream<RestoreSimpleRequest> samples; RequestStream<RestoreSamplesRequest> samples;
bool operator==(RestoreWorkerInterface const& r) const { return id() == r.id(); } bool operator==(RestoreWorkerInterface const& r) const { return id() == r.id(); }
bool operator!=(RestoreWorkerInterface const& r) const { return id() != r.id(); } bool operator!=(RestoreWorkerInterface const& r) const { return id() != r.id(); }
@ -444,13 +445,15 @@ struct RestoreSamplesRequest : TimedRequest {
int batchIndex; int batchIndex;
SampledMutationsVec samples; // sampled mutations SampledMutationsVec samples; // sampled mutations
ReplyPromise<RestoreCommonReply> reply;
RestoreSamplesRequest() = default; RestoreSamplesRequest() = default;
explicit RestoreSamplesRequest(UID id, int batchIndex, SampledMutationsVec samples) explicit RestoreSamplesRequest(UID id, int batchIndex, SampledMutationsVec samples)
: id(id), batchIndex(batchIndex), samples(samples) {} : id(id), batchIndex(batchIndex), samples(samples) {}
template <class Ar> template <class Ar>
void serialize(Ar& ar) { void serialize(Ar& ar) {
serializer(ar, id, batchIndex, samples); serializer(ar, id, batchIndex, samples, reply);
} }
std::string toString() { std::string toString() {

View File

@ -76,7 +76,7 @@ void splitKeyRangeForAppliers(Reference<ControllerBatchData> batchData,
ACTOR Future<Void> sampleBackups(Reference<RestoreControllerData> self, RestoreControllerInterface ci) { ACTOR Future<Void> sampleBackups(Reference<RestoreControllerData> self, RestoreControllerInterface ci) {
loop { loop {
try { try {
RestoreSamplesRequest req = waitnext(ci.samples.getFuture()); RestoreSamplesRequest req = waitNext(ci.samples.getFuture());
if (req.batchIndex > self->batch.size()) { if (req.batchIndex > self->batch.size()) {
TraceEvent(SevError, "FastRestoreControllerSampleBackupsInvalidBatchIndex") TraceEvent(SevError, "FastRestoreControllerSampleBackupsInvalidBatchIndex")
.detail("BatchIndex", req.batchIndex) .detail("BatchIndex", req.batchIndex)
@ -92,10 +92,7 @@ ACTOR Future<Void> sampleBackups(Reference<RestoreControllerData> self, RestoreC
batch->samples.addMetric(m.key, m.size); batch->samples.addMetric(m.key, m.size);
} }
} catch (Error& e) { } catch (Error& e) {
TraceEvent(SevWarn, "FastRestoreControllerError", self->id()) TraceEvent(SevWarn, "FastRestoreControllerSampleBackupsError", self->id()).error(e);
.detail("RequestType", "RestoreSamplesRequest")
.error(e, true);
actors.clear(false);
break; break;
} }
} }
@ -107,7 +104,7 @@ ACTOR Future<Void> startRestoreController(Reference<RestoreWorkerData> controlle
ASSERT(controllerWorker.isValid()); ASSERT(controllerWorker.isValid());
ASSERT(controllerWorker->controllerInterf.present()); ASSERT(controllerWorker->controllerInterf.present());
state Reference<RestoreControllerData> self = state Reference<RestoreControllerData> self =
Reference<RestoreControllerData>(new RestoreControllerData(controllerWorker->controllerInterf.id())); Reference<RestoreControllerData>(new RestoreControllerData(controllerWorker->controllerInterf.get().id()));
state ActorCollectionNoErrors actors; state ActorCollectionNoErrors actors;
try { try {

View File

@ -56,8 +56,8 @@ ACTOR static Future<Void> _parseLogFileToMutationsOnLoader(NotifiedVersion* pPro
Reference<IBackupContainer> bc, RestoreAsset asset); Reference<IBackupContainer> bc, RestoreAsset asset);
ACTOR static Future<Void> _parseRangeFileToMutationsOnLoader( ACTOR static Future<Void> _parseRangeFileToMutationsOnLoader(
std::map<LoadingParam, VersionedMutationsMap>::iterator kvOpsIter, std::map<LoadingParam, VersionedMutationsMap>::iterator kvOpsIter,
std::map<LoadingParam, MutationsVec>::iterator samplesIter, LoaderCounters* cc, Reference<IBackupContainer> bc, std::map<LoadingParam, SampledMutationsVec>::iterator samplesIter, LoaderCounters* cc,
Version version, RestoreAsset asset); Reference<IBackupContainer> bc, Version version, RestoreAsset asset);
ACTOR Future<Void> handleFinishVersionBatchRequest(RestoreVersionBatchRequest req, Reference<RestoreLoaderData> self); ACTOR Future<Void> handleFinishVersionBatchRequest(RestoreVersionBatchRequest req, Reference<RestoreLoaderData> self);
ACTOR Future<Void> restoreLoaderCore(RestoreLoaderInterface loaderInterf, int nodeIndex, Database cx, ACTOR Future<Void> restoreLoaderCore(RestoreLoaderInterface loaderInterf, int nodeIndex, Database cx,
@ -385,14 +385,14 @@ ACTOR Future<Void> handleLoadFileRequest(RestoreLoadFileRequest req, Reference<R
wait(it->second); // wait on the processing of the req.param. wait(it->second); // wait on the processing of the req.param.
// Send sampled mutations back to controller: batchData->sampleMutations[req.param] // Send sampled mutations back to controller: batchData->sampleMutations[req.param]
std::vector<Future<Void>> fSendSamples; std::vector<Future<RestoreCommonReply>> fSendSamples;
SampledMutationsVec& samples = batchData->sampleMutations[req.param]; SampledMutationsVec& samples = batchData->sampleMutations[req.param];
SampledMutationsVec sampleBatch = SampledMutationsVec sampleBatch =
SampledMutationsVec(); // sampleBatch is a Standalone pointer to the created object SampledMutationsVec(); // sampleBatch is a Standalone pointer to the created object
double sampleBatchSize = 0; double sampleBatchSize = 0;
for (int i = 0; i < samples.size(); ++i) { for (int i = 0; i < samples.size(); ++i) {
sampleBatchSize += samples[i].totalSize(); sampleBatchSize += samples[i].totalSize();
sampleBatch.push_back_deep(samples[i]); // TODO: may not need deep copy sampleBatch.push_back_deep(sampleBatch.arena(), samples[i]); // TODO: may not need deep copy
if (sampleBatchSize >= SERVER_KNOBS->FASTRESTORE_SAMPLE_MSG_BYTES) { if (sampleBatchSize >= SERVER_KNOBS->FASTRESTORE_SAMPLE_MSG_BYTES) {
fSendSamples.push_back(self->ci.samples.getReply( fSendSamples.push_back(self->ci.samples.getReply(
RestoreSamplesRequest(deterministicRandom()->randomUniqueID(), req.batchIndex, sampleBatch))); RestoreSamplesRequest(deterministicRandom()->randomUniqueID(), req.batchIndex, sampleBatch)));

View File

@ -63,9 +63,15 @@ struct SampledMutation {
long size; long size;
explicit SampledMutation(KeyRef key, long size) : key(key), size(size) {} explicit SampledMutation(KeyRef key, long size) : key(key), size(size) {}
explicit SampledMutation(Arena& arena, const SampledMutation& sm) : key(arena, sm.key), size(sm.size) {}
SampledMutation() = default; SampledMutation() = default;
int totalSize() { return key.size() + sizeof(size); } int totalSize() { return key.size() + sizeof(size); }
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, key, size);
}
}; };
using MutationsVec = Standalone<VectorRef<MutationRef>>; using MutationsVec = Standalone<VectorRef<MutationRef>>;

View File

@ -49,7 +49,7 @@ struct RestoreWorkerData : NonCopyable, public ReferenceCounted<RestoreWorkerDa
std::map<UID, RestoreWorkerInterface> workerInterfaces; // UID is worker's node id, RestoreWorkerInterface is worker's communication workerInterface std::map<UID, RestoreWorkerInterface> workerInterfaces; // UID is worker's node id, RestoreWorkerInterface is worker's communication workerInterface
// Restore Roles // Restore Roles
Optional<RestoreLoaderInterface> controllerInterf; Optional<RestoreControllerInterface> controllerInterf;
Optional<RestoreLoaderInterface> loaderInterf; Optional<RestoreLoaderInterface> loaderInterf;
Optional<RestoreApplierInterface> applierInterf; Optional<RestoreApplierInterface> applierInterf;