]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: do not start mapping job on empty map
authorSage Weil <sage@redhat.com>
Sat, 24 Jun 2017 03:54:09 +0000 (23:54 -0400)
committerSage Weil <sage@redhat.com>
Wed, 28 Jun 2017 14:52:49 +0000 (10:52 -0400)
The Mapper doesn't do the completion.  Just avoid it in the caller instead
of adding a Finisher or something similarly annoying for the completion.

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

index 85e0c32c88cf3be8095c33507890a1fa773f68c7..fa6acc42237e289e40a395e0c1c0f9926901be82 100644 (file)
@@ -494,12 +494,17 @@ void OSDMonitor::start_mapping()
             << dendl;
     mapping_job->abort();
   }
-  auto fin = new C_UpdateCreatingPGs(this, osdmap.get_epoch());
-  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 (!osdmap.get_pools().empty()) {
+    auto fin = new C_UpdateCreatingPGs(this, osdmap.get_epoch());
+    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);
+  } else {
+    dout(10) << __func__ << " no pools, no mapping job" << dendl;
+    mapping_job = nullptr;
+  }
 }
 
 void OSDMonitor::update_msgr_features()
@@ -794,7 +799,9 @@ void OSDMonitor::maybe_prime_pg_temp()
   next.deepish_copy_from(osdmap);
   next.apply_incremental(pending_inc);
 
-  if (all) {
+  if (next.get_pools().empty()) {
+    dout(10) << __func__ << " no pools, no pg_temp priming" << dendl;
+  } else if (all) {
     PrimeTempJob job(next, this);
     mapper.queue(&job, g_conf->mon_osd_mapping_pgs_per_chunk);
     if (job.wait_for(g_conf->mon_osd_prime_pg_temp_max_time)) {
index 14165a156dc0a5e382cf53e2d879d3239b7301f1..bf9f4f99c38b0f4a35f94164c60809835e9d7514 100644 (file)
@@ -157,6 +157,7 @@ void ParallelPGMapper::queue(
   Job *job,
   unsigned pgs_per_item)
 {
+  bool any = false;
   for (auto& p : job->osdmap->get_pools()) {
     for (unsigned ps = 0; ps < p.second.get_pg_num(); ps += pgs_per_item) {
       unsigned ps_end = MIN(ps + pgs_per_item, p.second.get_pg_num());
@@ -164,6 +165,8 @@ void ParallelPGMapper::queue(
       wq.queue(new Item(job, p.first, ps, ps_end));
       ldout(cct, 20) << __func__ << " " << job << " " << p.first << " [" << ps
                     << "," << ps_end << ")" << dendl;
+      any = true;
     }
   }
+  assert(any);
 }