Fixes pull() to choose an osd that isn't down.
else if (need <= olog.top) {
dout(10) << "proc_missing " << p->first << " " << need
<< " is on osd" << fromosd << dendl;
- missing.loc[p->first] = fromosd;
+ missing_loc[p->first].insert(fromosd);
} else {
dout(10) << "proc_missing " << p->first << " " << need
<< " > olog.top " << olog.top << ", also missing on osd" << fromosd
peer_missing.clear();
finish_sync_event = 0; // so that _finish_recvoery doesn't go off in another thread
-
+
+ missing_loc.clear();
log.reset_recovery();
stat_object_temp_rd.clear();
// -- ok. and have i located all pg contents?
- if (missing.num_lost() > 0) {
- dout(10) << "there are still " << missing.num_lost() << " lost objects" << dendl;
+ if (missing_loc.size()) {
+ dout(10) << "there are still " << missing_loc.size() << " lost objects" << dendl;
// *****
// FIXME: i don't think this actually accomplishes anything!
}
if (!waiting) {
- dout(10) << missing.num_lost() << " objects are still lost, waiting+hoping for a notify from someone else!" << dendl;
+ dout(10) << missing_loc.size() << " objects are still lost, waiting+hoping for a notify from someone else!" << dendl;
}
return;
}
// sanity check
- assert(missing.num_lost() == 0);
+ assert(missing_loc.empty());
assert(info.last_complete >= log.bottom || log.backlog);
// -- do need to notify the monitor?
map<object_t, item> missing; // oid -> (need v, have v)
map<eversion_t, object_t> rmissing; // v -> oid
- map<object_t, int> loc; // where i think i can get them.
-
- int num_lost() const { return missing.size() - loc.size(); }
int num_missing() const { return missing.size(); }
bool is_missing(object_t oid) {
if (missing.count(oid) && missing[oid].need < when) {
rmissing.erase(missing[oid].need);
missing.erase(oid);
- loc.erase(oid);
- }
+ }
}
void got(object_t oid, eversion_t v) {
assert(missing.count(oid));
assert(missing[oid].need <= v);
- loc.erase(oid);
rmissing.erase(missing[oid].need);
missing.erase(oid);
}
void encode(bufferlist &bl) const {
::encode(missing, bl);
- ::encode(loc, bl);
}
void decode(bufferlist::iterator &bl) {
::decode(missing, bl);
- ::decode(loc, bl);
for (map<object_t,item>::iterator it = missing.begin();
it != missing.end();
IndexedLog log;
OndiskLog ondisklog;
Missing missing;
+ map<object_t, set<int> > missing_loc;
+
set<snapid_t> snap_collections;
xlist<PG*>::item recovery_item;
//out << " (" << pg.log.bottom << "," << pg.log.top << "]";
if (pg.missing.num_missing())
out << " m=" << pg.missing.num_missing();
- if (pg.is_primary() && pg.missing.num_lost())
- out << " l=" << pg.missing.num_lost();
+ if (pg.is_primary()) {
+ int lost = pg.missing.num_missing() - pg.missing_loc.size();
+ if (lost)
+ out << " l=" << lost;
+ }
if (pg.info.dead_snaps.size())
out << " dead=" << pg.info.dead_snaps;
out << "]";
*/
bool ReplicatedPG::pull(pobject_t poid)
{
- assert(missing.loc.count(poid.oid));
eversion_t v = missing.missing[poid.oid].need;
- int fromosd = missing.loc[poid.oid];
+
+ int fromosd = -1;
+ assert(missing_loc.count(poid.oid));
+ for (set<int>::iterator p = missing_loc[poid.oid].begin();
+ p != missing_loc[poid.oid].end();
+ p++) {
+ if (osd->osdmap->is_up(fromosd)) {
+ fromosd = *p;
+ break;
+ }
+ }
dout(7) << "pull " << poid
<< " v " << v
- << " from osd" << fromosd
- << dendl;
+ << " on osds " << missing_loc[poid.oid]
+ << " from osd" << fromosd
+ << dendl;
- if (!osd->osdmap->is_up(fromosd)) {
- dout(7) << " osd" << fromosd << " is down" << dendl;
+ if (fromosd < 0)
return false;
- }
map<pobject_t, interval_set<__u64> > clone_subsets;
interval_set<__u64> data_subset;
pulling.erase(poid.oid);
missing.got(poid.oid, v);
-
+ missing_loc.erase(poid.oid);
// raise last_complete?
assert(log.complete_to != log.log.end());
void ReplicatedPG::cancel_recovery()
{
// forget about where missing items are, or anything we're pulling
- missing.loc.clear();
+ missing_loc.clear();
osd->num_pulling -= pulling.size();
pulling.clear();
pushing.clear();
latest->snaps);
osd->store->apply_transaction(t);
missing.got(latest->oid, latest->version);
+ missing_loc.erase(latest->oid);
continue;
}
}