Drop dirty peer connections also when stopping PG to guarantee that clients do not miss fsync
parent
b9de2a92a9
commit
0fec7a9fea
|
@ -254,6 +254,7 @@ class osd_t
|
||||||
bool check_peer_config(osd_client_t *cl, json11::Json conf);
|
bool check_peer_config(osd_client_t *cl, json11::Json conf);
|
||||||
void repeer_pgs(osd_num_t osd_num);
|
void repeer_pgs(osd_num_t osd_num);
|
||||||
void start_pg_peering(pg_t & pg);
|
void start_pg_peering(pg_t & pg);
|
||||||
|
void drop_dirty_pg_connections(pool_pg_num_t pg);
|
||||||
void submit_list_subop(osd_num_t role_osd, pg_peering_state_t *ps);
|
void submit_list_subop(osd_num_t role_osd, pg_peering_state_t *ps);
|
||||||
void discard_list_subop(osd_op_t *list_op);
|
void discard_list_subop(osd_op_t *list_op);
|
||||||
bool stop_pg(pg_t & pg);
|
bool stop_pg(pg_t & pg);
|
||||||
|
|
|
@ -168,20 +168,15 @@ void osd_t::reset_pg(pg_t & pg)
|
||||||
dirty_pgs.erase({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
dirty_pgs.erase({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repeer on each connect/disconnect peer event
|
// Drop connections of clients who have this PG in dirty_pgs
|
||||||
void osd_t::start_pg_peering(pg_t & pg)
|
void osd_t::drop_dirty_pg_connections(pool_pg_num_t pg)
|
||||||
{
|
{
|
||||||
pg.state = PG_PEERING;
|
|
||||||
this->peering_state |= OSD_PEERING_PGS;
|
|
||||||
reset_pg(pg);
|
|
||||||
report_pg_state(pg);
|
|
||||||
// Drop connections of clients who have this PG in dirty_pgs
|
|
||||||
if (immediate_commit != IMMEDIATE_ALL)
|
if (immediate_commit != IMMEDIATE_ALL)
|
||||||
{
|
{
|
||||||
std::vector<int> to_stop;
|
std::vector<int> to_stop;
|
||||||
for (auto & cp: msgr.clients)
|
for (auto & cp: msgr.clients)
|
||||||
{
|
{
|
||||||
if (cp.second->dirty_pgs.find({ .pool_id = pg.pool_id, .pg_num = pg.pg_num }) != cp.second->dirty_pgs.end())
|
if (cp.second->dirty_pgs.find(pg) != cp.second->dirty_pgs.end())
|
||||||
{
|
{
|
||||||
to_stop.push_back(cp.first);
|
to_stop.push_back(cp.first);
|
||||||
}
|
}
|
||||||
|
@ -191,6 +186,16 @@ void osd_t::start_pg_peering(pg_t & pg)
|
||||||
msgr.stop_client(peer_fd);
|
msgr.stop_client(peer_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Repeer on each connect/disconnect peer event
|
||||||
|
void osd_t::start_pg_peering(pg_t & pg)
|
||||||
|
{
|
||||||
|
pg.state = PG_PEERING;
|
||||||
|
this->peering_state |= OSD_PEERING_PGS;
|
||||||
|
reset_pg(pg);
|
||||||
|
report_pg_state(pg);
|
||||||
|
drop_dirty_pg_connections({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
||||||
// Try to connect with current peers if they're up, but we don't have connections to them
|
// Try to connect with current peers if they're up, but we don't have connections to them
|
||||||
// Otherwise we may erroneously decide that the pg is incomplete :-)
|
// Otherwise we may erroneously decide that the pg is incomplete :-)
|
||||||
for (auto pg_osd: pg.all_peers)
|
for (auto pg_osd: pg.all_peers)
|
||||||
|
@ -460,6 +465,7 @@ bool osd_t::stop_pg(pg_t & pg)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
drop_dirty_pg_connections({ .pool_id = pg.pool_id, .pg_num = pg.pg_num });
|
||||||
if (!(pg.state & (PG_ACTIVE | PG_REPEERING)))
|
if (!(pg.state & (PG_ACTIVE | PG_REPEERING)))
|
||||||
{
|
{
|
||||||
finish_stop_pg(pg);
|
finish_stop_pg(pg);
|
||||||
|
|
Loading…
Reference in New Issue