<< ", ignoring" << dendl;
} else {
dout(10) << " divergent " << *pp << ", adding to missing" << dendl;
- peer_missing[from].add(pp->oid, pp->version);
+ peer_missing[from].add_event(*pp);
}
++pp;
dout(10) << "merge_log divergent entry " << oe
<< " not superceded by " << *log.objects[oe.oid]
<< ", adding to missing" << dendl;
- missing.add(oe.oid, oe.version);
+ missing.add_event(oe);
} else {
dout(10) << "merge_log divergent entry " << oe
<< " superceded by " << *log.objects[oe.oid]
}
} else {
dout(10) << "merge_log divergent entry " << oe << ", adding to missing" << dendl;
- missing.add(oe.oid, oe.version);
+ missing.add_event(oe);
}
olog.log.pop_back(); // discard divergent entry
}
break;
}
- if (p->is_delete()) {
- dout(10) << "merge_log merging " << *p << ", not missing" << dendl;
- missing.rm(p->oid, p->version);
- } else {
- dout(10) << "merge_log merging " << *p << ", now missing" << dendl;
- missing.add(p->oid, p->version);
- }
+ dout(10) << "merge_log merging " << *p << ", not missing" << dendl;
+ missing.add_event(*p);
}
info.last_update = log.top = olog.top;
dout(15) << *to << dendl;
// new missing object?
- if (to->version > info.last_complete) {
- if (to->is_update())
- missing.add(to->oid, to->version);
- else
- missing.rm(to->oid, to->version);
- }
+ if (to->version > info.last_complete)
+ missing.add_event(*to);
}
assert(to != olog.log.end());
dout(10) << "merge_log " << *from << dendl;
// add to missing
- if (from->is_update()) {
- missing.add(from->oid, from->version);
- } else
- missing.rm(from->oid, from->version);
+ missing.add_event(*from);
}
// remove divergent items
p != m->log.log.end();
p++)
if (p->version > plu)
- pm.add(p->oid, p->version);
+ pm.add_event(*p);
}
if (m) {
pobject_t poid(info.pgid.pool(), 0, i->oid);
int r = osd->store->getattr(info.pgid, poid, "version", &v, sizeof(v));
if (r < 0 || v < i->version)
- missing.add(i->oid, i->version);
+ missing.add_event(*i);
}
}
WRITE_CLASS_ENCODER(Query)
- /*
- * Missing - summary of missing objects.
- * kept in memory, as a supplement to Log.
- * also used to pass missing info in messages.
- */
- class Missing {
- public:
- map<object_t, eversion_t> missing; // oid -> 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) {
- return missing.count(oid);
- }
- bool is_missing(object_t oid, eversion_t v) {
- return missing.count(oid) && missing[oid] <= v;
- }
- void add(object_t oid) {
- eversion_t z;
- add(oid,z);
- }
- void add(object_t oid, eversion_t v) {
- if (missing.count(oid)) {
- if (missing[oid] > v) return; // already missing newer.
- rmissing.erase(missing[oid]);
- }
- missing[oid] = v;
- rmissing[v] = oid;
- }
- void rm(object_t oid, eversion_t when) {
- if (missing.count(oid) && missing[oid] < when) {
- rmissing.erase(missing[oid]);
- missing.erase(oid);
- loc.erase(oid);
- }
- }
- void got(object_t oid, eversion_t v) {
- assert(missing.count(oid));
- assert(missing[oid] <= v);
- loc.erase(oid);
- rmissing.erase(missing[oid]);
- missing.erase(oid);
- }
- void got(object_t oid) {
- assert(missing.count(oid));
- loc.erase(oid);
- rmissing.erase(missing[oid]);
- 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,eversion_t>::iterator it = missing.begin();
- it != missing.end();
- it++)
- rmissing[it->second] = it->first;
- }
- };
- WRITE_CLASS_ENCODER(Missing)
-
-
/*
* Log - incremental log of recent pg changes.
* also, serves as a recovery queue.
};
+ /*
+ * Missing - summary of missing objects.
+ * kept in memory, as a supplement to Log.
+ * also used to pass missing info in messages.
+ */
+ class Missing {
+ public:
+ map<object_t, eversion_t> missing; // oid -> 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) {
+ return missing.count(oid);
+ }
+ bool is_missing(object_t oid, eversion_t v) {
+ return missing.count(oid) && missing[oid] <= v;
+ }
+ void add(object_t oid) {
+ eversion_t z;
+ add(oid,z);
+ }
+
+ void add_event(Log::Entry& e) {
+ if (e.is_update())
+ add(e.oid, e.version);
+ else
+ rm(e.oid, e.version);
+ }
+
+ void add(object_t oid, eversion_t v) {
+ if (missing.count(oid)) {
+ if (missing[oid] > v) return; // already missing newer.
+ rmissing.erase(missing[oid]);
+ }
+ missing[oid] = v;
+ rmissing[v] = oid;
+ }
+ void rm(object_t oid, eversion_t when) {
+ if (missing.count(oid) && missing[oid] < when) {
+ rmissing.erase(missing[oid]);
+ missing.erase(oid);
+ loc.erase(oid);
+ }
+ }
+ void got(object_t oid, eversion_t v) {
+ assert(missing.count(oid));
+ assert(missing[oid] <= v);
+ loc.erase(oid);
+ rmissing.erase(missing[oid]);
+ missing.erase(oid);
+ }
+ void got(object_t oid) {
+ assert(missing.count(oid));
+ loc.erase(oid);
+ rmissing.erase(missing[oid]);
+ 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,eversion_t>::iterator it = missing.begin();
+ it != missing.end();
+ it++)
+ rmissing[it->second] = it->first;
+ }
+ };
+ WRITE_CLASS_ENCODER(Missing)
+
+
/*** PG ****/
protected:
OSD *osd;