Skip to content

Commit

Permalink
c/config_manager: populate configuration status on members notification
Browse files Browse the repository at this point in the history
When member is added to the cluster `cluster::configuration_manager`
should be immediately aware of it instead of waiting for the first
status update.

Wired up cluster member added notification to update cluster
configuration reconciliation status with initial state for joining
member.

Fixes: redpanda-data#13497
Fixes: redpanda-data#13503

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Oct 6, 2023
1 parent 0459a51 commit 57c8d7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions src/v/cluster/config_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
#include "cluster/logger.h"
#include "cluster/members_table.h"
#include "cluster/partition_leaders_table.h"
#include "cluster/types.h"
#include "config/configuration.h"
#include "config/node_config.h"
#include "features/feature_table.h"
#include "model/metadata.h"
#include "resource_mgmt/io_priority.h"
#include "rpc/connection_cache.h"
#include "utils/file_io.h"
Expand Down Expand Up @@ -81,7 +83,7 @@ config_manager::config_manager(
/**
* Register notification immediately not to lose status updates.
*/
_member_removed_notification
_member_update_notification
= _members.local().register_members_updated_notification(
[this](model::node_id id, model::membership_state new_state) {
handle_cluster_members_update(id, new_state);
Expand Down Expand Up @@ -229,17 +231,24 @@ ss::future<> config_manager::start() {
}
void config_manager::handle_cluster_members_update(
model::node_id id, model::membership_state new_state) {
if (new_state != model::membership_state::removed) {
return;
vlog(
clusterlog.debug,
"Processing membership notification: {{id: {} state: {}}}",
id,
new_state);
if (new_state == model::membership_state::active) {
// add an empty status placeholder if node is not yet known
status.try_emplace(id, config_status{.node = id});
} else if (new_state == model::membership_state::removed) {
status.erase(id);
}
status.erase(id);
}

ss::future<> config_manager::stop() {
vlog(clusterlog.info, "Stopping Config Manager...");
_reconcile_wait.broken();
_members.local().unregister_members_updated_notification(
_member_removed_notification);
_member_update_notification);
_leaders.local().unregister_leadership_change_notification(
_raft0_leader_changed_notification);
co_await _gate.close();
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/config_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class config_manager final {
ss::sharded<partition_leaders_table>& _leaders;
ss::sharded<features::feature_table>& _feature_table;
ss::sharded<cluster::members_table>& _members;
notification_id_type _member_removed_notification;
notification_id_type _member_update_notification;
notification_id_type _raft0_leader_changed_notification;

ss::condition_variable _reconcile_wait;
Expand Down

0 comments on commit 57c8d7a

Please sign in to comment.