Skip to content

Commit

Permalink
rbac_migrator: suppress error on role_exists
Browse files Browse the repository at this point in the history
See the comment in the code change for why this is safe.
  • Loading branch information
pgellert committed Apr 11, 2024
1 parent 02fe624 commit 7da848e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/v/migrations/rbac_migrator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ ss::future<> rbac_migrator::do_mutate() {
auto err = co_await _controller.get_security_frontend().local().create_role(
role_name, std::move(role), model::timeout_clock::now() + 5s);

if (err) {
if (err == cluster::errc::role_exists) {
// If the leader running the feature migration loses leadership after
// the role is created but before the feature migration is successfully
// completed, the next leader will redo the feature migration. In that
// case, we will get the role_exists error here, which we can safely
// ignore.
vlog(
featureslog.info,
"Default role '{}' already exists...",
security::default_role_name);
} else if (err) {
vlog(
featureslog.error,
"Error while creating default role '{}': {}",
Expand Down

0 comments on commit 7da848e

Please sign in to comment.