]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: limit changes to pg_num
authorSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 23:18:31 +0000 (18:18 -0500)
committerNeha Ojha <nojha@redhat.com>
Wed, 16 Feb 2022 17:20:47 +0000 (17:20 +0000)
We need to avoid making drastic changes to pg_num that outpace pgp_num or
else we will may hit the per-osd pg limits.

Fixes: https://tracker.ceph.com/issues/53442
Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 3b2a11249aff6ee608efc95212d6723df180cd07)

 Conflicts:
src/common/options/mgr.yaml.in - old way of specifying config settings

src/common/legacy_config_opts.h
src/common/options.cc
src/mgr/DaemonServer.cc

index d22061f8a7d5374fda363662ddc4162249988bb4..c06d2f15304f1286b8b72907c6cd17d823932d59 100644 (file)
@@ -305,6 +305,8 @@ OPTION(mon_debug_unsafe_allow_tier_with_nonempty_snaps, OPT_BOOL)
 OPTION(mon_osd_blocklist_default_expire, OPT_DOUBLE) // default one hour
 OPTION(mon_osd_crush_smoke_test, OPT_BOOL)
 
+OPTION(mgr_max_pg_num_change, OPT_INT)
+
 OPTION(paxos_stash_full_interval, OPT_INT)   // how often (in commits) to stash a full copy of the PaxosService state
 OPTION(paxos_max_join_drift, OPT_INT) // max paxos iterations before we must first sync the monitor stores
 OPTION(paxos_propose_interval, OPT_DOUBLE)  // gather updates for this long before proposing a map update
index 89f3418f66d818ffa6aa260bdfb3a7f4cdafde04..86535c128a48af16b48e35850a5b1fe5d994587c 100644 (file)
@@ -5482,6 +5482,11 @@ std::vector<Option> get_global_options() {
     .add_service("mgr")
     .set_description("Path to cephadm utility"),
 
+    Option("mgr_max_pg_num_change", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    .set_default(128)
+    .add_service("mgr")
+    .set_description("maximum change in pg_num"),
+
     Option("mgr_module_path", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default(CEPH_DATADIR "/mgr")
     .add_service("mgr")
index 48534f896ac49815c4c9c007102ae23ab086e42e..f95277f2958a1b19ef19036ee36c77475ebe66c4 100644 (file)
@@ -2765,15 +2765,24 @@ void DaemonServer::adjust_pgs()
            } else {
              active = false;
            }
+           unsigned pg_gap = p.get_pg_num() - p.get_pgp_num();
+           unsigned max_jump = cct->_conf->mgr_max_pg_num_change;
            if (!active) {
              dout(10) << "pool " << i.first
                       << " pg_num_target " << p.get_pg_num_target()
                       << " pg_num " << p.get_pg_num()
                       << " - not all pgs active"
                       << dendl;
+           } else if (pg_gap >= max_jump) {
+             dout(10) << "pool " << i.first
+                      << " pg_num " << p.get_pg_num()
+                      << " - pgp_num " << p.get_pgp_num()
+                      << " gap > max_pg_num_change " << max_jump
+                      << " - must scale pgp_num first"
+                      << dendl;
            } else {
              unsigned add = std::min(
-               left,
+               std::min(left, max_jump - pg_gap),
                p.get_pg_num_target() - p.get_pg_num());
              unsigned target = p.get_pg_num() + add;
              left -= add;