]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Resetter: Check return values from Journaler.
authorGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 28 Jun 2011 19:37:29 +0000 (12:37 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 28 Jun 2011 19:37:48 +0000 (12:37 -0700)
And clean up the shutdown a bit.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mds/Resetter.cc

index db12ce0c15aece8ce02c36ac3ea88667f117a900..a10845cd95a010b75ec60b39392ad6dec1ce3835 100644 (file)
@@ -69,6 +69,8 @@ void Resetter::init(int rank)
 
 void Resetter::shutdown()
 {
+  messenger->shutdown();
+  messenger->wait();
   lock.Lock();
   timer.shutdown();
   lock.Unlock();
@@ -86,7 +88,18 @@ void Resetter::reset()
   while (!done)
     cond.Wait(lock);
   lock.Unlock();
-  assert(r == 0);
+  if (r != 0) {
+    if (r == -ENOENT) {
+      cerr << "journal does not exist on-disk. Did you set a bad rank?"
+          << std::endl;
+      shutdown();
+      return;
+    } else {
+      cerr << "got error " << r << "from Journaler, failling" << std::endl;
+      shutdown();
+      return;
+    }
+  }
 
   uint64_t old_start = journaler->get_read_pos();
   uint64_t old_end = journaler->get_write_pos();
@@ -129,7 +142,5 @@ void Resetter::reset()
 
   cout << "done" << std::endl;
 
-  messenger->shutdown();
-  messenger->wait();
   shutdown();
 }