]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: enable mark_unfound_lost delete for ec pools
authorSamuel Just <sam.just@inktank.com>
Tue, 22 Apr 2014 19:45:28 +0000 (12:45 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 22 Apr 2014 20:37:20 +0000 (13:37 -0700)
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 <sam.just@inktank.com>
src/osd/OSD.cc
src/osd/ReplicatedPG.cc

index 4b9f3a36946caf446c11745f03b03466dc7ae6b6..9b921f08eef905642d2f086b5e235d228c8cfc73 100644 (file)
@@ -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 " \
index f99b3070a8bf61b99ede6c2698abc48cd346bff8..c6a8d3e7f6830426a7be81f5f9c4f14b26377c47 100644 (file)
@@ -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;
   }