mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Remove broadcastConfigDatabase actor
This commit is contained in:
parent
69a7bf4e3e
commit
7211d838cf
@ -42,7 +42,7 @@ struct ClusterInterface {
|
||||
UID id() const { return openDatabase.getEndpoint().token; }
|
||||
NetworkAddress address() const { return openDatabase.getEndpoint().getPrimaryAddress(); }
|
||||
|
||||
bool hasMessage() {
|
||||
bool hasMessage() const {
|
||||
return openDatabase.getFuture().isReady() || failureMonitoring.getFuture().isReady() ||
|
||||
databaseStatus.getFuture().isReady() || ping.getFuture().isReady() ||
|
||||
getClientWorkers.getFuture().isReady() || forceRecovery.getFuture().isReady();
|
||||
|
@ -153,14 +153,6 @@ public:
|
||||
serverInfo->set(newInfo);
|
||||
}
|
||||
|
||||
void setConfigFollowerInterface(const ConfigFollowerInterface& interf) {
|
||||
auto newInfo = serverInfo->get();
|
||||
newInfo.id = deterministicRandom()->randomUniqueID();
|
||||
newInfo.infoGeneration = ++dbInfoCount;
|
||||
newInfo.configFollowerInterface = interf;
|
||||
serverInfo->set(newInfo);
|
||||
}
|
||||
|
||||
void clearInterf(ProcessClass::ClassType t) {
|
||||
auto newInfo = serverInfo->get();
|
||||
newInfo.id = deterministicRandom()->randomUniqueID();
|
||||
@ -1825,7 +1817,9 @@ public:
|
||||
Counter registerMasterRequests;
|
||||
Counter statusRequests;
|
||||
|
||||
ClusterControllerData(ClusterControllerFullInterface const& ccInterface, LocalityData const& locality)
|
||||
ClusterControllerData(ClusterControllerFullInterface const& ccInterface,
|
||||
LocalityData const& locality,
|
||||
ServerCoordinators const& coordinators)
|
||||
: clusterControllerProcessId(locality.processId()), clusterControllerDcId(locality.dcId()), id(ccInterface.id()),
|
||||
ac(false), outstandingRequestChecker(Void()), outstandingRemoteRequestChecker(Void()), gotProcessClasses(false),
|
||||
gotFullyRecoveredConfig(false), startTime(now()), goodRecruitmentTime(Never()),
|
||||
@ -3419,24 +3413,17 @@ ACTOR Future<Void> dbInfoUpdater(ClusterControllerData* self) {
|
||||
}
|
||||
}
|
||||
|
||||
ACTOR Future<Void> broadcastConfigDatabase(ClusterControllerData* self, ServerCoordinators coordinators) {
|
||||
state SimpleConfigBroadcaster broadcaster(coordinators);
|
||||
state ConfigFollowerInterface cfi;
|
||||
self->db.setConfigFollowerInterface(cfi);
|
||||
wait(broadcaster.serve(cfi));
|
||||
return Void();
|
||||
}
|
||||
|
||||
ACTOR Future<Void> clusterControllerCore(ClusterControllerFullInterface interf,
|
||||
Future<Void> leaderFail,
|
||||
ServerCoordinators coordinators,
|
||||
LocalityData locality) {
|
||||
state ClusterControllerData self(interf, locality);
|
||||
state ClusterControllerData self(interf, locality, coordinators);
|
||||
state SimpleConfigBroadcaster configBroadcaster(coordinators);
|
||||
state Future<Void> coordinationPingDelay = delay(SERVER_KNOBS->WORKER_COORDINATION_PING_DELAY);
|
||||
state uint64_t step = 0;
|
||||
state Future<ErrorOr<Void>> error = errorOr(actorCollection(self.addActor.getFuture()));
|
||||
|
||||
self.addActor.send(broadcastConfigDatabase(&self, coordinators));
|
||||
self.addActor.send(configBroadcaster.serve(self.db.serverInfo->get().configBroadcaster));
|
||||
self.addActor.send(clusterWatchDatabase(&self, &self.db)); // Start the master database
|
||||
self.addActor.send(self.updateWorkerList.init(self.db.db));
|
||||
self.addActor.send(statusServer(interf.clientInterface.databaseStatus.getFuture(), &self, coordinators));
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
class IConfigBroadcaster {
|
||||
public:
|
||||
virtual Future<Void> serve(ConfigFollowerInterface&) = 0;
|
||||
virtual Future<Void> serve(ConfigFollowerInterface const&) = 0;
|
||||
};
|
||||
|
||||
class SimpleConfigBroadcaster : public IConfigBroadcaster {
|
||||
@ -39,5 +39,5 @@ public:
|
||||
SimpleConfigBroadcaster(ClusterConnectionString const&);
|
||||
SimpleConfigBroadcaster(ServerCoordinators const&);
|
||||
~SimpleConfigBroadcaster();
|
||||
Future<Void> serve(ConfigFollowerInterface&) override;
|
||||
Future<Void> serve(ConfigFollowerInterface const&) override;
|
||||
};
|
||||
|
@ -163,16 +163,12 @@ class LocalConfigurationImpl {
|
||||
wait(self->initFuture);
|
||||
state Future<ConfigFollowerGetChangesReply> getChangesReply = Never();
|
||||
loop {
|
||||
auto broadcaster = serverDBInfo->get().configFollowerInterface;
|
||||
if (broadcaster.present()) {
|
||||
choose {
|
||||
when(wait(serverDBInfo->onChange())) {}
|
||||
when(wait(fetchChanges(self, broadcaster.get()))) {
|
||||
wait(delay(0.5)); // TODO: Make knob?
|
||||
}
|
||||
auto broadcaster = serverDBInfo->get().configBroadcaster;
|
||||
choose {
|
||||
when(wait(serverDBInfo->onChange())) {}
|
||||
when(wait(fetchChanges(self, serverDBInfo->get().configBroadcaster))) {
|
||||
wait(delay(0.5)); // TODO: Make knob?
|
||||
}
|
||||
} else {
|
||||
wait(serverDBInfo->onChange());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ struct ServerDBInfo {
|
||||
// which need to stay alive in case this recovery fails
|
||||
Optional<LatencyBandConfig> latencyBandConfig;
|
||||
int64_t infoGeneration;
|
||||
Optional<ConfigFollowerInterface> configFollowerInterface;
|
||||
ConfigFollowerInterface configBroadcaster;
|
||||
|
||||
ServerDBInfo()
|
||||
: recoveryCount(0), recoveryState(RecoveryState::UNINITIALIZED), logSystemConfig(0), infoGeneration(0) {}
|
||||
@ -87,7 +87,7 @@ struct ServerDBInfo {
|
||||
priorCommittedLogServers,
|
||||
latencyBandConfig,
|
||||
infoGeneration,
|
||||
configFollowerInterface);
|
||||
configBroadcaster);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
subscriber = ConfigFollowerInterface(coordinators.configServers[0]);
|
||||
}
|
||||
|
||||
Future<Void> serve(ConfigFollowerInterface& publisher) { return serve(this, publisher); }
|
||||
Future<Void> serve(ConfigFollowerInterface const& publisher) { return serve(this, publisher); }
|
||||
};
|
||||
|
||||
const double SimpleConfigBroadcasterImpl::POLLING_INTERVAL = 0.5;
|
||||
@ -240,6 +240,6 @@ SimpleConfigBroadcaster::SimpleConfigBroadcaster(ServerCoordinators const& coord
|
||||
|
||||
SimpleConfigBroadcaster::~SimpleConfigBroadcaster() = default;
|
||||
|
||||
Future<Void> SimpleConfigBroadcaster::serve(ConfigFollowerInterface& publisher) {
|
||||
Future<Void> SimpleConfigBroadcaster::serve(ConfigFollowerInterface const& publisher) {
|
||||
return impl->serve(publisher);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ struct ClusterControllerFullInterface {
|
||||
bool operator==(ClusterControllerFullInterface const& r) const { return id() == r.id(); }
|
||||
bool operator!=(ClusterControllerFullInterface const& r) const { return id() != r.id(); }
|
||||
|
||||
bool hasMessage() {
|
||||
bool hasMessage() const {
|
||||
return clientInterface.hasMessage() || recruitFromConfiguration.getFuture().isReady() ||
|
||||
recruitRemoteFromConfiguration.getFuture().isReady() || recruitStorage.getFuture().isReady() ||
|
||||
registerWorker.getFuture().isReady() || getWorkers.getFuture().isReady() ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user