]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: make remove_redundant_pg_temp clear primary, too
authorGreg Farnum <greg@inktank.com>
Wed, 15 Jan 2014 23:24:38 +0000 (15:24 -0800)
committerGreg Farnum <greg@inktank.com>
Thu, 16 Jan 2014 00:33:06 +0000 (16:33 -0800)
So that this works with future CRUSH changes, we copy the map and clear
out the primary_temp, then compare its output with the real map's output. If
they match, remove the primary_temp from the real map.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/mon/OSDMonitor.cc

index 77d33a04bbeeb2ae887820d7fffe6d982ae4338e..c8623cd206ec1812da9c33721d82c03e177be299 100644 (file)
@@ -427,6 +427,26 @@ void OSDMonitor::remove_redundant_pg_temp()
       }
     }
   }
+  if (!osdmap.primary_temp->empty()) {
+    OSDMap templess(osdmap);
+    templess.primary_temp.reset(new map<pg_t,int>(*osdmap.primary_temp));
+    templess.primary_temp->clear();
+    for (map<pg_t,int>::iterator p = osdmap.primary_temp->begin();
+        p != osdmap.primary_temp->end();
+        ++p) {
+      if (pending_inc.new_primary_temp.count(p->first) == 0) {
+        vector<int> real_up, templess_up;
+        int real_primary, templess_primary;
+        osdmap.pg_to_acting_osds(p->first, &real_up, &real_primary);
+        templess.pg_to_acting_osds(p->first, &templess_up, &templess_primary);
+        if (real_primary == templess_primary){
+          dout(10) << " removing unnecessary primary_temp "
+              << p->first << " -> " << p->second << dendl;
+          pending_inc.new_primary_temp[p->first] = -1;
+        }
+      }
+    }
+  }
 }
 
 void OSDMonitor::remove_down_pg_temp()