FastRestore:Fix segmentation fault

This commit is contained in:
Meng Xu 2020-09-29 16:10:40 -07:00
parent c613fc6dee
commit 3aa92286aa
2 changed files with 8 additions and 4 deletions

View File

@ -658,7 +658,7 @@ void handleUpdateRateRequest(RestoreUpdateRateRequest req, Reference<RestoreAppl
}
ACTOR static Future<Void> traceRate(const char* context, Reference<ApplierBatchData> batchData, int batchIndex,
UID nodeID, NotifiedVersion* finishedVB) {
UID nodeID, NotifiedVersion* finishedVB, bool once = false) {
loop {
if ((finishedVB->get() != batchIndex - 1) || !batchData.isValid()) {
break;
@ -672,6 +672,9 @@ ACTOR static Future<Void> traceRate(const char* context, Reference<ApplierBatchD
.detail("TargetBytesMB", batchData->targetWriteRateMB)
.detail("InflightBytesMB", batchData->applyingDataBytes)
.detail("ReceivedBytes", batchData->receivedBytes);
if (once) {
break;
}
wait(delay(5.0));
}
@ -719,8 +722,9 @@ ACTOR static Future<Void> handleApplyToDBRequest(RestoreVersionBatchRequest req,
// Multiple actors can wait on req.batchIndex-1;
// Avoid setting finishedBatch when finishedBatch > req.batchIndex
if (self->finishedBatch.get() == req.batchIndex - 1) {
batchData->rateTracer = traceRate("FastRestoreApplierTransactionRateControlDone", batchData, req.batchIndex,
self->id(), &self->finishedBatch); // Track the last rate info
batchData->rateTracer =
traceRate("FastRestoreApplierTransactionRateControlDone", batchData, req.batchIndex, self->id(),
&self->finishedBatch, true /*print once*/); // Track the last rate info
self->finishedBatch.set(req.batchIndex);
// self->batch[req.batchIndex]->vbState = ApplierVersionBatchState::DONE;
// Free memory for the version batch

View File

@ -115,7 +115,7 @@ ACTOR Future<Void> startRestoreController(Reference<RestoreWorkerData> controlle
// recruitRestoreRoles must come after controllerWorker has finished collectWorkerInterface
wait(recruitRestoreRoles(controllerWorker, self));
self->addActor.send(updateHeartbeatTime(self));
// self->addActor.send(updateHeartbeatTime(self));
self->addActor.send(checkRolesLiveness(self));
self->addActor.send(updateProcessMetrics(self));
self->addActor.send(traceProcessMetrics(self, "RestoreController"));