]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/OpenFileTable: add option that disables dirfrags prefetch 36089/head
authorYan, Zheng <zyan@redhat.com>
Mon, 13 Jul 2020 02:50:27 +0000 (10:50 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 25 Aug 2020 00:39:56 +0000 (08:39 +0800)
Dirfrags prefetch may speedup rejoin stage of mds recovery. But it may
use lots of memory and cause mds out of memory.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/common/options.cc
src/mds/OpenFileTable.cc

index d00414625f52a082644c5d76c08bccfd94828591..1975f779fb76840ceb10abe105a53da62edbfc1a 100644 (file)
@@ -8144,6 +8144,11 @@ std::vector<Option> get_mds_options() {
     .set_default(10.0)
     .set_description("rate of decay for export targets communicated to clients"),
 
+    Option("mds_oft_prefetch_dirfrags", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+    .set_default(true)
+    .set_description("prefetch dirfrags recorded in open file table on startup")
+    .set_flag(Option::FLAG_STARTUP),
+
     Option("mds_replay_interval", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
     .set_default(1.0)
     .set_description("time in seconds between replay of updates to journal by standby replay MDS"),
index 01b25dc9e8b21c8b4663b7fed32a50ca40cdcda3..930b4d88d6a504e1a67e190fac15ec564180dfe5 100644 (file)
@@ -1028,8 +1028,13 @@ void OpenFileTable::_open_ino_finish(inodeno_t ino, int r)
   num_opening_inodes--;
   if (num_opening_inodes == 0) {
     if (prefetch_state == DIR_INODES)  {
-      prefetch_state = DIRFRAGS;
-      _prefetch_dirfrags();
+      if (g_conf().get_val<bool>("mds_oft_prefetch_dirfrags")) {
+       prefetch_state = DIRFRAGS;
+       _prefetch_dirfrags();
+      } else {
+       prefetch_state = FILE_INODES;
+       _prefetch_inodes();
+      }
     } else if (prefetch_state == FILE_INODES) {
       prefetch_state = DONE;
       logseg_destroyed_inos.clear();