mds: create purge queue if it's not found

Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2016-12-25 16:45:09 +00:00
parent f826c7e8aa
commit 3e66de2182
2 changed files with 24 additions and 7 deletions

View File

@ -881,3 +881,16 @@ class TestStrays(CephFSTestCase):
path=self.mount_a.mountpoint, path=self.mount_a.mountpoint,
file_count=LOW_LIMIT 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()

View File

@ -54,8 +54,6 @@ void PurgeItem::decode(bufferlist::iterator &p)
DECODE_FINISH(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 // TODO: when we're deactivating, lift all limits on
// how many OSD ops we're allowed to emit at a time to // how many OSD ops we're allowed to emit at a time to
// race through the queue as fast as we can. // race through the queue as fast as we can.
@ -128,12 +126,18 @@ void PurgeQueue::open(Context *completion)
Mutex::Locker l(lock); Mutex::Locker l(lock);
journaler.recover(new FunctionContext([this, completion](int r){ journaler.recover(new FunctionContext([this, completion](int r){
Mutex::Locker l(lock); if (r == -ENOENT) {
dout(4) << "open complete" << dendl; dout(1) << "Purge Queue not found, assuming this is an upgrade and "
if (r == 0) { "creating it." << dendl;
journaler.set_writeable(); create(completion);
} else {
Mutex::Locker l(lock);
dout(4) << "open complete" << dendl;
if (r == 0) {
journaler.set_writeable();
}
completion->complete(r);
} }
completion->complete(r);
})); }));
} }