]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: allow pg_num to increase when require_osd_release < N
authorSage Weil <sage@redhat.com>
Thu, 2 May 2019 16:18:17 +0000 (11:18 -0500)
committerNeha Ojha <nojha@redhat.com>
Wed, 14 Aug 2019 19:52:02 +0000 (12:52 -0700)
Setting pg_num_target has no effect when we encode our OSDMap with mimic
or luminous features.  Fall back to the pre-nautilus behavior of directly
setting pg_num.

Fixes: http://tracker.ceph.com/issues/39570
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 7e7134aa9317a0d64503edb20b9ea1f4035c7e9e)

src/mon/OSDMonitor.cc

index 67f182dc8d7c5632652f1431541c0ba527191425..f9cb049f495c3041bb32caabd3675ace65ca03c5 100644 (file)
@@ -7274,14 +7274,26 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
        return -EPERM;
       }
     }
-    // set targets; mgr will adjust pg_num_actual and pgp_num later.
-    // make pgp_num track pg_num if it already matches.  if it is set
-    // differently, leave it different and let the user control it
-    // manually.
-    if (p.get_pg_num_target() == p.get_pgp_num_target()) {
-      p.set_pgp_num_target(n);
+    if (osdmap.require_osd_release < ceph_release_t::nautilus) {
+      // pre-nautilus osdmap format; increase pg_num directly
+      assert(n > (int)p.get_pg_num());
+      // force pre-nautilus clients to resend their ops, since they
+      // don't understand pg_num_target changes form a new interval
+      p.last_force_op_resend_prenautilus = pending_inc.epoch;
+      // force pre-luminous clients to resend their ops, since they
+      // don't understand that split PGs now form a new interval.
+      p.last_force_op_resend_preluminous = pending_inc.epoch;
+      p.set_pg_num(n);
+    } else {
+      // set targets; mgr will adjust pg_num_actual and pgp_num later.
+      // make pgp_num track pg_num if it already matches.  if it is set
+      // differently, leave it different and let the user control it
+      // manually.
+      if (p.get_pg_num_target() == p.get_pgp_num_target()) {
+       p.set_pgp_num_target(n);
+      }
+      p.set_pg_num_target(n);
     }
-    p.set_pg_num_target(n);
   } else if (var == "pgp_num_actual") {
     if (p.has_flag(pg_pool_t::FLAG_NOPGCHANGE)) {
       ss << "pool pgp_num change is disabled; you must unset nopgchange flag for the pool first";
@@ -7322,7 +7334,12 @@ int OSDMonitor::prepare_command_pool_set(const cmdmap_t& cmdmap,
       ss << "specified pgp_num " << n << " > pg_num " << p.get_pg_num_target();
       return -EINVAL;
     }
-    p.set_pgp_num_target(n);
+    if (osdmap.require_osd_release < ceph_release_t::nautilus) {
+      // pre-nautilus osdmap format; increase pgp_num directly
+      p.set_pgp_num(n);
+    } else {
+      p.set_pgp_num_target(n);
+    }
   } else if (var == "pg_autoscale_mode") {
     n = pg_pool_t::get_pg_autoscale_mode_by_name(val);
     if (n < 0) {