mirror of
https://github.com/ceph/ceph
synced 2024-12-28 22:43:29 +00:00
Merge pull request #1317 from ceph/wip-7537
Wip 7537 Reviewed-by: David Zafman <david.zafman@inktank.com>
This commit is contained in:
commit
5a6cb3da20
@ -353,18 +353,30 @@ bool OSDMonitor::thrash()
|
||||
while (n--)
|
||||
++p;
|
||||
for (int i=0; i<50; i++) {
|
||||
unsigned size = osdmap.get_pg_size(p->first);
|
||||
vector<int> v;
|
||||
for (int j=0; j<3; j++) {
|
||||
bool have_real_osd = false;
|
||||
for (int j=0; j < (int)size; j++) {
|
||||
o = rand() % osdmap.get_num_osds();
|
||||
if (osdmap.exists(o) && std::find(v.begin(), v.end(), o) == v.end())
|
||||
if (osdmap.exists(o) && std::find(v.begin(), v.end(), o) == v.end()) {
|
||||
have_real_osd = true;
|
||||
v.push_back(o);
|
||||
}
|
||||
}
|
||||
if (v.size() < 3) {
|
||||
for (vector<int>::iterator q = p->second.acting.begin(); q != p->second.acting.end(); ++q)
|
||||
if (std::find(v.begin(), v.end(), *q) == v.end())
|
||||
v.push_back(*q);
|
||||
for (vector<int>::iterator q = p->second.acting.begin();
|
||||
q != p->second.acting.end() && v.size() < size;
|
||||
++q) {
|
||||
if (std::find(v.begin(), v.end(), *q) == v.end()) {
|
||||
if (*q != CRUSH_ITEM_NONE)
|
||||
have_real_osd = true;
|
||||
v.push_back(*q);
|
||||
}
|
||||
}
|
||||
if (!v.empty())
|
||||
if (osdmap.pg_is_ec(p->first)) {
|
||||
while (v.size() < size)
|
||||
v.push_back(CRUSH_ITEM_NONE);
|
||||
}
|
||||
if (!v.empty() && have_real_osd)
|
||||
pending_inc.new_pg_temp[p->first] = v;
|
||||
dout(5) << "thrash_map pg " << p->first << " pg_temp remapped to " << v << dendl;
|
||||
|
||||
|
@ -1555,10 +1555,10 @@ void OSDMap::_pg_to_up_acting_osds(pg_t pg, vector<int> *up, int *up_primary,
|
||||
_raw_to_up_osds(*pool, raw, &_up, &_up_primary);
|
||||
_apply_primary_affinity(pps, *pool, &_up, &_up_primary);
|
||||
_get_temp_osds(*pool, pg, &_acting, &_acting_primary);
|
||||
if (_acting.empty())
|
||||
if (_acting.empty()) {
|
||||
_acting = _up;
|
||||
if (_acting_primary == -1)
|
||||
_acting_primary = _up_primary;
|
||||
}
|
||||
if (up)
|
||||
up->swap(_up);
|
||||
if (up_primary)
|
||||
|
Loading…
Reference in New Issue
Block a user