Remove broadcastConfigDatabase actor

This commit is contained in:
sfc-gh-tclinkenbeard 2021-04-26 15:54:08 -07:00
parent 69a7bf4e3e
commit 7211d838cf
7 changed files with 19 additions and 36 deletions

View File

@ -42,7 +42,7 @@ struct ClusterInterface {
UID id() const { return openDatabase.getEndpoint().token; } UID id() const { return openDatabase.getEndpoint().token; }
NetworkAddress address() const { return openDatabase.getEndpoint().getPrimaryAddress(); } NetworkAddress address() const { return openDatabase.getEndpoint().getPrimaryAddress(); }
bool hasMessage() { bool hasMessage() const {
return openDatabase.getFuture().isReady() || failureMonitoring.getFuture().isReady() || return openDatabase.getFuture().isReady() || failureMonitoring.getFuture().isReady() ||
databaseStatus.getFuture().isReady() || ping.getFuture().isReady() || databaseStatus.getFuture().isReady() || ping.getFuture().isReady() ||
getClientWorkers.getFuture().isReady() || forceRecovery.getFuture().isReady(); getClientWorkers.getFuture().isReady() || forceRecovery.getFuture().isReady();

View File

@ -153,14 +153,6 @@ public:
serverInfo->set(newInfo); 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) { void clearInterf(ProcessClass::ClassType t) {
auto newInfo = serverInfo->get(); auto newInfo = serverInfo->get();
newInfo.id = deterministicRandom()->randomUniqueID(); newInfo.id = deterministicRandom()->randomUniqueID();
@ -1825,7 +1817,9 @@ public:
Counter registerMasterRequests; Counter registerMasterRequests;
Counter statusRequests; 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()), : clusterControllerProcessId(locality.processId()), clusterControllerDcId(locality.dcId()), id(ccInterface.id()),
ac(false), outstandingRequestChecker(Void()), outstandingRemoteRequestChecker(Void()), gotProcessClasses(false), ac(false), outstandingRequestChecker(Void()), outstandingRemoteRequestChecker(Void()), gotProcessClasses(false),
gotFullyRecoveredConfig(false), startTime(now()), goodRecruitmentTime(Never()), 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, ACTOR Future<Void> clusterControllerCore(ClusterControllerFullInterface interf,
Future<Void> leaderFail, Future<Void> leaderFail,
ServerCoordinators coordinators, ServerCoordinators coordinators,
LocalityData locality) { 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 Future<Void> coordinationPingDelay = delay(SERVER_KNOBS->WORKER_COORDINATION_PING_DELAY);
state uint64_t step = 0; state uint64_t step = 0;
state Future<ErrorOr<Void>> error = errorOr(actorCollection(self.addActor.getFuture())); 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(clusterWatchDatabase(&self, &self.db)); // Start the master database
self.addActor.send(self.updateWorkerList.init(self.db.db)); self.addActor.send(self.updateWorkerList.init(self.db.db));
self.addActor.send(statusServer(interf.clientInterface.databaseStatus.getFuture(), &self, coordinators)); self.addActor.send(statusServer(interf.clientInterface.databaseStatus.getFuture(), &self, coordinators));

View File

@ -28,7 +28,7 @@
class IConfigBroadcaster { class IConfigBroadcaster {
public: public:
virtual Future<Void> serve(ConfigFollowerInterface&) = 0; virtual Future<Void> serve(ConfigFollowerInterface const&) = 0;
}; };
class SimpleConfigBroadcaster : public IConfigBroadcaster { class SimpleConfigBroadcaster : public IConfigBroadcaster {
@ -39,5 +39,5 @@ public:
SimpleConfigBroadcaster(ClusterConnectionString const&); SimpleConfigBroadcaster(ClusterConnectionString const&);
SimpleConfigBroadcaster(ServerCoordinators const&); SimpleConfigBroadcaster(ServerCoordinators const&);
~SimpleConfigBroadcaster(); ~SimpleConfigBroadcaster();
Future<Void> serve(ConfigFollowerInterface&) override; Future<Void> serve(ConfigFollowerInterface const&) override;
}; };

View File

@ -163,16 +163,12 @@ class LocalConfigurationImpl {
wait(self->initFuture); wait(self->initFuture);
state Future<ConfigFollowerGetChangesReply> getChangesReply = Never(); state Future<ConfigFollowerGetChangesReply> getChangesReply = Never();
loop { loop {
auto broadcaster = serverDBInfo->get().configFollowerInterface; auto broadcaster = serverDBInfo->get().configBroadcaster;
if (broadcaster.present()) { choose {
choose { when(wait(serverDBInfo->onChange())) {}
when(wait(serverDBInfo->onChange())) {} when(wait(fetchChanges(self, serverDBInfo->get().configBroadcaster))) {
when(wait(fetchChanges(self, broadcaster.get()))) { wait(delay(0.5)); // TODO: Make knob?
wait(delay(0.5)); // TODO: Make knob?
}
} }
} else {
wait(serverDBInfo->onChange());
} }
} }
} }

View File

@ -62,7 +62,7 @@ struct ServerDBInfo {
// which need to stay alive in case this recovery fails // which need to stay alive in case this recovery fails
Optional<LatencyBandConfig> latencyBandConfig; Optional<LatencyBandConfig> latencyBandConfig;
int64_t infoGeneration; int64_t infoGeneration;
Optional<ConfigFollowerInterface> configFollowerInterface; ConfigFollowerInterface configBroadcaster;
ServerDBInfo() ServerDBInfo()
: recoveryCount(0), recoveryState(RecoveryState::UNINITIALIZED), logSystemConfig(0), infoGeneration(0) {} : recoveryCount(0), recoveryState(RecoveryState::UNINITIALIZED), logSystemConfig(0), infoGeneration(0) {}
@ -87,7 +87,7 @@ struct ServerDBInfo {
priorCommittedLogServers, priorCommittedLogServers,
latencyBandConfig, latencyBandConfig,
infoGeneration, infoGeneration,
configFollowerInterface); configBroadcaster);
} }
}; };

View File

@ -226,7 +226,7 @@ public:
subscriber = ConfigFollowerInterface(coordinators.configServers[0]); 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; const double SimpleConfigBroadcasterImpl::POLLING_INTERVAL = 0.5;
@ -240,6 +240,6 @@ SimpleConfigBroadcaster::SimpleConfigBroadcaster(ServerCoordinators const& coord
SimpleConfigBroadcaster::~SimpleConfigBroadcaster() = default; SimpleConfigBroadcaster::~SimpleConfigBroadcaster() = default;
Future<Void> SimpleConfigBroadcaster::serve(ConfigFollowerInterface& publisher) { Future<Void> SimpleConfigBroadcaster::serve(ConfigFollowerInterface const& publisher) {
return impl->serve(publisher); return impl->serve(publisher);
} }

View File

@ -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 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() || return clientInterface.hasMessage() || recruitFromConfiguration.getFuture().isReady() ||
recruitRemoteFromConfiguration.getFuture().isReady() || recruitStorage.getFuture().isReady() || recruitRemoteFromConfiguration.getFuture().isReady() || recruitStorage.getFuture().isReady() ||
registerWorker.getFuture().isReady() || getWorkers.getFuture().isReady() || registerWorker.getFuture().isReady() || getWorkers.getFuture().isReady() ||