const hobject_t &hoid) {
if (peer == get_primary())
return true;
- ceph_assert(peer_info.count(peer));
+ ceph_assert(recovery_state.has_peer_info(peer));
bool should_send =
hoid.pool != (int64_t)info.pgid.pool() ||
hoid <= last_backfill_started ||
- hoid <= peer_info[peer].last_backfill;
+ hoid <= recovery_state.get_peer_info(peer).last_backfill;
if (!should_send) {
ceph_assert(is_backfill_target(peer));
dout(10) << __func__ << " issue_repop shipping empty opt to osd." << peer
<< ", object " << hoid
<< " beyond std::max(last_backfill_started "
<< ", peer_info[peer].last_backfill "
- << peer_info[peer].last_backfill << ")" << dendl;
+ << recovery_state.get_peer_info(peer).last_backfill
+ << ")" << dendl;
return should_send;
}
if (is_async_recovery_target(peer) &&
// Object is degraded if after last_backfill AND
// we are backfilling it
if (is_backfill_target(peer) &&
- peer_info[peer].last_backfill <= soid &&
+ recovery_state.get_peer_info(peer).last_backfill <= soid &&
last_backfill_started >= soid &&
backfills_in_flight.count(soid))
return true;
i != get_backfill_targets().end();
++i) {
pg_shard_t bt = *i;
- map<pg_shard_t, pg_info_t>::const_iterator iter = peer_info.find(bt);
- ceph_assert(iter != peer_info.end());
- if (iter->second.last_backfill < e)
- e = iter->second.last_backfill;
+ const pg_info_t &pi = recovery_state.get_peer_info(bt);
+ if (pi.last_backfill < e)
+ e = pi.last_backfill;
}
return e;
}
const hobject_t &soid,
const object_stat_sum_t &delta_stats) {
- info.stats.stats.add(delta_stats);
- info.stats.stats.floor(0);
-
+ recovery_state.apply_op_stats(soid, delta_stats);
for (set<pg_shard_t>::const_iterator i = get_backfill_targets().begin();
i != get_backfill_targets().end();
++i) {
pg_shard_t bt = *i;
- pg_info_t& pinfo = peer_info[bt];
- if (soid <= pinfo.last_backfill)
- pinfo.stats.stats.add(delta_stats);
- else if (soid <= last_backfill_started)
+ const pg_info_t& pinfo = recovery_state.get_peer_info(bt);
+ if (soid > pinfo.last_backfill && soid <= last_backfill_started) {
pending_backfill_updates[soid].stats.add(delta_stats);
+ }
}
if (is_primary() && scrubber.active) {
pg_shard_t peer(*i);
if (peer == pg_whoami) continue;
ceph_assert(recovery_state.get_peer_missing().count(peer));
- ceph_assert(peer_info.count(peer));
+ ceph_assert(recovery_state.has_peer_info(peer));
if (get_osdmap()->require_osd_release >= CEPH_RELEASE_JEWEL) {
ceph_assert(repop);
MOSDPGUpdateLogMissing *m = new MOSDPGUpdateLogMissing(
i != get_backfill_targets().end();
++i) {
dout(5) << "target shard " << *i
- << " from " << peer_info[*i].last_backfill
+ << " from " << recovery_state.get_peer_info(*i).last_backfill
<< dendl;
}
}
ceph_assert(peer != get_primary());
auto pm = recovery_state.get_peer_missing().find(peer);
ceph_assert(pm != recovery_state.get_peer_missing().end());
- map<pg_shard_t, pg_info_t>::const_iterator pi = peer_info.find(peer);
- ceph_assert(pi != peer_info.end());
size_t m_sz = pm->second.num_missing();
dout(10) << " peer osd." << peer << " missing " << m_sz << " objects." << dendl;
continue;
}
- if (soid > pi->second.last_backfill) {
+ const pg_info_t &pi = recovery_state.get_peer_info(peer);
+ if (soid > pi.last_backfill) {
if (!recovering.count(soid)) {
- derr << __func__ << ": object " << soid << " last_backfill " << pi->second.last_backfill << dendl;
+ derr << __func__ << ": object " << soid << " last_backfill "
+ << pi.last_backfill << dendl;
derr << __func__ << ": object added to missing set for backfill, but "
<< "is not in recovering, error!" << dendl;
ceph_abort();
for (set<pg_shard_t>::const_iterator i = get_backfill_targets().begin();
i != get_backfill_targets().end();
++i) {
- peer_backfill_info[*i].reset(peer_info[*i].last_backfill);
+ peer_backfill_info[*i].reset(
+ recovery_state.get_peer_info(*i).last_backfill);
}
backfill_info.reset(last_backfill_started);
i != get_backfill_targets().end();
++i) {
dout(10) << "peer osd." << *i
- << " info " << peer_info[*i]
+ << " info " << recovery_state.get_peer_info(*i)
<< " interval " << peer_backfill_info[*i].begin
<< "-" << peer_backfill_info[*i].end
<< " " << peer_backfill_info[*i].objects.size() << " objects"
i != get_backfill_targets().end();
++i) {
peer_backfill_info[*i].trim_to(
- std::max(peer_info[*i].last_backfill, last_backfill_started));
+ std::max(
+ recovery_state.get_peer_info(*i).last_backfill,
+ last_backfill_started));
}
backfill_info.trim_to(last_backfill_started);
keep_ver_targs.push_back(bt);
}
} else {
- pg_info_t& pinfo = peer_info[bt];
+ const pg_info_t& pinfo = recovery_state.get_peer_info(bt);
// Only include peers that we've caught up to their backfill line
// otherwise, they only appear to be missing this object
pending_backfill_updates.erase(i++)) {
dout(20) << " pending_backfill_update " << i->first << dendl;
ceph_assert(i->first > new_last_backfill);
- for (set<pg_shard_t>::const_iterator j = get_backfill_targets().begin();
- j != get_backfill_targets().end();
- ++j) {
- pg_shard_t bt = *j;
- pg_info_t& pinfo = peer_info[bt];
- //Add stats to all peers that were missing object
- if (i->first > pinfo.last_backfill)
- pinfo.stats.add(i->second);
- }
+ recovery_state.update_complete_backfill_object_stats(
+ i->first,
+ i->second);
new_last_backfill = i->first;
}
dout(10) << "possible new_last_backfill at " << new_last_backfill << dendl;
i != get_backfill_targets().end();
++i) {
pg_shard_t bt = *i;
- pg_info_t& pinfo = peer_info[bt];
+ const pg_info_t& pinfo = recovery_state.get_peer_info(bt);
if (new_last_backfill > pinfo.last_backfill) {
- pinfo.set_last_backfill(new_last_backfill);
+ recovery_state.update_peer_last_backfill(bt, new_last_backfill);
epoch_t e = get_osdmap_epoch();
MOSDPGBackfill *m = NULL;
if (pinfo.last_backfill.is_max()) {
get_last_peering_reset(),
spg_t(info.pgid.pgid, bt.shard));
// Use default priority here, must match sub_op priority
- /* pinfo.stats might be wrong if we did log-based recovery on the
- * backfilled portion in addition to continuing backfill.
- */
- pinfo.stats = info.stats;
start_recovery_op(hobject_t::get_max());
} else {
m = new MOSDPGBackfill(
for (set<pg_shard_t>::const_iterator p = get_backfill_targets().begin();
p != get_backfill_targets().end();
++p) {
- ceph_assert(peer_info.count(*p));
- const pg_info_t& pi = peer_info[*p];
+ const pg_info_t& pi = recovery_state.get_peer_info(*p);
if (pi.last_backfill == hobject_t() ||
pi.last_backfill.get_hash() == info.pgid.ps()) {
dout(10) << __func__ << " backfill target osd." << *p