forward back new coordinator

This commit is contained in:
Dan Lambright 2021-04-28 08:48:15 -04:00
parent fcfb78162c
commit fc65154b5d
2 changed files with 17 additions and 12 deletions

View File

@ -252,16 +252,16 @@ struct CheckDescriptorMutableReply {
// Allows client to check if allowed to change the cluster descriptor.
struct CheckDescriptorMutable {
constexpr static FileIdentifier file_identifier = 214729;
Key key;
ReplyPromise<CheckDescriptorMutableReply> reply;
explicit CheckDescriptorMutable(Key key) : key(key) {}
CheckDescriptorMutable(){}
constexpr static FileIdentifier file_identifier = 214729;
Key key;
ReplyPromise<CheckDescriptorMutableReply> reply;
explicit CheckDescriptorMutable(Key key) : key(key) {}
CheckDescriptorMutable(){}
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, key, reply);
}
template <class Ar>
void serialize(Ar& ar) {
serializer(ar, key, reply);
}
};
#endif

View File

@ -559,11 +559,16 @@ ACTOR Future<Void> leaderServer(LeaderElectionRegInterface interf, OnDemandStore
state ActorCollection forwarders(false);
wait(LeaderRegisterCollection::init(&regs));
loop choose {
when(CheckDescriptorMutable req = waitNext(interf.checkDescriptorMutable.getFuture())) {
CheckDescriptorMutableReply rep(SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT ? true : false);
req.reply.send(rep);
Optional<LeaderInfo> forward = regs.getForward(req.key);
if (forward.present()) {
req.reply.send(CheckDescriptorMutableReply{false});
} else {
CheckDescriptorMutableReply rep(SERVER_KNOBS->ENABLE_CROSS_CLUSTER_SUPPORT ? true : false);
req.reply.send(rep);
}
}
when(OpenDatabaseCoordRequest req = waitNext(interf.openDatabase.getFuture())) {
Optional<LeaderInfo> forward = regs.getForward(req.clusterKey);