Skip to content

Commit

Permalink
c/topic_table: additional logging in topics_table
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Oct 30, 2023
1 parent 3f3f79c commit 78fc753
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/v/cluster/topic_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ topic_table::apply(create_partition_cmd cmd, model::offset offset) {

ss::future<std::error_code>
topic_table::apply(move_partition_replicas_cmd cmd, model::offset o) {
vlog(
clusterlog.trace,
"applying move partition replicas command: key: {}, value: {}, "
"with revision: {}",
cmd.key,
cmd.value,
o);

_last_applied_revision_id = model::revision_id(o);
auto tp = _topics.find(model::topic_namespace_view(cmd.key));
if (tp == _topics.end()) {
Expand Down Expand Up @@ -291,6 +299,14 @@ static replicas_revision_map update_replicas_revisions(

ss::future<std::error_code>
topic_table::apply(finish_moving_partition_replicas_cmd cmd, model::offset o) {
vlog(
clusterlog.trace,
"applying finish moving partition replicas command: key: {}, value: {}, "
"with revision: {}",
cmd.key,
cmd.value,
o);

_last_applied_revision_id = model::revision_id(o);
auto tp = _topics.find(model::topic_namespace_view(cmd.key));
if (tp == _topics.end()) {
Expand Down Expand Up @@ -330,6 +346,12 @@ topic_table::apply(finish_moving_partition_replicas_cmd cmd, model::offset o) {
it->second.get_update_revision());
}
p_meta_it->second.last_update_finished_revision = model::revision_id{o};
vlog(
clusterlog.trace,
"finishing {} in progress update: {} with revision: {}",
cmd.key,
it->second,
o);

_updates_in_progress.erase(it);

Expand Down Expand Up @@ -1563,4 +1585,18 @@ size_t topic_table::get_node_partition_count(model::node_id id) const {
return cnt;
}

std::ostream&
operator<<(std::ostream& o, const topic_table::in_progress_update& u) {
fmt::print(
o,
"{{previous_replica_set: {}, target_replica_set: {}, state: {}, "
"update_revision: {}, last_command_revision: {}}}",
u._previous_replicas,
u._target_replicas,
u._state,
u._update_revision,
u._last_cmd_revision);
return o;
}

} // namespace cluster
3 changes: 3 additions & 0 deletions src/v/cluster/topic_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <absl/container/flat_hash_map.h>
#include <absl/container/node_hash_map.h>

#include <ostream>
#include <span>
#include <type_traits>

Expand Down Expand Up @@ -175,6 +176,8 @@ class topic_table {
}

private:
friend std::ostream&
operator<<(std::ostream&, const in_progress_update&);
std::vector<model::broker_shard> _previous_replicas;
std::vector<model::broker_shard> _target_replicas;
reconfiguration_state _state;
Expand Down

0 comments on commit 78fc753

Please sign in to comment.