]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: limit changes to pg_num 44541/head
authorSage Weil <sage@newdream.net>
Tue, 30 Nov 2021 23:18:31 +0000 (18:18 -0500)
committerCory Snyder <csnyder@iland.com>
Mon, 16 May 2022 08:34:58 +0000 (04:34 -0400)
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

Cherry-pick notes:
- Options defined in common/options.cc in Octopus vs. common/options/mgr.yaml.in

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

index 4fa13e1076b3e0f1050630e4446dc6a732fcfbac..3ddc5fa90c0f2a4e7063872c542fed9b6cf41b84 100644 (file)
@@ -5264,6 +5264,11 @@ std::vector<Option> get_global_options() {
     .add_service("mgr")
     .set_description("Path to cephadm utility"),
 
+    Option("mgr_max_pg_num_change", Option::TYPE_UINT, 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 9b5af411d394c47485e261b329a5be0e217aaf92..6d18354effd453b115db5da8299c2873e9e8adaf 100644 (file)
@@ -2635,15 +2635,24 @@ void DaemonServer::adjust_pgs()
            } else {
              active = false;
            }
+           unsigned pg_gap = p.get_pg_num() - p.get_pgp_num();
+        unsigned max_jump = cct->_conf.get_val<uint64_t>("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;