Implement event-driven PG peering
This commit is contained in:
+15
-2
@@ -18,7 +18,7 @@ void pg_t::remember_object(pg_obj_state_check_t &st, std::vector<obj_ver_role> &
|
||||
else if (st.n_roles < pg.pg_minsize)
|
||||
{
|
||||
state = OBJ_INCOMPLETE;
|
||||
pg.state = pg.state | PG_HAS_INCOMPLETE;
|
||||
pg.state = pg.state | PG_HAS_UNFOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -164,6 +164,7 @@ void pg_t::calc_object_states()
|
||||
std::sort(all.begin(), all.end());
|
||||
// Walk over it and check object states
|
||||
pg.clean_count = 0;
|
||||
pg.state = 0;
|
||||
int replica = 0;
|
||||
pg_obj_state_check_t st;
|
||||
for (int i = 0; i < all.size(); i++)
|
||||
@@ -225,7 +226,7 @@ void pg_t::calc_object_states()
|
||||
{
|
||||
st.n_stable++;
|
||||
}
|
||||
if (pg.target_set[replica] == all[i].osd_num)
|
||||
if (pg.cur_set[replica] == all[i].osd_num)
|
||||
{
|
||||
st.n_matched++;
|
||||
}
|
||||
@@ -242,5 +243,17 @@ void pg_t::calc_object_states()
|
||||
st.obj_end = st.ver_end = all.size();
|
||||
remember_object(st, all);
|
||||
}
|
||||
if (pg.pg_cursize < pg.pg_size)
|
||||
{
|
||||
pg.state = pg.state | PG_DEGRADED;
|
||||
}
|
||||
printf(
|
||||
"PG %u is active%s%s%s%s\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.state = pg.state | PG_ACTIVE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user