Fast-track ConfigNode registration with Simple DB

When using the `ConfigDBType::Simple` configuration database, allow
nodes to immediately register with the broadcaster without having to
wait for a quorum.
This commit is contained in:
Lukas Joswiak 2022-02-09 13:19:44 -08:00
parent 85da80a9ce
commit f300cec6ed
1 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,7 @@ class ConfigBroadcasterImpl {
broadcastInterface(broadcastInterface) {}
};
ConfigDBType configDBType;
std::map<ConfigKey, KnobValue> snapshot;
std::deque<VersionedConfigMutation> mutationHistory;
std::deque<VersionedConfigCommitAnnotation> annotationHistory;
@ -231,6 +232,11 @@ class ConfigBroadcasterImpl {
ACTOR static Future<Void> registerNodeInternal(ConfigBroadcasterImpl* self,
WorkerInterface w,
Version lastSeenVersion) {
if (self->configDBType == ConfigDBType::SIMPLE) {
wait(success(retryBrokenPromise(w.configBroadcastInterface.ready, ConfigBroadcastReadyRequest{})));
return Void();
}
state NetworkAddress address = w.address();
// Ask the registering ConfigNode whether it has registered in the past.
@ -373,12 +379,14 @@ public:
}
ConfigBroadcasterImpl(ConfigFollowerInterface const& cfi) : ConfigBroadcasterImpl() {
configDBType = ConfigDBType::SIMPLE;
coordinators = 1;
consumer = IConfigConsumer::createTestSimple(cfi, 0.5, Optional<double>{});
TraceEvent(SevDebug, "ConfigBroadcasterStartingConsumer", id).detail("Consumer", consumer->getID());
}
ConfigBroadcasterImpl(ServerCoordinators const& coordinators, ConfigDBType configDBType) : ConfigBroadcasterImpl() {
this->configDBType = configDBType;
this->coordinators = coordinators.configServers.size();
if (configDBType != ConfigDBType::DISABLED) {
if (configDBType == ConfigDBType::SIMPLE) {