From: Sage Weil Date: Tue, 24 May 2011 16:47:06 +0000 (-0700) Subject: osd: add ability to explicitly mark unfound as lost X-Git-Tag: v0.28.2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce04e3dbaf2383a521b267585a860f772c4cc786;p=ceph.git osd: add ability to explicitly mark unfound as lost 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 087c8e2bf65..5d6ca78a10a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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") {