From d8164e9d844052f3e1ad33ea5dd778eabc2fd3d2 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 14 Mar 2020 22:19:45 +0300 Subject: [PATCH] Print PG states on every change --- osd_peering.cpp | 5 ++++- osd_peering_pg.cpp | 27 ++++++++++++++++++--------- osd_peering_pg.h | 1 + 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/osd_peering.cpp b/osd_peering.cpp index 15976dea..908ac25c 100644 --- a/osd_peering.cpp +++ b/osd_peering.cpp @@ -28,6 +28,7 @@ void osd_t::init_primary() .target_set = { 1, 2, 3 }, .cur_set = { 1, 0, 0 }, }; + pgs[1].print_state(); pg_count = 1; peering_state = OSD_CONNECTING_PEERS; } @@ -346,6 +347,7 @@ void osd_t::handle_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, osd_num_t osd if (!pg.flush_actions.size()) { pg.state = pg.state & ~PG_HAS_UNCLEAN; + pg.print_state(); } for (osd_op_t *op: continue_ops) { @@ -435,6 +437,7 @@ void osd_t::start_pg_peering(pg_num_t pg_num) { auto & pg = pgs[pg_num]; pg.state = PG_PEERING; + pg.print_state(); pg.state_dict.clear(); pg.obj_states.clear(); pg.ver_override.clear(); @@ -453,6 +456,7 @@ void osd_t::start_pg_peering(pg_num_t pg_num) if (pg.pg_cursize < pg.pg_minsize) { pg.state = PG_INCOMPLETE; + pg.print_state(); } if (pg.peering_state) { @@ -517,7 +521,6 @@ void osd_t::start_pg_peering(pg_num_t pg_num) delete pg.peering_state; pg.peering_state = NULL; } - printf("PG %d is incomplete\n", pg.pg_num); return; } if (!pg.peering_state) diff --git a/osd_peering_pg.cpp b/osd_peering_pg.cpp index e39fe8a1..65d9a809 100644 --- a/osd_peering_pg.cpp +++ b/osd_peering_pg.cpp @@ -275,14 +275,23 @@ void pg_t::calc_object_states() { pg.state = pg.state | PG_DEGRADED; } - printf( - "PG %u is active%s%s%s%s%s (%lu objects)\n", pg.pg_num, - (pg.state & PG_DEGRADED) ? " + degraded" : "", - (pg.state & PG_HAS_UNFOUND) ? " + has_unfound" : "", - (pg.state & PG_HAS_DEGRADED) ? " + has_degraded" : "", - (pg.state & PG_HAS_MISPLACED) ? " + has_misplaced" : "", - (pg.state & PG_HAS_UNCLEAN) ? " + has_unclean" : "", - pg.total_count - ); pg.state = pg.state | PG_ACTIVE; + pg.print_state(); +} + +void pg_t::print_state() +{ + printf( + "PG %u is %s%s%s%s%s%s%s%s%s (%lu objects)\n", pg_num, + (state & PG_OFFLINE) ? "offline" : "", + (state & PG_PEERING) ? "peering" : "", + (state & PG_INCOMPLETE) ? "incomplete" : "", + (state & PG_ACTIVE) ? "active" : "", + (state & PG_DEGRADED) ? " + degraded" : "", + (state & PG_HAS_UNFOUND) ? " + has_unfound" : "", + (state & PG_HAS_DEGRADED) ? " + has_degraded" : "", + (state & PG_HAS_MISPLACED) ? " + has_misplaced" : "", + (state & PG_HAS_UNCLEAN) ? " + has_unclean" : "", + total_count + ); } diff --git a/osd_peering_pg.h b/osd_peering_pg.h index 8c0c0fa0..0dac9396 100644 --- a/osd_peering_pg.h +++ b/osd_peering_pg.h @@ -138,6 +138,7 @@ struct pg_t void calc_object_states(); void remember_object(pg_obj_state_check_t &st, std::vector &all); + void print_state(); }; inline bool operator < (const pg_obj_loc_t &a, const pg_obj_loc_t &b)