unsigned usable = 1;
unsigned backfill = 0;
- // select replicas that have log contiguity with primary
+ // select replicas that have log contiguity with primary.
+ // prefer up, then acting, then any peer_info osds
for (vector<int>::const_iterator i = up.begin();
i != up.end();
++i) {
}
}
+ for (vector<int>::const_iterator i = acting.begin();
+ i != acting.end();
+ ++i) {
+ if (usable >= get_osdmap()->get_pg_size(info.pgid))
+ break;
+
+ // skip up osds we already considered above
+ if (*i == primary->first)
+ continue;
+ vector<int>::const_iterator up_it = find(up.begin(), up.end(), *i);
+ if (up_it != up.end())
+ continue;
+
+ const pg_info_t &cur_info = all_info.find(*i)->second;
+ if (cur_info.is_incomplete() || cur_info.last_update < primary->second.log_tail) {
+ dout(10) << " osd." << *i << " (stray) REJECTED " << cur_info << dendl;
+ } else {
+ want.push_back(*i);
+ dout(10) << " osd." << *i << " (stray) accepted " << cur_info << dendl;
+ usable++;
+ }
+ }
+
for (map<int,pg_info_t>::const_iterator i = all_info.begin();
i != all_info.end();
++i) {
vector<int>::const_iterator up_it = find(up.begin(), up.end(), i->first);
if (up_it != up.end())
continue;
+ vector<int>::const_iterator acting_it = find(acting.begin(), acting.end(), i->first);
+ if (acting_it != acting.end())
+ continue;
if (i->second.is_incomplete() || i->second.last_update < primary->second.log_tail) {
dout(10) << " osd." << i->first << " (stray) REJECTED " << i->second << dendl;