FastRestore: Use RestoreSetRoleRequest
This commit is contained in:
parent
c0ae406300
commit
c74bef7601
|
@ -1645,17 +1645,17 @@ ACTOR Future<Void> configureRoles(Reference<RestoreData> rd, Database cx) { //,
|
|||
loop {
|
||||
try {
|
||||
wait(delay(1.0));
|
||||
std::vector<Future<RestoreCommandReply>> cmdReplies;
|
||||
std::vector<Future<RestoreCommonReply>> cmdReplies;
|
||||
for(auto& cmdInterf : agents) {
|
||||
role = rd->globalNodeStatus[index].role;
|
||||
nodeID = rd->globalNodeStatus[index].nodeID;
|
||||
rd->cmdID.nextCmd();
|
||||
printf("[CMD:%s] Node:%s Set role (%s) to node (index=%d uid=%s)\n", rd->cmdID.toString().c_str(), rd->describeNode().c_str(),
|
||||
getRoleStr(role).c_str(), index, nodeID.toString().c_str());
|
||||
cmdReplies.push_back( cmdInterf.cmd.getReply(RestoreCommand(RestoreCommandEnum::Set_Role, rd->cmdID, nodeID, role, index, rd->masterApplier)));
|
||||
cmdReplies.push_back( cmdInterf.setRole.getReply(RestoreSetRoleRequest(rd->cmdID, role)) );
|
||||
index++;
|
||||
}
|
||||
std::vector<RestoreCommandReply> reps = wait( timeoutError(getAll(cmdReplies), FastRestore_Failure_Timeout) );
|
||||
std::vector<RestoreCommonReply> reps = wait( timeoutError(getAll(cmdReplies), FastRestore_Failure_Timeout) );
|
||||
for (int i = 0; i < reps.size(); ++i) {
|
||||
printf("[INFO] Node:%s, CMDReply for CMD:%s, node:%s\n", rd->describeNode().c_str(), reps[i].cmdID.toString().c_str(),
|
||||
reps[i].id.toString().c_str());
|
||||
|
|
|
@ -40,6 +40,7 @@ BINARY_SERIALIZABLE( RestoreRole );
|
|||
// Timeout threshold in seconds for restore commands
|
||||
extern int FastRestore_Failure_Timeout;
|
||||
|
||||
struct RestoreSetRoleRequest;
|
||||
|
||||
// RestoreCommandEnum is also used as the phase ID for CMDUID
|
||||
enum class RestoreCommandEnum {Init = 0,
|
||||
|
@ -101,6 +102,7 @@ template <class Ar> void save( Ar& ar, CMDUID const& uid ) { const_cast<CMDUID&>
|
|||
|
||||
// NOTE: is cmd's Endpoint token the same with the request's token for the same node?
|
||||
struct RestoreInterface {
|
||||
RequestStream<RestoreSetRoleRequest> setRole;
|
||||
RequestStream< struct RestoreCommand > cmd; // Restore commands from master to loader and applier
|
||||
// RequestStream< struct RestoreRequest > request; // Restore requests used by loader and applier
|
||||
|
||||
|
|
Loading…
Reference in New Issue