From 245923e704ac3a6262499f26c7a879811edea5b4 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 22 Apr 2014 12:45:28 -0700 Subject: [PATCH] ReplicatedPG: enable mark_unfound_lost delete for ec pools revert is tricky to implement at this time for ec pools, so we'll instead just implement delete for ec pools. Fixes: #7439 Signed-off-by: Samuel Just --- src/osd/OSD.cc | 4 ++-- src/osd/ReplicatedPG.cc | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 4b9f3a36946ca..9b921f08eef90 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4123,7 +4123,7 @@ COMMAND("pg " \ COMMAND("pg " \ "name=pgid,type=CephPgid " \ "name=cmd,type=CephChoices,strings=mark_unfound_lost " \ - "name=mulcmd,type=CephChoices,strings=revert", \ + "name=mulcmd,type=CephChoices,strings=revert|delete", \ "mark all unfound objects in this pg as lost, either removing or reverting to a prior version if one is available", "osd", "rw", "cli") COMMAND("pg " \ @@ -4138,7 +4138,7 @@ COMMAND("pg " \ COMMAND("query", "show details of a specific pg", "osd", "r", "cli,rest") COMMAND("mark_unfound_lost " \ - "name=mulcmd,type=CephChoices,strings=revert", \ + "name=mulcmd,type=CephChoices,strings=revert|delete", \ "mark all unfound objects in this pg as lost, either removing or reverting to a prior version if one is available", "osd", "rw", "cli,rest") COMMAND("list_missing " \ diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index f99b3070a8bf6..c6a8d3e7f6830 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -628,11 +628,21 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, else if (command == "mark_unfound_lost") { string mulcmd; cmd_getval(cct, cmdmap, "mulcmd", mulcmd); - if (mulcmd != "revert") { - ss << "mode must be 'revert'; mark and delete not yet implemented"; + int mode = -1; + if (mulcmd == "revert") { + if (pool.info.ec_pool()) { + ss << "mode must be 'delete' for ec pool"; + return -EINVAL; + } + mode = pg_log_entry_t::LOST_REVERT; + } else if (mulcmd == "delete") { + mode = pg_log_entry_t::LOST_DELETE; + } else { + ss << "mode must be 'revert' or 'delete'; mark not yet implemented"; return -EINVAL; } - int mode = pg_log_entry_t::LOST_REVERT; + assert(mode == pg_log_entry_t::LOST_REVERT || + mode == pg_log_entry_t::LOST_DELETE); if (!is_primary()) { ss << "not primary"; @@ -651,7 +661,8 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, return -EINVAL; } - ss << "pg has " << unfound << " objects unfound and apparently lost, marking"; + ss << "pg has " << unfound + << " objects unfound and apparently lost, marking"; mark_all_unfound_lost(mode); return 0; } -- 2.39.5