]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/RecoveryQueue: do not start prioritized items synchronously 2258/head
authorSage Weil <sage@redhat.com>
Fri, 29 Aug 2014 15:29:35 +0000 (08:29 -0700)
committerSage Weil <sage@redhat.com>
Fri, 29 Aug 2014 15:29:35 +0000 (08:29 -0700)
When we prioritize an item move it into a second priority list/set, but
do not start immediately, so that we still obey the max.  When we go to
start an item, pull items first off the priority list, then off the regular
list.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mds/RecoveryQueue.cc
src/mds/RecoveryQueue.h

index 90ae65edf8e8c40f253234b5f7d2a447c2eb7836..f811c2c88fefc7ef0c6c5d2dce9b6b249d01740c 100644 (file)
@@ -54,18 +54,27 @@ public:
 void RecoveryQueue::advance()
 {
   dout(10) << file_recover_queue.size() << " queued, "
+          << file_recover_queue_front.size() << " prioritized, "
           << file_recovering.size() << " recovering" << dendl;
 
-  while (file_recovering.size() < g_conf->mds_max_file_recover &&
-        !file_recover_queue.empty()) {
-    _start(*file_recover_queue.begin());
+  while (file_recovering.size() < g_conf->mds_max_file_recover) {
+    if (!file_recover_queue_front.empty()) {
+      CInode *in = *file_recover_queue_front.begin();
+      file_recover_queue_front.erase(file_recover_queue_front.begin());
+      file_recover_queue.erase(in);
+      _start(in);
+    } else if (!file_recover_queue.empty()) {
+      CInode *in = *file_recover_queue.begin();
+      file_recover_queue.erase(file_recover_queue.begin());
+      _start(in);
+    } else {
+      break;
+    }
   }
 }
 
 void RecoveryQueue::_start(CInode *in)
 {
-  file_recover_queue.erase(in);
-
   inode_t *pi = in->get_projected_inode();
 
   // blech
@@ -100,7 +109,7 @@ void RecoveryQueue::prioritize(CInode *in)
 
   if (file_recover_queue.count(in)) {
     dout(20) << *in << dendl;
-    _start(in);
+    file_recover_queue_front.insert(in);
     return;
   }
 
index 41b2dcf0fedbf03d8865de14bd3f9f28d944f198..18058f08b28948a59a5f777f2bd572e58480b4df 100644 (file)
@@ -32,7 +32,8 @@ public:
 private:
   void _start(CInode *in);  ///< start recovering this file
 
-  std::set<CInode*> file_recover_queue;
+  std::set<CInode*> file_recover_queue;   ///< the queue
+  std::set<CInode*> file_recover_queue_front;  ///< elevated priority items
   std::set<CInode*> file_recovering;
   void _recovered(CInode *in, int r, uint64_t size, utime_t mtime);
   MDS *mds;