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>
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)
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());