]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: handle deletes in MissingLoc
authorJosh Durgin <jdurgin@redhat.com>
Mon, 26 Jun 2017 22:14:02 +0000 (18:14 -0400)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 17 Jul 2017 06:00:35 +0000 (02:00 -0400)
There's no source needed for deleting an object, so don't keep track
of this. Update is_readable_with_acting/is_unfound, and add an
is_deleted() method to be used later.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index ce3f52e9cab35bede4fdd6e6aaf8b0804c683d01..168ed276d03f085587ec333672e6218dc245103b 100644 (file)
@@ -574,9 +574,13 @@ bool PG::search_for_missing(
 bool PG::MissingLoc::readable_with_acting(
   const hobject_t &hoid,
   const set<pg_shard_t> &acting) const {
-  if (!needs_recovery(hoid)) return true;
+  if (!needs_recovery(hoid))
+    return true;
+  if (is_deleted(hoid))
+    return false;
   auto missing_loc_entry = missing_loc.find(hoid);
-  if (missing_loc_entry == missing_loc.end()) return false;
+  if (missing_loc_entry == missing_loc.end())
+    return false;
   const set<pg_shard_t> &locs = missing_loc_entry->second;
   ldout(pg->cct, 10) << __func__ << ": locs:" << locs << dendl;
   set<pg_shard_t> have_acting;
@@ -602,6 +606,8 @@ void PG::MissingLoc::add_batch_sources_info(
       handle->reset_tp_timeout();
       loop = 0;
     }
+    if (i->second.is_delete())
+      continue;
     missing_loc[i->first].insert(sources.begin(), sources.end());
     missing_loc_sources.insert(sources.begin(), sources.end());
   }
@@ -625,6 +631,12 @@ bool PG::MissingLoc::add_source_info(
       handle->reset_tp_timeout();
       loop = 0;
     }
+    if (p->second.is_delete()) {
+      ldout(pg->cct, 10) << __func__ << " " << soid
+                        << " delete, ignoring source" << dendl;
+      found_missing = true;
+      continue;
+    }
     if (oinfo.last_update < need) {
       ldout(pg->cct, 10) << "search_for_missing " << soid << " " << need
                         << " also missing on osd." << fromosd
@@ -1755,6 +1767,7 @@ void PG::activate(ObjectStore::Transaction& t,
     for (set<pg_shard_t>::iterator i = actingbackfill.begin();
         i != actingbackfill.end();
         ++i) {
+      dout(20) << __func__ << " setting up missing_loc from shard " << *i << " " << dendl;
       if (*i == get_primary()) {
        missing_loc.add_active_missing(missing);
         if (!missing.have_missing())
@@ -4147,7 +4160,7 @@ void PG::repair_object(
     assert(0);
   }
   if (bad_peer != primary) {
-    peer_missing[bad_peer].add(soid, oi.version, eversion_t());
+    peer_missing[bad_peer].add(soid, oi.version, eversion_t(), false);
   } else {
     // We should only be scrubbing if the PG is clean.
     assert(waiting_for_unreadable_object.empty());
index a033763b4f9d1ed81cda841fbca24b23b4c2131d..b6316e496e6598adafe4fa95aff0c3987da06aa6 100644 (file)
@@ -403,8 +403,14 @@ public:
        *v = i->second.need;
       return true;
     }
+    bool is_deleted(const hobject_t &hoid) const {
+      auto i = needs_recovery_map.find(hoid);
+      if (i == needs_recovery_map.end())
+       return false;
+      return i->second.is_delete();
+    }
     bool is_unfound(const hobject_t &hoid) const {
-      return needs_recovery(hoid) && (
+      return needs_recovery(hoid) && !is_deleted(hoid) && (
        !missing_loc.count(hoid) ||
        !(*is_recoverable)(missing_loc.find(hoid)->second));
     }
@@ -455,6 +461,9 @@ public:
        if (j == needs_recovery_map.end()) {
          needs_recovery_map.insert(*i);
        } else {
+         lgeneric_dout(pg->cct, 0) << this << " " << pg->info.pgid << " unexpected need for "
+                                   << i->first << " have " << j->second
+                                   << " tried to add " << i->second << dendl;
          assert(i->second.need == j->second.need);
        }
       }
@@ -522,6 +531,8 @@ public:
        return; // recovered!
 
       needs_recovery_map[hoid] = *item;
+      if (item->is_delete())
+       return;
       auto mliter =
        missing_loc.insert(make_pair(hoid, set<pg_shard_t>())).first;
       assert(info.last_backfill.is_max());