Skip to content

Commit

Permalink
admin: reject maintenance mode req on 1 node cluster
Browse files Browse the repository at this point in the history
If a single node cluster puts its only node in maintenance
mode, then there is no node elegible to become controller
leader, and all further progress is stopped.

Fixes redpanda-data#4338
  • Loading branch information
jcsp committed May 25, 2022
1 parent 2949fc3 commit b970b2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/v/redpanda/admin_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,13 @@ void admin_server::register_broker_routes() {
throw ss::httpd::bad_request_exception(
"Maintenance mode feature not active (upgrade in progress?)");
}

if (
_controller->get_members_table().local().all_brokers().size() < 2) {
throw ss::httpd::bad_request_exception(
"Maintenance mode may not be used on a single node cluster");
}

model::node_id id = parse_broker_id(*req);
auto ec = co_await _controller->get_members_frontend()
.local()
Expand Down

0 comments on commit b970b2d

Please sign in to comment.