const string& service_name)
: PaxosService(mn, p, service_name),
cct(cct),
- mapper(mn->cct, &mn->cpu_tp),
inc_osd_cache(g_conf->mon_osd_cache_size),
full_osd_cache(g_conf->mon_osd_cache_size),
last_attempted_minwait_time(utime_t()),
+ mapper(mn->cct, &mn->cpu_tp),
op_tracker(cct, true, 1)
{}
// make sure our feature bits reflect the latest map
update_msgr_features();
+
+ if (!mon->is_leader()) {
+ // will be called by on_active() on the leader, avoid doing so twice
+ start_mapping();
+ }
+}
+
+void OSDMonitor::start_mapping()
+{
+ // initiate mapping job
+ if (mapping_job) {
+ dout(10) << __func__ << " canceling previous mapping_job " << mapping_job.get()
+ << dendl;
+ mapping_job->abort();
+ }
+ auto *fin = new C_PrintTime(osdmap.get_epoch());
+ mapping_job = mapping.start_update(osdmap, mapper,
+ g_conf->mon_osd_mapping_pgs_per_chunk);
+ dout(10) << __func__ << " started mapping job " << mapping_job.get()
+ << " at " << fin->start << dendl;
+ mapping_job->set_finish_event(fin);
}
void OSDMonitor::update_msgr_features()
{
update_logger();
- if (mon->is_leader())
+ if (mon->is_leader()) {
mon->clog->info() << "osdmap " << osdmap;
-
- if (!mon->is_leader()) {
+ } else {
list<MonOpRequestRef> ls;
take_all_failures(ls);
while (!ls.empty()) {
ls.pop_front();
}
}
-
- // initiate mapping job
- if (mapping_job) {
- dout(10) << __func__ << " canceling previous mapping_job " << mapping_job.get()
- << dendl;
- mapping_job->abort();
- }
- C_PrintTime *fin = new C_PrintTime(osdmap.get_epoch());
- mapping_job = mapping.start_update(osdmap, mapper,
- g_conf->mon_osd_mapping_pgs_per_chunk);
- dout(10) << __func__ << " started mapping job " << mapping_job.get()
- << " at " << fin->start << dendl;
- mapping_job->set_finish_event(fin);
+ start_mapping();
}
void OSDMonitor::on_shutdown()
class OSDMonitor : public PaxosService {
CephContext *cct;
- ParallelPGMapper mapper; ///< for background pg work
- OSDMapMapping mapping; ///< pg <-> osd mappings
- unique_ptr<ParallelPGMapper::Job> mapping_job; ///< background mapping job
-
public:
OSDMap osdmap;
void maybe_prime_pg_temp();
void prime_pg_temp(const OSDMap& next, pg_t pgid);
+ ParallelPGMapper mapper; ///< for background pg work
+ OSDMapMapping mapping; ///< pg <-> osd mappings
+ unique_ptr<ParallelPGMapper::Job> mapping_job; ///< background mapping job
+ void start_mapping();
+
void update_logger();
void handle_query(PaxosServiceMessage *m);