Skip to content

Commit

Permalink
c/controller_backend: store last error in controller backend delta queue
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Apr 25, 2023
1 parent 711949d commit 8f83991
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/v/cluster/controller_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,11 @@ ss::future<> controller_backend::reconcile_ntp(deltas_t& deltas) {
it->delta.previous_replica_set);

it->retries++;
if (ec.category() == error_category()) {
it->last_error = static_cast<errc>(ec.value());
} else {
it->last_error = errc::partition_operation_failed;
}
stop = true;
continue;
}
Expand Down Expand Up @@ -902,6 +907,7 @@ ss::future<> controller_backend::reconcile_ntp(deltas_t& deltas) {
*it,
std::current_exception());
it->retries++;
it->last_error = errc::partition_operation_failed;
stop = true;
continue;
}
Expand Down Expand Up @@ -1992,7 +1998,13 @@ controller_backend::list_ntp_deltas(const model::ntp& ntp) const {

std::ostream&
operator<<(std::ostream& o, const controller_backend::delta_metadata& m) {
fmt::print(o, "{{delta: {}, retries: {}}}", m.delta, m.retries);
fmt::print(
o,
"{{delta: {}, retries: {}, last_error: {}({})}}",
m.delta,
m.retries,
m.last_error,
error_category().message(static_cast<int>(m.last_error)));
return o;
}

Expand Down
2 changes: 2 additions & 0 deletions src/v/cluster/controller_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#pragma once

#include "cluster/errc.h"
#include "cluster/fwd.h"
#include "cluster/topic_table.h"
#include "cluster/types.h"
Expand Down Expand Up @@ -226,6 +227,7 @@ class controller_backend

topic_table::delta delta;
uint64_t retries = 0;
cluster::errc last_error = errc::waiting_for_recovery;
friend std::ostream& operator<<(std::ostream&, const delta_metadata&);
};

Expand Down

0 comments on commit 8f83991

Please sign in to comment.