]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PrimaryLogPG: s/list_missing/list_unfound/
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 23 Aug 2018 06:29:01 +0000 (14:29 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 6 Sep 2018 01:52:20 +0000 (09:52 +0800)
Also:
- Do not print **offset** until specified
- Count missing objects correctly (used to be primary's local missing)

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
PendingReleaseNotes
doc/rados/troubleshooting/troubleshooting-pg.rst
qa/standalone/erasure-code/test-erasure-eio.sh
qa/standalone/osd/osd-rep-recov-eio.sh
qa/standalone/scrub/osd-scrub-repair.sh
qa/tasks/ceph_manager.py
qa/tasks/ec_lost_unfound.py
qa/tasks/lost_unfound.py
qa/tasks/rep_lost_unfound_delete.py
src/osd/OSD.cc
src/osd/PrimaryLogPG.cc

index bf44d58872200942412786c4a435421d0e814ca2..11e286a5fdb4327accde84c7f146a866dddd562d 100644 (file)
@@ -8,6 +8,9 @@
 * Nautilus is not supported on any distros still running upstart so upstart
   specific files and references have been removed.
 
+* The 'ceph pg <pgid> list_missing' command has been renamed to
+  'ceph pg <pgid> list_unfound' to better match its behaviour.
+
 >=13.1.0
 --------
 
index 467f5ce7308637f311d8556771e34a753f45b89b..a11b972f50fd20877af29c8eb0676fa035987c1c 100644 (file)
@@ -213,7 +213,7 @@ assumed to be preferable to returning an IO error to the user.
 
 First, you can identify which objects are unfound with::
 
-       ceph pg 2.4 list_missing [starting offset, in json]
+       ceph pg 2.4 list_unfound [starting offset, in json]
 
 .. code-block:: javascript
 
index a37258b2fd86327fa4049efb398ebc26284f6d22..a75b6097f853a6ff9b84ae83de7521b8ba665690 100755 (executable)
@@ -558,7 +558,7 @@ function TEST_ec_backfill_unfound() {
     done
 
     ceph pg dump pgs
-    ceph pg 2.0 list_missing | grep -q $testobj || return 1
+    ceph pg 2.0 list_unfound | grep -q $testobj || return 1
 
     # Command should hang because object is unfound
     timeout 5 rados -p $poolname get $testobj $dir/CHECK
@@ -638,7 +638,7 @@ function TEST_ec_recovery_unfound() {
     done
 
     ceph pg dump pgs
-    ceph pg 2.0 list_missing | grep -q $testobj || return 1
+    ceph pg 2.0 list_unfound | grep -q $testobj || return 1
 
     # Command should hang because object is unfound
     timeout 5 rados -p $poolname get $testobj $dir/CHECK
index e286a79b32a8c805f3d663ba47b418ebdcfebee9..cc86b77052a75a2bf188d052a72e2f100fcb039d 100755 (executable)
@@ -189,7 +189,7 @@ function TEST_rep_backfill_unfound() {
     done
 
     ceph pg dump pgs
-    ceph pg 2.0 list_missing | grep -q $testobj || return 1
+    ceph pg 2.0 list_unfound | grep -q $testobj || return 1
 
     # Command should hang because object is unfound
     timeout 5 rados -p $poolname get $testobj $dir/CHECK
@@ -266,7 +266,7 @@ function TEST_rep_recovery_unfound() {
     done
 
     ceph pg dump pgs
-    ceph pg 2.0 list_missing | grep -q $testobj || return 1
+    ceph pg 2.0 list_unfound | grep -q $testobj || return 1
 
     # Command should hang because object is unfound
     timeout 5 rados -p $poolname get $testobj $dir/CHECK
index a2a1333eb48571a1a8e3df703ae3f132a0eef73b..4981edf8f6812fe30c5f4a31b7405d985938303e 100755 (executable)
@@ -466,7 +466,7 @@ function list_missing_erasure_coded() {
 
     for i in $(seq 0 120) ; do
         [ $i -lt 60 ] || return 1
-        matches=$(ceph pg $pg list_missing | egrep "MOBJ0|MOBJ1" | wc -l)
+        matches=$(ceph pg $pg list_unfound | egrep "MOBJ0|MOBJ1" | wc -l)
         [ $matches -eq 2 ] && break
     done
 
index 855124567e98a5fdd60f0da650934004ddc9f4ea..6be5044d8f45f14278937accc518bd711b94dc1a 100644 (file)
@@ -1756,14 +1756,14 @@ class CephManager:
             self.set_pool_property(pool_name, 'pgp_num', self.pools[pool_name])
             return True
 
-    def list_pg_missing(self, pgid):
+    def list_pg_unfound(self, pgid):
         """
-        return list of missing pgs with the id specified
+        return list of unfound pgs with the id specified
         """
         r = None
         offset = {}
         while True:
-            out = self.raw_cluster_cmd('--', 'pg', pgid, 'list_missing',
+            out = self.raw_cluster_cmd('--', 'pg', pgid, 'list_unfound',
                                        json.dumps(offset))
             j = json.loads(out)
             if r is None:
index cc0bdb25850d2cf5ed1344b6098ac24a9f4d38b9..2412cbd583acca87f86a26680184ea8f86b5641d 100644 (file)
@@ -123,7 +123,7 @@ def task(ctx, config):
             # verify that i can list them direct from the osd
             log.info('listing missing/lost in %s state %s', pg['pgid'],
                      pg['state']);
-            m = manager.list_pg_missing(pg['pgid'])
+            m = manager.list_pg_unfound(pg['pgid'])
             log.info('%s' % m)
             assert m['num_unfound'] == pg['stat_sum']['num_objects_unfound']
 
index 64872743b25f7346af4c010e0182ce9b86dbf024..c50082863d7f14917d25d4320c9512550e01308e 100644 (file)
@@ -139,7 +139,7 @@ def task(ctx, config):
             # verify that i can list them direct from the osd
             log.info('listing missing/lost in %s state %s', pg['pgid'],
                      pg['state']);
-            m = manager.list_pg_missing(pg['pgid'])
+            m = manager.list_pg_unfound(pg['pgid'])
             #log.info('%s' % m)
             assert m['num_unfound'] == pg['stat_sum']['num_objects_unfound']
             num_unfound=0
index d24360083861f4349af19e714d16bc858ddf0cd6..6051c0720c1ff4e92d7b2985859d5e420becfe13 100644 (file)
@@ -139,7 +139,7 @@ def task(ctx, config):
             # verify that i can list them direct from the osd
             log.info('listing missing/lost in %s state %s', pg['pgid'],
                      pg['state']);
-            m = manager.list_pg_missing(pg['pgid'])
+            m = manager.list_pg_unfound(pg['pgid'])
             #log.info('%s' % m)
             assert m['num_unfound'] == pg['stat_sum']['num_objects_unfound']
             num_unfound=0
index e684898fd431973591320ccfa9b0af40df2b7c37..3680e4ddd88172a7003b1c3a43637195e0fc55d3 100644 (file)
@@ -5731,9 +5731,9 @@ COMMAND("pg " \
        "osd", "rw", "cli")
 COMMAND("pg " \
        "name=pgid,type=CephPgid " \
-       "name=cmd,type=CephChoices,strings=list_missing " \
+       "name=cmd,type=CephChoices,strings=list_unfound " \
        "name=offset,type=CephString,req=false",
-       "list missing objects on this pg, perhaps starting at an offset given in JSON",
+       "list unfound objects on this pg, perhaps starting at an offset given in JSON",
        "osd", "r", "cli")
 
 // new form: tell <pgid> <cmd> for both cli and rest
@@ -5744,9 +5744,9 @@ COMMAND("mark_unfound_lost " \
        "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 " \
+COMMAND("list_unfound " \
        "name=offset,type=CephString,req=false",
-       "list missing objects on this pg, perhaps starting at an offset given in JSON",
+       "list unfound objects on this pg, perhaps starting at an offset given in JSON",
        "osd", "r", "cli,rest")
 COMMAND("perf histogram dump "
         "name=logger,type=CephString,req=false "
@@ -5979,7 +5979,7 @@ int OSD::_do_command(
   else if (prefix == "pg" ||
            prefix == "query" ||
            prefix == "mark_unfound_lost" ||
-           prefix == "list_missing"
+           prefix == "list_unfound"
           ) {
     pg_t pgid;
 
index c81562fc405d556384d608ab25e9c72c0890e829..103ec116c58a385d1c6e149ca548ff761241c6d1 100644 (file)
@@ -991,7 +991,6 @@ int PrimaryLogPG::do_command(
   ConnectionRef con,
   ceph_tid_t tid)
 {
-  const auto &missing = pg_log.get_missing();
   string prefix;
   string format;
 
@@ -1106,9 +1105,10 @@ int PrimaryLogPG::do_command(
     mark_all_unfound_lost(mode, con, tid);
     return -EAGAIN;
   }
-  else if (command == "list_missing") {
+  else if (command == "list_unfound") {
     hobject_t offset;
     string offset_json;
+    bool show_offset = false;
     if (cmd_getval(cct, cmdmap, "offset", offset_json)) {
       json_spirit::Value v;
       try {
@@ -1119,17 +1119,17 @@ int PrimaryLogPG::do_command(
        ss << "error parsing offset: " << e.what();
        return -EINVAL;
       }
+      show_offset = true;
     }
     f->open_object_section("missing");
-    {
+    if (show_offset) {
       f->open_object_section("offset");
       offset.dump(f.get());
       f->close_section();
     }
-    f->dump_int("num_missing", missing.num_missing());
+    auto &needs_recovery_map = missing_loc.get_needs_recovery();
+    f->dump_int("num_missing", needs_recovery_map.size());
     f->dump_int("num_unfound", get_num_unfound());
-    const map<hobject_t, pg_missing_item> &needs_recovery_map =
-      missing_loc.get_needs_recovery();
     map<hobject_t, pg_missing_item>::const_iterator p =
       needs_recovery_map.upper_bound(offset);
     {