From f4cd0ef74f6d383a05175dfaa1092a8e59deb7c3 Mon Sep 17 00:00:00 2001 From: Meng Xu Date: Thu, 27 Feb 2020 20:59:56 -0800 Subject: [PATCH] FastRestore:Apply clang-format --- fdbserver/RestoreApplier.actor.h | 10 ++++++++++ fdbserver/RestoreLoader.actor.h | 10 ++++++++++ fdbserver/RestoreRoleCommon.actor.cpp | 8 ++++---- fdbserver/RestoreRoleCommon.actor.h | 8 +++++--- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/fdbserver/RestoreApplier.actor.h b/fdbserver/RestoreApplier.actor.h index 3b6585d1e0..07fb7a46f2 100644 --- a/fdbserver/RestoreApplier.actor.h +++ b/fdbserver/RestoreApplier.actor.h @@ -213,6 +213,16 @@ public: explicit ApplierVersionBatchState(int newState) { vbState = newState; } + + ~ApplierVersionBatchState() = default; + + void operator = (int newState) { + vbState = newState; + } + + int get() { + return RoleVersionBatchState::get(); + } }; struct ApplierBatchData : public ReferenceCounted { diff --git a/fdbserver/RestoreLoader.actor.h b/fdbserver/RestoreLoader.actor.h index a1337299d6..506d3174c5 100644 --- a/fdbserver/RestoreLoader.actor.h +++ b/fdbserver/RestoreLoader.actor.h @@ -54,6 +54,16 @@ public: vbState = newState; } + ~LoaderVersionBatchState() = default; + + void operator = (int newState) { + vbState = newState; + } + + int get() { + return RoleVersionBatchState::get(); + } + // static std::string getVersionBatchState(int vbState) { // switch(vbSTate) { // case NOT_INIT: return "NOT_INIT"; diff --git a/fdbserver/RestoreRoleCommon.actor.cpp b/fdbserver/RestoreRoleCommon.actor.cpp index 0e75ba6c31..a1506b7ff0 100644 --- a/fdbserver/RestoreRoleCommon.actor.cpp +++ b/fdbserver/RestoreRoleCommon.actor.cpp @@ -57,11 +57,11 @@ ACTOR Future handleInitVersionBatchRequest(RestoreVersionBatchRequest req, .detail("BatchIndex", req.batchIndex) .detail("Role", getRoleStr(self->role)) .detail("VersionBatchNotifiedVersion", self->versionBatchId.get()) - .detail("PreviousVersionBatchState", batchData->vbState); + .detail("PreviousVersionBatchState", self->getVersionBatchState(req.batchIndex)); // batchId is continuous. (req.batchIndex-1) is the id of the just finished batch. wait(self->versionBatchId.whenAtLeast(req.batchIndex - 1)); - batchData->vbState = ApplierVersionBatchState::INIT; + self->setVersionBatchState(req.batchIndex, ApplierVersionBatchState::INIT); if (self->versionBatchId.get() == req.batchIndex - 1) { self->initVersionBatch(req.batchIndex); TraceEvent("FastRestoreInitVersionBatch") @@ -146,11 +146,11 @@ ACTOR Future traceRoleVersionBatchProgress(Reference self int maxBatchIndex = self->versionBatchId.get(); TraceEvent ev("FastRestoreVersionBatchProgress", self->nodeID); - ev.detail("Role", role) + ev.detail("Role", role); ev.detail("Node", self->nodeID); while (batchIndex <= maxBatchIndex) { ev.detail("BatchIndex", batchIndex); - ev.detail("VersionBatchState", self->batch[batchIndex]->vbState); + ev.detail("VersionBatchState", self->getVersionBatchState(batchIndex)); batchIndex++; } diff --git a/fdbserver/RestoreRoleCommon.actor.h b/fdbserver/RestoreRoleCommon.actor.h index 405ea7a596..9efb308fd2 100644 --- a/fdbserver/RestoreRoleCommon.actor.h +++ b/fdbserver/RestoreRoleCommon.actor.h @@ -109,17 +109,19 @@ class RoleVersionBatchState { public: static const int INVALID = -1; - int get() { + virtual int get() { return vbState; } - void operator = (int newState) { + virtual void operator = (int newState) { vbState = newState; } explicit RoleVersionBatchState() : vbState(INVALID) {} explicit RoleVersionBatchState(int newState) : vbState(newState) {} + virtual ~RoleVersionBatchState() = default; + int vbState; }; @@ -146,7 +148,7 @@ public: RestoreRoleData() : role(RestoreRole::Invalid), cpuUsage(0.0), memory(0.0), residentMemory(0.0), delayedActors(0){}; - virtual ~RestoreRoleData() {} + virtual ~RestoreRoleData() = default; UID id() const { return nodeID; }