2019-08-02 08:00:13 +08:00
|
|
|
/*
|
|
|
|
* RestoreWorker.actor.h
|
|
|
|
*
|
|
|
|
* This source file is part of the FoundationDB open source project
|
|
|
|
*
|
|
|
|
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#if defined(NO_INTELLISENSE) && !defined(FDBSERVER_RESTOREWORKER_G_H)
|
|
|
|
#define FDBSERVER_RESTOREWORKER_G_H
|
|
|
|
#include "fdbserver/RestoreWorker.actor.g.h"
|
|
|
|
#elif !defined(FDBSERVER_RESTOREWORKER_H)
|
|
|
|
#define FDBSERVER_RESTOREWORKER_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "fdbclient/Tuple.h"
|
|
|
|
#include "flow/flow.h"
|
|
|
|
#include "flow/Stats.h"
|
|
|
|
#include "fdbrpc/fdbrpc.h"
|
|
|
|
#include "fdbrpc/IAsyncFile.h"
|
|
|
|
#include <cstdint>
|
|
|
|
#include <cstdarg>
|
|
|
|
|
2019-09-26 15:18:37 +08:00
|
|
|
#include "fdbclient/RestoreWorkerInterface.actor.h"
|
2019-08-02 08:00:13 +08:00
|
|
|
#include "fdbserver/RestoreUtil.h"
|
|
|
|
#include "fdbserver/RestoreCommon.actor.h"
|
|
|
|
#include "fdbserver/RestoreRoleCommon.actor.h"
|
|
|
|
#include "fdbserver/RestoreLoader.actor.h"
|
|
|
|
#include "fdbserver/RestoreApplier.actor.h"
|
|
|
|
|
|
|
|
|
|
|
|
// Each restore worker (a process) is assigned for a role.
|
|
|
|
// MAYBE Later: We will support multiple restore roles on a worker
|
|
|
|
struct RestoreWorkerData : NonCopyable, public ReferenceCounted<RestoreWorkerData> {
|
|
|
|
UID workerID;
|
|
|
|
std::map<UID, RestoreWorkerInterface> workerInterfaces; // UID is worker's node id, RestoreWorkerInterface is worker's communication workerInterface
|
|
|
|
|
|
|
|
// Restore Roles
|
|
|
|
Optional<RestoreLoaderInterface> loaderInterf;
|
|
|
|
Optional<RestoreApplierInterface> applierInterf;
|
|
|
|
|
|
|
|
UID id() const { return workerID; };
|
|
|
|
|
|
|
|
RestoreWorkerData() = default;
|
|
|
|
|
|
|
|
~RestoreWorkerData() {
|
2020-04-26 12:32:45 +08:00
|
|
|
TraceEvent("RestoreWorkerDataDeleted").detail("WorkerID", workerID.toString());
|
2019-08-02 08:00:13 +08:00
|
|
|
printf("[Exit] Worker:%s RestoreWorkerData is deleted\n", workerID.toString().c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string describeNode() {
|
|
|
|
std::stringstream ss;
|
|
|
|
ss << "RestoreWorker workerID:" << workerID.toString();
|
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-02 09:20:42 +08:00
|
|
|
#include "flow/unactorcompiler.h"
|
2019-09-26 14:19:42 +08:00
|
|
|
#endif // FDBSERVER_RESTOREWORKER_H
|