}
}
-
- if (1) {
- if (beat % 2 == 1) {
- // old way
- dout(15) << " matching big exporters to big importers" << dendl;
- // big exporters to big importers
- multimap<double,mds_rank_t>::reverse_iterator ex = exporters.rbegin();
- multimap<double,mds_rank_t>::iterator im = importers.begin();
- while (ex != exporters.rend() &&
- im != importers.end()) {
- double maxex = get_maxex(ex->second);
- double maxim = get_maxim(im->second);
- if (maxex < .001 || maxim < .001) break;
- try_match(ex->second, maxex,
- im->second, maxim);
- if (maxex <= .001) ++ex;
- if (maxim <= .001) ++im;
- }
- } else {
- // new way
- dout(15) << " matching small exporters to big importers" << dendl;
- // small exporters to big importers
- multimap<double,mds_rank_t>::iterator ex = exporters.begin();
- multimap<double,mds_rank_t>::iterator im = importers.begin();
- while (ex != exporters.end() &&
- im != importers.end()) {
- double maxex = get_maxex(ex->second);
- double maxim = get_maxim(im->second);
- if (maxex < .001 || maxim < .001) break;
- try_match(ex->second, maxex,
- im->second, maxim);
- if (maxex <= .001) ++ex;
- if (maxim <= .001) ++im;
- }
+ // old way
+ if (beat % 2 == 1) {
+ dout(15) << " matching big exporters to big importers" << dendl;
+ // big exporters to big importers
+ multimap<double,mds_rank_t>::reverse_iterator ex = exporters.rbegin();
+ multimap<double,mds_rank_t>::iterator im = importers.begin();
+ while (ex != exporters.rend() &&
+ im != importers.end()) {
+ double maxex = get_maxex(ex->second);
+ double maxim = get_maxim(im->second);
+ if (maxex < .001 || maxim < .001) break;
+ try_match(ex->second, maxex,
+ im->second, maxim);
+ if (maxex <= .001) ++ex;
+ if (maxim <= .001) ++im;
+ }
+ } else { // new way
+ dout(15) << " matching small exporters to big importers" << dendl;
+ // small exporters to big importers
+ multimap<double,mds_rank_t>::iterator ex = exporters.begin();
+ multimap<double,mds_rank_t>::iterator im = importers.begin();
+ while (ex != exporters.end() &&
+ im != importers.end()) {
+ double maxex = get_maxex(ex->second);
+ double maxim = get_maxim(im->second);
+ if (maxex < .001 || maxim < .001) break;
+ try_match(ex->second, maxex,
+ im->second, maxim);
+ if (maxex <= .001) ++ex;
+ if (maxim <= .001) ++im;
}
}
}
if (in->get_parent_dn())
hit_dir(now, in->get_parent_dn()->get_dir(), type, who);
}
-/*
- // hit me
- in->popularity[MDS_POP_JUSTME].pop[type].hit(now);
- in->popularity[MDS_POP_NESTED].pop[type].hit(now);
- if (in->is_auth()) {
- in->popularity[MDS_POP_CURDOM].pop[type].hit(now);
- in->popularity[MDS_POP_ANYDOM].pop[type].hit(now);
-
- dout(20) << "hit_inode " << type << " pop "
- << in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
- << in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
- << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " curdom, "
- << in->popularity[MDS_POP_CURDOM].pop[type].get(now) << " anydom"
- << " on " << *in
- << dendl;
- } else {
- dout(20) << "hit_inode " << type << " pop "
- << in->popularity[MDS_POP_JUSTME].pop[type].get(now) << " me, "
- << in->popularity[MDS_POP_NESTED].pop[type].get(now) << " nested, "
- << " on " << *in
- << dendl;
- }
-
- // hit auth up to import
- CDir *dir = in->get_parent_dir();
- if (dir) hit_dir(now, dir, type);
-*/
-
void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, int who, double amount)
{
// hit me
double v = dir->pop_me.get(type).hit(now, amount);
- //if (dir->ino() == inodeno_t(0x10000000000))
- //dout(0) << "hit_dir " << type << " pop " << v << " in " << *dir << dendl;
-
// split/merge
if (g_conf->mds_bal_frag && g_conf->mds_bal_fragment_interval > 0 &&
!dir->inode->is_base() && // not root/base (for now at least)