]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: limit changes to pg_num 44155/head
authorSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 23:18:31 +0000 (18:18 -0500)
committerSage Weil <sage@newdream.net>
Wed, 1 Dec 2021 00:24:38 +0000 (19:24 -0500)
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>
src/common/options/mgr.yaml.in
src/mgr/DaemonServer.cc

index 6fc8cb2e1c69ab43eefe8b7a96e6a8262feb2bc9..7d7b68035b7d2b8cbd92e2b769ac6ffccca2885b 100644 (file)
@@ -95,6 +95,14 @@ options:
   default: false
   services:
   - mgr
+- name: mgr_max_pg_num_change
+  type: int
+  level: advanced
+  desc: maximum change in pg_num
+  default: 128
+  services:
+  - mgr
+  with_legacy: true
 - name: mgr_module_path
   type: str
   level: advanced
index 36ab66db99929be4716fab121afedaf4b937d678..7884a081aa1fda66d6c6b2073fac3549442d6e50 100644 (file)
@@ -2766,15 +2766,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;