]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: pass mostly_omap flag when opening/creating pools 27684/head
authorSage Weil <sage@redhat.com>
Fri, 5 Apr 2019 22:37:57 +0000 (17:37 -0500)
committerAbhishek Lekshmanan <abhishek@suse.com>
Mon, 19 Aug 2019 10:51:33 +0000 (12:51 +0200)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit af30e3a512dd1e5c51639d1f823b99ed9b43fb50)

src/common/options.cc
src/rgw/rgw_tools.cc

index 8a76069c20b4c06f028a13dfafe0e0a17d7bffc4..cdd7c8e2b6dcce950e7a549da1972f8e6a156791 100644 (file)
@@ -6079,6 +6079,16 @@ std::vector<Option> get_rgw_options() {
     .set_default(10)
     .set_description(""),
 
+    Option("rgw_rados_pool_autoscale_bias", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+    .set_default(4.0)
+    .set_min_max(0.01, 100000.0)
+    .set_description("pg_autoscale_bias value for RGW metadata (omap-heavy) pools"),
+
+    Option("rgw_rados_pool_pg_num_min", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(8)
+    .set_min_max(1, 1024)
+    .set_description("pg_num_min value for RGW metadata (omap-heavy) pools"),
+
     Option("rgw_zone", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("")
     .set_description("Zone name")
index fe328430968178e99246cb5a47c0b1101bb9db94..057535e411f506cf501cb612ac5cd330872cfd02 100644 (file)
@@ -9,6 +9,7 @@
 #include "common/async/yield_context.h"
 
 #include "include/types.h"
+#include "include/stringify.h"
 
 #include "rgw_common.h"
 #include "rgw_rados.h"
@@ -59,6 +60,32 @@ int rgw_init_ioctx(librados::Rados *rados, const rgw_pool& pool,
     if (r < 0 && r != -EOPNOTSUPP) {
       return r;
     }
+
+    if (mostly_omap) {
+      // set pg_autoscale_bias
+      bufferlist inbl;
+      float bias = g_conf().get_val<double>("rgw_rados_pool_autoscale_bias");
+      int r = rados->mon_command(
+       "{\"prefix\": \"osd pool set\", \"pool\": \"" +
+       pool.name + "\", \"var\": \"pg_autoscale_bias\": \"" +
+       stringify(bias) + "\"}",
+       inbl, NULL, NULL);
+      if (r < 0) {
+       dout(10) << __func__ << " warning: failed to set pg_autoscale_bias on "
+                << pool.name << dendl;
+      }
+      // set pg_num_min
+      int min = g_conf().get_val<uint64_t>("rgw_rados_pool_pg_num_min");
+      r = rados->mon_command(
+       "{\"prefix\": \"osd pool set\", \"pool\": \"" +
+       pool.name + "\", \"var\": \"pg_num_min\": \"" +
+       stringify(min) + "\"}",
+       inbl, NULL, NULL);
+     if (r < 0) {
+       dout(10) << __func__ << " warning: failed to set pg_num_min on "
+               << pool.name << dendl;
+      }
+    }
   } else if (r < 0) {
     return r;
   }