From: Rishabh Dave Date: Mon, 21 Jan 2019 10:06:57 +0000 (+0530) Subject: mds: dont print subtrees if they are too many/big X-Git-Tag: v13.2.7~32^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4d291e9fa0b196f364cd8e1e2bea2e8dcefa1a5c;p=ceph.git mds: dont print subtrees if they are too many/big Also, add an argument to force print subtrees and let MDBalancer::tick() always print subtrees. Fixes: https://tracker.ceph.com/issues/37726 Signed-off-by: Rishabh Dave (cherry picked from commit 50d28ec4f842670fb96ab3b0d2b37a9c2e282236) Conflicts: src/mds/MDCache.cc - g_conf --- diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 9553bafe40e0..582878905e0b 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -205,6 +205,8 @@ void MDBalancer::tick() send_heartbeat(); num_bal_times--; } + + mds->mdcache->show_subtrees(10, true); } diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 586173fbdac9..0df26425408f 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -12221,7 +12221,7 @@ void MDCache::force_readonly() // ============================================================== // debug crap -void MDCache::show_subtrees(int dbl) +void MDCache::show_subtrees(int dbl, bool force_print) { if (g_conf->mds_thrash_exports) dbl += 15; @@ -12237,6 +12237,13 @@ void MDCache::show_subtrees(int dbl) return; } + if (!force_print && subtrees.size() > SUBTREES_COUNT_THRESHOLD && + !g_conf->subsys.should_gather()) { + dout(ceph::dout::need_dynamic(dbl)) << "number of subtrees = " << subtrees.size() << "; not " + "printing subtrees" << dendl; + return; + } + // root frags list basefrags; for (set::iterator p = base_inodes.begin(); @@ -12257,10 +12264,10 @@ void MDCache::show_subtrees(int dbl) set subtrees_seen; - int depth = 0; + unsigned int depth = 0; while (!q.empty()) { CDir *dir = q.front().first; - int d = q.front().second; + unsigned int d = q.front().second; q.pop_front(); if (subtrees.count(dir) == 0) continue; @@ -12286,6 +12293,12 @@ void MDCache::show_subtrees(int dbl) } } + if (!force_print && depth > SUBTREES_DEPTH_THRESHOLD && + !g_conf->subsys.should_gather()) { + dout(ceph::dout::need_dynamic(dbl)) << "max depth among subtrees = " << depth << "; not printing " + "subtrees" << dendl; + return; + } // print tree for (list::iterator p = basefrags.begin(); p != basefrags.end(); ++p) diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 564af377ae75..64f3ef61274b 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -305,6 +305,9 @@ public: // -- subtrees -- +private: + static const unsigned int SUBTREES_COUNT_THRESHOLD = 5; + static const unsigned int SUBTREES_DEPTH_THRESHOLD = 5; protected: /* subtree keys and each tree's non-recursive nested subtrees (the "bounds") */ map > subtrees; @@ -1234,7 +1237,7 @@ public: // == crap fns == public: void show_cache(); - void show_subtrees(int dbl=10); + void show_subtrees(int dbl=10, bool force_print=false); CInode *hack_pick_random_inode() { assert(!inode_map.empty());