]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
simplify mds overload judgement logic
authorJianyu Li <joannyli@foxmail.com>
Tue, 12 Dec 2017 07:20:44 +0000 (15:20 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 19 Apr 2018 00:10:26 +0000 (08:10 +0800)
Signed-off-by: Jianyu Li <joannyli@tencent.com>
(cherry picked from commit e5ca899260ca3e889448c9cb1c583f575145e390)

src/mds/MDBalancer.cc

index 36c50043729e6f2ff08d51f42109c8a5040251ff..595f97710d6ffdbe27a6568ff1b3ff243c73f8a9 100644 (file)
@@ -677,11 +677,13 @@ void MDBalancer::prep_rebalance(int beat)
        dout(15) << "   mds." << it->second << " is importer" << dendl;
        importers.insert(pair<double,mds_rank_t>(it->first,it->second));
        importer_set.insert(it->second);
-      } else if ((it->first > target_load * (1.0 + g_conf->mds_bal_min_rebalance)) && 
-        (it->second == whoami || !mds_last_epoch_under_info[it->second] || beat_epoch - mds_last_epoch_under_info[it->second] >= 2)){
-       dout(15) << "   mds." << it->second << " is exporter" << dendl;
-       exporters.insert(pair<double,mds_rank_t>(it->first,it->second));
-       exporter_set.insert(it->second);
+      } else if (it->first > target_load * (1.0 + g_conf->mds_bal_min_rebalance)) {
+        int mds_last_epoch_under = (it->second == whoami) ? 0 : mds_last_epoch_under_info[it->second];
+        if (!mds_last_epoch_under || beat_epoch - mds_last_epoch_under >= 2) {
+         dout(15) << "   mds." << it->second << " is exporter" << dendl;
+         exporters.insert(pair<double,mds_rank_t>(it->first,it->second));
+         exporter_set.insert(it->second);
+        }
       }
     }