Skip to content

Commit

Permalink
c/bootstrap: stricter postcond for founding_brokers()
Browse files Browse the repository at this point in the history
so that it's empty if and only if we are not a cluster founder
  • Loading branch information
dlex committed Nov 8, 2022
1 parent 546e29b commit 903ad6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions src/v/cluster/cluster_discovery.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ ss::future<node_id> cluster_discovery::determine_node_id() {
cluster_discovery::brokers cluster_discovery::founding_brokers() const {
vassert(
_is_cluster_founder.has_value(), "must call discover_founding_brokers()");
if (!*_is_cluster_founder) {
vassert(
_founding_brokers.empty(),
"Should return empty if this node is not founding a new cluster");
}
vassert(
_founding_brokers.empty() == !*_is_cluster_founder,
"Should return broker(s) if and only if this node is founding a new "
"cluster");
return _founding_brokers;
}

Expand Down
6 changes: 2 additions & 4 deletions src/v/cluster/cluster_discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ class cluster_discovery {
//
// If this node is a cluster founder, returns all seed servers, after
// making sure that all founders are configured with identical seed servers
// list.
// list. In case of root-driven bootstrap, that reflects to a list of just
// the root broker.
//
// If this node is not a cluster founder, returns an empty list.
//
// In case of root-driven bootstrap, that reflects to a list of just the
// root broker.
brokers founding_brokers() const;

// A cluster founder is a node that is configured as a seed server, and
Expand Down

0 comments on commit 903ad6f

Please sign in to comment.