return ok;
}
+
+
+map<int, ScrubMap *>::const_iterator PG::_select_auth_object(
+ const hobject_t &obj,
+ const map<int,ScrubMap*> &maps)
+{
+ map<int, ScrubMap *>::const_iterator auth = maps.end();
+ // Select first present replica
+ for (map<int, ScrubMap *>::const_iterator j = maps.begin();
+ j != maps.end();
+ ++j) {
+ if (!j->second->objects.count(obj)) {
+ continue;
+ }
+ if (auth == maps.end()) {
+ auth = j;
+ continue;
+ }
+ }
+ return auth;
+}
+
void PG::_compare_scrubmaps(const map<int,ScrubMap*> &maps,
map<hobject_t, set<int> > &missing,
map<hobject_t, set<int> > &inconsistent,
for (set<hobject_t>::const_iterator k = master_set.begin();
k != master_set.end();
k++) {
- map<int, ScrubMap *>::const_iterator auth = maps.end();
+ map<int, ScrubMap *>::const_iterator auth = _select_auth_object(*k, maps);
+ assert(auth != maps.end());
set<int> cur_missing;
set<int> cur_inconsistent;
for (j = maps.begin(); j != maps.end(); j++) {
if (j->second->objects.count(*k)) {
- if (auth == maps.end()) {
- // Take first osd to have it as authoritative
- auth = j;
- } else {
- // Compare
- stringstream ss;
- if (!_compare_scrub_objects(auth->second->objects[*k],
- j->second->objects[*k],
- ss)) {
- cur_inconsistent.insert(j->first);
- ++scrubber.errors;
- errorstream << info.pgid << " osd." << acting[j->first]
- << ": soid " << *k << " " << ss.str() << std::endl;
- }
+ // Compare
+ stringstream ss;
+ if (!_compare_scrub_objects(auth->second->objects[*k],
+ j->second->objects[*k],
+ ss)) {
+ cur_inconsistent.insert(j->first);
+ ++scrubber.errors;
+ errorstream << info.pgid << " osd." << acting[j->first]
+ << ": soid " << *k << " " << ss.str() << std::endl;
}
} else {
cur_missing.insert(j->first);
int active_pushes;
void repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer, int ok_peer);
+ map<int, ScrubMap *>::const_iterator _select_auth_object(
+ const hobject_t &obj,
+ const map<int,ScrubMap*> &maps);
bool _compare_scrub_objects(ScrubMap::object &auth,
ScrubMap::object &candidate,
ostream &errorstream);