Print PG states on every change

trace-sqes
Vitaliy Filippov 2020-03-14 22:19:45 +03:00
parent 21d0b06959
commit d8164e9d84
3 changed files with 23 additions and 10 deletions

View File

@ -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)

View File

@ -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
);
}

View File

@ -138,6 +138,7 @@ struct pg_t
void calc_object_states();
void remember_object(pg_obj_state_check_t &st, std::vector<obj_ver_role> &all);
void print_state();
};
inline bool operator < (const pg_obj_loc_t &a, const pg_obj_loc_t &b)