dout(20) << " active was " << recovery_oids[pg->info.pgid] << dendl;
#endif
- int started = pg->start_recovery_ops(max);
+ ObjectStore::Transaction *t = new ObjectStore::Transaction;
+ C_Contexts *fin = new C_Contexts(g_ceph_context);
- map< int, vector<PG::Info> > notify_list; // primary -> list
- map< int, map<pg_t,PG::Query> > query_map; // peer -> PG -> get_summary_since
++ map< int, vector<pg_info_t> > notify_list; // primary -> list
++ map< int, map<pg_t,pg_query_t> > query_map; // peer -> PG -> get_summary_since
+ map<int,MOSDPGInfo*> info_map; // peer -> message
+ PG::RecoveryCtx rctx(&query_map, &info_map, 0, &fin->contexts, t);
+
+ int started = pg->start_recovery_ops(max, &rctx);
dout(10) << "do_recovery started " << started
<< " (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active << " rops) on "
return false;
}
- list<Log::Entry>::iterator p = log.log.end();
- list<Log::Entry> divergent;
+ /**
+ * rewind divergent entries at the head of the log
+ *
+ * This rewinds entries off the head of our log that are divergent.
+ * This is used by replicas during activation.
+ *
+ * @param t transaction
+ * @param newhead new head to rewind to
+ */
+ void PG::rewind_divergent_log(ObjectStore::Transaction& t, eversion_t newhead)
+ {
+ dout(10) << "rewind_divergent_log truncate divergent future " << newhead << dendl;
+ assert(newhead > log.tail);
+
- for (list<Log::Entry>::iterator d = divergent.begin(); d != divergent.end(); d++)
++ list<pg_log_entry_t>::iterator p = log.log.end();
++ list<pg_log_entry_t> divergent;
+ while (true) {
+ if (p == log.log.begin()) {
+ // yikes, the whole thing is divergent!
+ divergent.swap(log.log);
+ break;
+ }
+ --p;
+ if (p->version == newhead) {
+ ++p;
+ divergent.splice(divergent.begin(), log.log, p, log.log.end());
+ break;
+ }
+ assert(p->version > newhead);
+ dout(10) << "rewind_divergent_log future divergent " << *p << dendl;
+ log.unindex(*p);
+ }
+
+ log.head = newhead;
+ info.last_update = newhead;
+ if (info.last_complete > newhead)
+ info.last_complete = newhead;
+
++ for (list<pg_log_entry_t>::iterator d = divergent.begin(); d != divergent.end(); d++)
+ merge_old_entry(t, *d);
+ }
+
void PG::merge_log(ObjectStore::Transaction& t,
- Info &oinfo, Log &olog, int fromosd)
+ pg_info_t &oinfo, pg_log_t &olog, int fromosd)
{
dout(10) << "merge_log " << olog << " from osd." << fromosd
<< " into " << log << dendl;
return false;
}
- map<int,PG::Info>::iterator p = peer_info.begin();
+ void PG::remove_down_peer_info(const OSDMapRef osdmap)
+ {
+ // Remove any downed osds from peer_info
++ map<int,pg_info_t>::iterator p = peer_info.begin();
+ while (p != peer_info.end()) {
+ if (!osdmap->is_up(p->first)) {
+ dout(10) << " dropping down osd." << p->first << " info " << p->second << dendl;
+ peer_missing.erase(p->first);
+ peer_info.erase(p++);
+ } else
+ p++;
+ }
+ }
+
/*
* Returns true unless there is a non-lost OSD in might_have_unfound.
*/
// update local version of peer's missing list!
if (m && pi.last_backfill != hobject_t()) {
- eversion_t plu = pi.last_update;
- for (list<Log::Entry>::iterator p = m->log.log.begin();
+ for (list<pg_log_entry_t>::iterator p = m->log.log.begin();
p != m->log.log.end();
p++)
if (p->soid <= pi.last_backfill)
virtual void calc_trim_to() = 0;
- void proc_replica_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog,
- Missing& omissing, int from);
- void proc_master_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog,
- Missing& omissing, int from);
- bool proc_replica_info(int from, Info &info);
- bool merge_old_entry(ObjectStore::Transaction& t, Log::Entry& oe);
- void merge_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, int from);
+ void proc_replica_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
+ pg_missing_t& omissing, int from);
+ void proc_master_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
+ pg_missing_t& omissing, int from);
+ bool proc_replica_info(int from, pg_info_t &info);
+ bool merge_old_entry(ObjectStore::Transaction& t, pg_log_entry_t& oe);
+ void merge_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog, int from);
+ void rewind_divergent_log(ObjectStore::Transaction& t, eversion_t newhead);
-
- bool search_for_missing(const Info &oinfo, const Missing *omissing,
+ bool search_for_missing(const pg_info_t &oinfo, const pg_missing_t *omissing,
int fromosd);
void check_for_lost_objects();