]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: only signal ready_to_merge if we have all replicas
authorSage Weil <sage@redhat.com>
Sat, 15 Sep 2018 19:40:18 +0000 (14:40 -0500)
committerSage Weil <sage@redhat.com>
Thu, 20 Sep 2018 13:35:15 +0000 (08:35 -0500)
Only signal we are ready to merge if all replicas are in good shape.  If
they aren't, do nothing (yet).

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc

index 34ebff9e5886a4e79db872bb6ecf7bc68d786ed9..b04b0cfa5a96d40f1b188ab865fe071cbeaab461 100644 (file)
@@ -2345,16 +2345,20 @@ void PG::try_mark_clean()
   if (is_active()) {
     kick_snap_trim();
   } else if (is_peered()) {
-    bool target;
-    if (pool.info.is_pending_merge(info.pgid.pgid, &target)) {
-      if (target) {
-       ldout(cct, 10) << "ready to merge (target)" << dendl;
-       osd->set_ready_to_merge_target(this,
-                                      info.history.last_epoch_clean);
-      } else {
-       ldout(cct, 10) << "ready to merge (source)" << dendl;
-       osd->set_ready_to_merge_source(this);
+    if (is_clean()) {
+      bool target;
+      if (pool.info.is_pending_merge(info.pgid.pgid, &target)) {
+       if (target) {
+         ldout(cct, 10) << "ready to merge (target)" << dendl;
+         osd->set_ready_to_merge_target(this,
+                                        info.history.last_epoch_clean);
+       } else {
+         ldout(cct, 10) << "ready to merge (source)" << dendl;
+         osd->set_ready_to_merge_source(this);
+       }
       }
+    } else {
+#warning we should back off the merge!
     }
   }