]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: limit number of pending exports when thash exports is enabled
authorYan, Zheng <zyan@redhat.com>
Wed, 21 Dec 2016 09:47:32 +0000 (17:47 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Jan 2017 07:23:34 +0000 (15:23 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDSRank.cc
src/mds/Migrator.h

index 3b66fc9833e1af4876c4f4d8ef668fa3f266c105..e440d528f9e07e41c77f1428248dc5f1c9aa093e 100644 (file)
@@ -478,6 +478,9 @@ bool MDSRank::_dispatch(Message *m, bool new_msg)
     mdsmap->get_mds_set(s, MDSMap::STATE_ACTIVE);
     if (s.size() < 2 || mdcache->get_num_inodes() < 10)
       break;  // need peers for this to work.
+    if (mdcache->migrator->get_num_exporting() > g_conf->mds_thrash_exports * 5 ||
+       mdcache->migrator->get_export_queue_size() > g_conf->mds_thrash_exports * 10)
+      break;
 
     dout(7) << "mds thrashing exports pass " << (i+1) << "/" << g_conf->mds_thrash_exports << dendl;
 
@@ -508,7 +511,7 @@ bool MDSRank::_dispatch(Message *m, bool new_msg)
   // hack: thrash fragments
   for (int i=0; i<g_conf->mds_thrash_fragments; i++) {
     if (!is_active()) break;
-    if (mdcache->get_num_fragmenting_dirs() > 5) break;
+    if (mdcache->get_num_fragmenting_dirs() > 5 * g_conf->mds_thrash_fragments) break;
     dout(7) << "mds thrashing fragments pass " << (i+1) << "/" << g_conf->mds_thrash_fragments << dendl;
 
     // pick a random dir inode
index 7ef984441ca7836d660ef569a6abf3e4b861f394..75170f5fe3d11cf13cde65c1342ece6cfbb41b51 100644 (file)
@@ -153,6 +153,9 @@ public:
 
   void show_importing();
   void show_exporting();
+
+  int get_num_exporting() const { return export_state.size(); }
+  int get_export_queue_size() const { return export_queue.size(); }
   
   // -- status --
   int is_exporting(CDir *dir) const {