Skip to content

Commit

Permalink
c/topic_table: fix metrics calculation when applying controller snapshot
Browse files Browse the repository at this point in the history
Previously, the in_progress_update object was constructed with with the
reconfiguration state taken from the snapshot. The problem with this is
that we miss the metrics update associated with the in_progress ->
cancelled transition. Fix this by only allowing constructing in_progress_update
with the the initial in_progress state.
  • Loading branch information
ztlpn committed Apr 24, 2023
1 parent fe1a1ab commit e37c308
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/v/cluster/topic_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ class topic_table::snapshot_applier {
in_progress_update inp_update{
partition.replicas,
update.target_assignment,
update.state,
update.revision,
_probe,
};
Expand Down Expand Up @@ -1538,11 +1537,7 @@ void topic_table::change_partition_replicas(
_updates_in_progress.emplace(
ntp,
in_progress_update(
current_assignment.replicas,
new_assignment,
reconfiguration_state::in_progress,
update_revision,
_probe));
current_assignment.replicas, new_assignment, update_revision, _probe));
auto previous_assignment = current_assignment.replicas;
// replace partition replica set
current_assignment.replicas = new_assignment;
Expand All @@ -1557,7 +1552,6 @@ void topic_table::change_partition_replicas(
in_progress_update(
current_assignment.replicas,
new_assignment,
reconfiguration_state::in_progress,
update_revision,
_probe));
vassert(
Expand Down
3 changes: 1 addition & 2 deletions src/v/cluster/topic_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@ class topic_table {
explicit in_progress_update(
std::vector<model::broker_shard> previous_replicas,
std::vector<model::broker_shard> target_replicas,
reconfiguration_state state,
model::revision_id update_revision,
topic_table_probe& probe)
: _previous_replicas(std::move(previous_replicas))
, _target_replicas(std::move(target_replicas))
, _state(state)
, _state(reconfiguration_state::in_progress)
, _update_revision(update_revision)
, _last_cmd_revision(update_revision)
, _probe(probe) {
Expand Down

0 comments on commit e37c308

Please sign in to comment.