]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: prime all pgs if we estimate we're approaching that anyway
authorSage Weil <sage@redhat.com>
Tue, 31 Jan 2017 20:04:31 +0000 (15:04 -0500)
committerSage Weil <sage@redhat.com>
Thu, 16 Feb 2017 17:04:08 +0000 (12:04 -0500)
If we have enough noteworthy OSDs it is likely we will touch all or most
PGs anyway, at which point it is faster and simpler to check all pgs.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc

index aeb58f7b19f11846a8a533d8d4701ff8c7544ff5..b903dcf177ff01ad5a5f2b68676adf48d9d80e40 100644 (file)
@@ -284,6 +284,7 @@ OPTION(mon_osd_allow_primary_temp, OPT_BOOL, false)  // allow primary_temp to be
 OPTION(mon_osd_allow_primary_affinity, OPT_BOOL, false)  // allow primary_affinity to be set in the osdmap
 OPTION(mon_osd_prime_pg_temp, OPT_BOOL, true)  // prime osdmap with pg mapping changes
 OPTION(mon_osd_prime_pg_temp_max_time, OPT_FLOAT, .5)  // max time to spend priming
+OPTION(mon_osd_prime_pg_temp_max_estimate, OPT_FLOAT, .25) // max estimate of pg total before we do all pgs in parallel
 OPTION(mon_osd_pool_ec_fast_read, OPT_BOOL, false) // whether turn on fast read on the pool or not
 OPTION(mon_stat_smooth_intervals, OPT_INT, 6)  // smooth stats over last N PGMap maps
 OPTION(mon_election_timeout, OPT_FLOAT, 5)  // on election proposer, max waiting time for all ACKs
index 16d1102ddc7b3cecf760aa970e338f23f6a7fa41..ee4b1e877f1dbcdb1dedbc9b96022051444580bc 100644 (file)
@@ -1014,6 +1014,23 @@ void OSDMonitor::maybe_prime_pg_temp()
   if (!all && osds.empty())
     return;
 
+  if (!all) {
+    unsigned estimate =
+      mapping->get_osd_acting_pgs(*osds.begin()).size() * osds.size();
+    if (estimate > mapping->get_num_pgs() *
+       g_conf->mon_osd_prime_pg_temp_max_estimate) {
+      dout(10) << __func__ << " estimate " << estimate << " pgs on "
+              << osds.size() << " osds >= "
+              << g_conf->mon_osd_prime_pg_temp_max_estimate << " of total "
+              << mapping->get_num_pgs() << " pgs, all"
+              << dendl;
+      all = true;
+    } else {
+      dout(10) << __func__ << " estimate " << estimate << " pgs on "
+              << osds.size() << " osds" << dendl;
+    }
+  }
+
   OSDMap next;
   next.deepish_copy_from(osdmap);
   next.apply_incremental(pending_inc);