]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add ability to explicitly mark unfound as lost
authorSage Weil <sage@newdream.net>
Tue, 24 May 2011 16:47:06 +0000 (09:47 -0700)
committerSage Weil <sage@newdream.net>
Tue, 24 May 2011 16:47:06 +0000 (09:47 -0700)
Instead of automatically marking unfound objects lost (once we've tried
every location we can think of), do it when the administator explicitly
says to.  This avoids marking things wrong incorrectly when there are
peering issues, and also allows the administrator to decide whether there
may be offline osds that are worth bringing online.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/OSD.cc

index 087c8e2bf655bd90e218c47b51e23eee27973991..5d6ca78a10ae59b744a62074508ae7f8c0fbbda1 100644 (file)
@@ -2266,6 +2266,35 @@ void OSD::handle_command(MMonCommand *m)
        << " in blocks of " << prettybyte_t(bsize) << " in "
        << (end-start) << " sec at " << prettybyte_t(rate) << "/sec\n";
     
+  } else if (m->cmd.size() == 2 && m->cmd[0] == "mark_unfound_lost") {
+    pg_t pgid;
+    if (pgid.parse(m->cmd[1].c_str())) {
+      PG *pg = _lookup_lock_pg(pgid);
+      if (pg) {
+       if (pg->is_primary()) {
+         int unfound = pg->missing.num_missing() - pg->missing_loc.size();
+         if (unfound) {
+           if (pg->all_unfound_are_lost(pg->osd->osdmap)) {
+             clog.error() << pgid << " has " << unfound
+                          << " objects unfound and apparently lost, marking\n";
+             ObjectStore::Transaction *t = new ObjectStore::Transaction;
+             pg->mark_all_unfound_as_lost(*t);
+             store->queue_transaction(&pg->osr, t);
+           } else
+             clog.error() << "pg " << pgid << " has " << unfound
+                          << " objects but we haven't probed all sources, not marking lost despite command "
+                          << m->cmd << "\n";
+         } else
+           clog.error() << "pg " << pgid << " has no unfound objects for command " << m->cmd << "\n";
+       } else
+         clog.error() << "not primary for pg " << pgid << "; acting is " << pg->acting << "\n";
+       pg->unlock();
+      } else
+       clog.error() << "pg " << pgid << " not found\n";
+    } else {
+      clog.error() << "cannot parse pgid from command '" << m->cmd << "'\n";
+
+    }
   } else if (m->cmd.size() == 2 && m->cmd[0] == "logger" && m->cmd[1] == "reset") {
     logger_reset_all();
   } else if (m->cmd.size() == 2 && m->cmd[0] == "logger" && m->cmd[1] == "reopen") {