FastRestore:Apply clang-format

This commit is contained in:
Meng Xu 2020-02-27 20:59:56 -08:00
parent a6e66da29f
commit f4cd0ef74f
4 changed files with 29 additions and 7 deletions

View File

@ -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<ApplierBatchData> {

View File

@ -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";

View File

@ -57,11 +57,11 @@ ACTOR Future<Void> 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<Void> traceRoleVersionBatchProgress(Reference<RestoreRoleData> 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++;
}

View File

@ -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; }