]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: add mon_osd_max_initial_pgs to cap initial pool pgs
authorSage Weil <sage@redhat.com>
Mon, 9 Apr 2018 12:20:05 +0000 (07:20 -0500)
committerSage Weil <sage@redhat.com>
Fri, 7 Sep 2018 17:08:40 +0000 (12:08 -0500)
Configure how many initial PGs we create a pool with.  If the user wants
more than this then we do subsequent splits.

Default to 1024, so that pool creation works in the usual way for most users,
but does some splitting for very large pools/clusters.

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

index 938a942724481a43b5e482456676ab696dac4338..595497fc4269fc57a91b5681e58a5df75e70fb07 100644 (file)
@@ -1261,7 +1261,12 @@ std::vector<Option> get_global_options() {
 
     Option("mon_osd_max_creating_pgs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(1024)
-    .set_description(""),
+    .set_description("Maximum number of PGs the mon will create at once"),
+
+    Option("mon_osd_max_initial_pgs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    .set_default(1024)
+    .set_description("Maximum number of PGs a pool will created with")
+    .set_long_description("If the user specifies more PGs than this, the cluster will subsequently split PGs after the pool is created in order to reach the target."),
 
     Option("mon_tick_interval", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(5)
index aa1c5a4d01519fedd228e66c59fa7e4b8ffdad04..ce47155e78e5f1917b94139f1b3c0f0ccec41e3c 100644 (file)
@@ -6692,7 +6692,10 @@ int OSDMonitor::prepare_new_pool(string& name,
   pi->crush_rule = crush_rule;
   pi->expected_num_objects = expected_num_objects;
   pi->object_hash = CEPH_STR_HASH_RJENKINS;
-  pi->set_pg_num(1);
+  auto max = g_conf().get_val<int64_t>("mon_osd_max_initial_pgs");
+  pi->set_pg_num(
+    max > 0 ? std::min<uint64_t>(pg_num, std::max<int64_t>(1, max))
+    : pg_num);
   pi->set_pg_num_pending(pi->get_pg_num(), pending_inc.epoch);
   pi->set_pg_num_target(pg_num);
   pi->set_pgp_num(pi->get_pg_num());