Skip to content

Commit

Permalink
rgw: pass mostly_omap flag when opening/creating pools
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit af30e3a)
  • Loading branch information
liewegas authored and theanalyst committed Aug 19, 2019
1 parent 50c0774 commit 6be1ab1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/common/options.cc
Expand Up @@ -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")
Expand Down
27 changes: 27 additions & 0 deletions src/rgw/rgw_tools.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6be1ab1

Please sign in to comment.