]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PG: avoid updating missing_loc_sources multiple times
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 9 Oct 2017 07:53:53 +0000 (15:53 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 9 Oct 2017 07:53:53 +0000 (15:53 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/PG.cc

index 3adc0660e34108f9a3cd4d29b855a995d5965c30..89c895e0d676d84e7665575326f547371bd8284b 100644 (file)
@@ -598,6 +598,7 @@ void PG::MissingLoc::add_batch_sources_info(
   ldout(pg->cct, 10) << __func__ << ": adding sources in batch "
                     << sources.size() << dendl;
   unsigned loop = 0;
+  bool sources_updated = false;
   for (map<hobject_t, pg_missing_item>::const_iterator i = needs_recovery_map.begin();
       i != needs_recovery_map.end();
       ++i) {
@@ -608,7 +609,10 @@ void PG::MissingLoc::add_batch_sources_info(
     if (i->second.is_delete())
       continue;
     missing_loc[i->first].insert(sources.begin(), sources.end());
-    missing_loc_sources.insert(sources.begin(), sources.end());
+    if (!sources_updated) {
+      missing_loc_sources.insert(sources.begin(), sources.end());
+      sources_updated = true;
+    }
   }
 }
 
@@ -620,6 +624,7 @@ bool PG::MissingLoc::add_source_info(
 {
   bool found_missing = false;
   unsigned loop = 0;
+  bool sources_updated = false;
   // found items?
   for (map<hobject_t,pg_missing_item>::const_iterator p = needs_recovery_map.begin();
        p != needs_recovery_map.end();
@@ -673,7 +678,10 @@ bool PG::MissingLoc::add_source_info(
                       << " is on osd." << fromosd << dendl;
 
     missing_loc[soid].insert(fromosd);
-    missing_loc_sources.insert(fromosd);
+    if (!sources_updated) {
+      missing_loc_sources.insert(fromosd);
+      sources_updated = true;
+    }
     found_missing = true;
   }