OPTION(mon_cpu_threads, OPT_INT)
OPTION(mon_osd_mapping_pgs_per_chunk, OPT_INT)
+OPTION(mon_clean_pg_upmaps_per_chunk, OPT_INT)
OPTION(mon_osd_max_creating_pgs, OPT_INT)
OPTION(mon_tick_interval, OPT_INT)
OPTION(mon_session_timeout, OPT_INT) // must send keepalive or subscribe
.add_service("mon")
.set_description("granularity of PG placement calculation background work"),
+ Option("mon_clean_pg_upmaps_per_chunk", Option::TYPE_INT, Option::LEVEL_DEV)
+ .set_default(256)
+ .add_service("mon")
+ .set_description("granularity of PG upmap validation background work"),
+
Option("mon_osd_max_creating_pgs", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(1024)
.add_service("mon")
OSDMap::clean_temps(cct, osdmap, tmp, &pending_inc);
// clean inappropriate pg_upmap/pg_upmap_items (if any)
- tmp.clean_pg_upmaps(cct, &pending_inc);
+ {
+ // check every upmapped pg for now
+ // until we could reliably identify certain cases to ignore,
+ // which is obviously the hard part TBD..
+ vector<pg_t> pgs_to_check;
+ tmp.get_upmap_pgs(&pgs_to_check);
+ if (pgs_to_check.size() < g_conf()->mon_clean_pg_upmaps_per_chunk * 2) {
+ // not enough pgs, do it inline
+ tmp.clean_pg_upmaps(cct, &pending_inc);
+ } else {
+ CleanUpmapJob job(cct, tmp, pending_inc);
+ mapper.queue(&job, g_conf()->mon_clean_pg_upmaps_per_chunk, pgs_to_check);
+ job.wait();
+ }
+ }
// update creating pgs first so that we can remove the created pgid and
// process the pool flag removal below in the same osdmap epoch.
FAST_READ_DEFAULT
};
+ struct CleanUpmapJob : public ParallelPGMapper::Job {
+ CephContext *cct;
+ const OSDMap& osdmap;
+ OSDMap::Incremental& pending_inc;
+ // lock to protect pending_inc form changing
+ // when checking is done
+ Mutex pending_inc_lock = {"CleanUpmapJob::pending_inc_lock"};
+
+ CleanUpmapJob(CephContext *cct, const OSDMap& om, OSDMap::Incremental& pi)
+ : ParallelPGMapper::Job(&om),
+ cct(cct),
+ osdmap(om),
+ pending_inc(pi) {}
+
+ void process(const vector<pg_t>& to_check) override {
+ vector<pg_t> to_cancel;
+ map<pg_t, mempool::osdmap::vector<pair<int,int>>> to_remap;
+ osdmap.check_pg_upmaps(cct, to_check, &to_cancel, &to_remap);
+ // don't bother taking lock if nothing changes
+ if (!to_cancel.empty() || !to_remap.empty()) {
+ std::lock_guard l(pending_inc_lock);
+ osdmap.clean_pg_upmaps(cct, &pending_inc, to_cancel, to_remap);
+ }
+ }
+
+ void process(int64_t poolid, unsigned ps_begin, unsigned ps_end) override {}
+ void complete() override {}
+ }; // public as this will need to be accessible from TestTestOSDMap.cc
+
// svc
public:
void create_initial() override;