]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make mapping job behave if mon_osd_prime_pg_temp = false 13574/head
authorSage Weil <sage@redhat.com>
Wed, 22 Feb 2017 23:05:43 +0000 (18:05 -0500)
committerSage Weil <sage@redhat.com>
Wed, 22 Feb 2017 23:05:43 +0000 (18:05 -0500)
Make this robust to changes online too, so that we clean up a mapping
job that was started, but only use it or start a new one if the
option is true.

Fixes: http://tracker.ceph.com/issues/19020
Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 79a74a0f1f217bb74a873a66eeddab4b9e3ef1a7..d116c9978453a089cbf284b085d13cf5cccc35de 100644 (file)
@@ -380,13 +380,15 @@ void OSDMonitor::on_active()
             << dendl;
     mapping_job->abort();
   }
-  C_PrintTime *fin = new C_PrintTime(osdmap.get_epoch());
-  mapping.reset(new OSDMapMapping);
-  mapping_job = mapping->start_update(osdmap, mapper,
-                                     g_conf->mon_osd_mapping_pgs_per_chunk);
-  dout(10) << __func__ << " started mapping job " << mapping_job.get()
-          << " at " << fin->start << dendl;
-  mapping_job->set_finish_event(fin);
+  if (g_conf->mon_osd_prime_pg_temp) {
+    C_PrintTime *fin = new C_PrintTime(osdmap.get_epoch());
+    mapping.reset(new OSDMapMapping);
+    mapping_job = mapping->start_update(osdmap, mapper,
+                                       g_conf->mon_osd_mapping_pgs_per_chunk);
+    dout(10) << __func__ << " started mapping job " << mapping_job.get()
+            << " at " << fin->start << dendl;
+    mapping_job->set_finish_event(fin);
+  }
 }
 
 void OSDMonitor::on_shutdown()
@@ -1127,24 +1129,24 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   int r = pending_inc.propagate_snaps_to_tiers(g_ceph_context, osdmap);
   assert(r == 0);
 
-  if (g_conf->mon_osd_prime_pg_temp) {
-    if (mapping && mapping_job) {
-      if (!mapping_job->is_done()) {
-       dout(1) << __func__ << " skipping prime_pg_temp; mapping job "
-               << mapping_job.get() << " did not complete, "
-               << mapping_job->shards << " left" << dendl;
-       mapping_job->abort();
-      } else if (mapping->get_epoch() == osdmap.get_epoch()) {
-       dout(1) << __func__ << " skipping prime_pg_temp; mapping job "
-               << mapping_job.get() << " is prior epoch "
-               << mapping->get_epoch() << dendl;
-      } else {
+  if (mapping && mapping_job) {
+    if (!mapping_job->is_done()) {
+      dout(1) << __func__ << " skipping prime_pg_temp; mapping job "
+             << mapping_job.get() << " did not complete, "
+             << mapping_job->shards << " left" << dendl;
+      mapping_job->abort();
+    } else if (mapping->get_epoch() == osdmap.get_epoch()) {
+      dout(1) << __func__ << " skipping prime_pg_temp; mapping job "
+             << mapping_job.get() << " is prior epoch "
+             << mapping->get_epoch() << dendl;
+    } else {
+      if (g_conf->mon_osd_prime_pg_temp) {
        maybe_prime_pg_temp();
       }
-    } else {
-      dout(1) << __func__ << " skipping prime_pg_temp; mapping job did not start"
-             << dendl;
-    }
+    } 
+  } else if (g_conf->mon_osd_prime_pg_temp) {
+    dout(1) << __func__ << " skipping prime_pg_temp; mapping job did not start"
+           << dendl;
   }
   mapping_job.reset();