#define dout_subsys ceph_subsys_mgr
#undef dout_prefix
#define dout_prefix *_dout << "mgr.server " << __func__ << " "
+
using namespace TOPNSPC::common;
+
+using std::list;
+using std::ostringstream;
+using std::string;
+using std::stringstream;
+using std::vector;
+using std::unique_ptr;
+
namespace {
template <typename Map>
bool map_compare(Map const &lhs, Map const &rhs) {
}
// if there are any schema updates, notify the python modules
+ /* no users currently
if (!m->declare_types.empty() || !m->undeclare_types.empty()) {
py_modules.notify_all("perf_schema_update", ceph::to_string(key));
}
+ */
if (m->get_connection()->peer_is_osd()) {
osd_perf_metric_collector.process_reports(m->osd_perf_metric_reports);
if (boost::algorithm::ends_with(prefix, "_json")) {
format = "json";
} else {
- cmd_getval(cmdctx->cmdmap, "format", format, string("plain"));
+ format = cmd_getval_or<string>(cmdctx->cmdmap, "format", "plain");
}
f.reset(Formatter::create(format));
}
auto dump_cmd = [&cmdnum, &f, m](const MonCommand &mc){
ostringstream secname;
- secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
+ secname << "cmd" << std::setfill('0') << std::setw(3) << cmdnum;
dump_cmddesc_to_json(&f, m->get_connection()->get_features(),
secname.str(), mc.cmdstring, mc.helpstring,
mc.module, mc.req_perms, 0);
return true;
}
for (auto& con : p->second) {
- if (HAVE_FEATURE(con->get_features(), SERVER_MIMIC)) {
- vector<spg_t> pgs = { spgid };
- con->send_message(new MOSDScrub2(monc->get_fsid(),
- epoch,
- pgs,
- scrubop == "repair",
- scrubop == "deep-scrub"));
- } else {
- vector<pg_t> pgs = { pgid };
- con->send_message(new MOSDScrub(monc->get_fsid(),
- pgs,
- scrubop == "repair",
- scrubop == "deep-scrub"));
- }
+ assert(HAVE_FEATURE(con->get_features(), SERVER_OCTOPUS));
+ vector<spg_t> pgs = { spgid };
+ con->send_message(new MOSDScrub2(monc->get_fsid(),
+ epoch,
+ pgs,
+ scrubop == "repair",
+ scrubop == "deep-scrub"));
}
ss << "instructing pg " << spgid << " on osd." << acting_primary
<< " to " << scrubop;
bool dry_run =
prefix == "osd test-reweight-by-pg" ||
prefix == "osd test-reweight-by-utilization";
- int64_t oload;
- cmd_getval(cmdctx->cmdmap, "oload", oload, int64_t(120));
+ int64_t oload = cmd_getval_or<int64_t>(cmdctx->cmdmap, "oload", 120);
set<int64_t> pools;
vector<string> poolnames;
cmd_getval(cmdctx->cmdmap, "pools", poolnames);
return true;
}
bool no_increasing = false;
- cmd_getval(cmdctx->cmdmap, "no_increasing", no_increasing);
+ cmd_getval_compat_cephbool(cmdctx->cmdmap, "no_increasing", no_increasing);
string out_str;
mempool::osdmap::map<int32_t, uint32_t> new_weights;
r = cluster_state.with_osdmap_and_pgmap([&](const OSDMap &osdmap, const PGMap& pgmap) {
} 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;
// single adjustment that's more than half of the
// max_misplaced, to somewhat limit the magnitude of
// our potential error here.
- int next;
+ unsigned next;
static constexpr unsigned MAX_NUM_OBJECTS_PER_PG_FOR_LEAP = 1;
pool_stat_t s = pg_map.get_pg_pool_sum_stat(i.first);
if (aggro ||