]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: create purge queue if it's not found
authorJohn Spray <john.spray@redhat.com>
Sun, 25 Dec 2016 16:45:09 +0000 (16:45 +0000)
committerJohn Spray <john.spray@redhat.com>
Wed, 8 Mar 2017 10:26:59 +0000 (10:26 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
qa/tasks/cephfs/test_strays.py
src/mds/PurgeQueue.cc

index 24d8c9715e46af1e5bf437e8960afc2643f23463..4484f8d8cee477109e72bf794faa3112d18ec71f 100644 (file)
@@ -881,3 +881,16 @@ class TestStrays(CephFSTestCase):
         path=self.mount_a.mountpoint,
         file_count=LOW_LIMIT
         )))
+
+    def test_purge_queue_upgrade(self):
+        """
+        That when starting on a system with no purge queue in the metadata
+        pool, we silently create one.
+        :return:
+        """
+
+        self.mds_cluster.mds_stop()
+        self.mds_cluster.mds_fail()
+        self.fs.rados(["rm", "500.00000000"])
+        self.mds_cluster.mds_restart()
+        self.fs.wait_for_daemons()
\ No newline at end of file
index 7e57eabc7fa81bc23c2d75a1f561b5c65af96274..5249073dfa8c23cbcf69ff6a6dc3b75c26d19033 100644 (file)
@@ -54,8 +54,6 @@ void PurgeItem::decode(bufferlist::iterator &p)
   DECODE_FINISH(p);
 }
 
-// TODO: implement purge queue creation on startup
-// if we are on a filesystem created before purge queues existed
 // TODO: when we're deactivating, lift all limits on
 // how many OSD ops we're allowed to emit at a time to
 // race through the queue as fast as we can.
@@ -128,12 +126,18 @@ void PurgeQueue::open(Context *completion)
   Mutex::Locker l(lock);
 
   journaler.recover(new FunctionContext([this, completion](int r){
-    Mutex::Locker l(lock);
-    dout(4) << "open complete" << dendl;
-    if (r == 0) {
-      journaler.set_writeable();
+    if (r == -ENOENT) {
+      dout(1) << "Purge Queue not found, assuming this is an upgrade and "
+                 "creating it." << dendl;
+      create(completion);
+    } else {
+      Mutex::Locker l(lock);
+      dout(4) << "open complete" << dendl;
+      if (r == 0) {
+        journaler.set_writeable();
+      }
+      completion->complete(r);
     }
-    completion->complete(r);
   }));
 }