PG *pg = _create_lock_pg(pgid, t);
pg->set_role(0);
pg->acting.swap(acting);
- pg->info.epoch_created =
- pg->last_epoch_started_any =
- pg->info.last_epoch_started =
+ pg->last_epoch_started_any =
+ pg->info.history.epoch_created =
+ pg->info.history.last_epoch_started =
pg->info.history.same_since =
pg->info.history.same_primary_since =
pg->info.history.same_acker_since = osdmap->get_epoch();
pg->lock();
if (pg->is_active()) {
// update started counter
- pg->info.last_epoch_started = osdmap->get_epoch();
+ pg->info.history.last_epoch_started = osdmap->get_epoch();
}
else if (pg->get_role() == 0 && !pg->is_active()) {
// i am (inactive) primary
assert(role == 0); // otherwise, probably bug in project_pg_history.
- epoch_t last_epoch_started = it->last_epoch_started;
-
// DNE on source?
if (it->dne()) {
// is there a creation pending on this pg?
pg->acting.swap(acting);
pg->set_role(role);
pg->info.history = history;
- pg->info.epoch_created = it->epoch_created;
- pg->last_epoch_started_any = last_epoch_started; // _after_ clear_primary_state()
+ pg->last_epoch_started_any = history.last_epoch_started; // _after_ clear_primary_state()
pg->clear_primary_state(); // yep, notably, set hml=false
pg->build_prior();
pg->write_log(t);
// stray?
bool acting = pg->is_acting(from);
- if (!acting && (*it).last_epoch_started > 0) {
+ if (!acting && (*it).history.last_epoch_started > 0) {
dout(10) << *pg << " osd" << from << " has stray content: " << *it << dendl;
pg->stray_set.insert(from);
pg->state_clear(PG_STATE_CLEAN);
if (pg->is_all_uptodate())
pg->finish_recovery();
} else {
- if (it->last_epoch_started > pg->last_epoch_started_any)
+ if (it->history.last_epoch_started > pg->last_epoch_started_any)
pg->adjust_prior();
pg->peer(t, query_map, &info_map);
}
for (map<int,Info>::iterator it = peer_info.begin();
it != peer_info.end();
it++) {
- if (it->second.last_epoch_started > max)
- max = it->second.last_epoch_started;
+ if (it->second.history.last_epoch_started > max)
+ max = it->second.history.last_epoch_started;
}
dout(10) << "adjust_prior last_epoch_started_any "
stat_object_temp_rd.clear();
- last_epoch_started_any = info.last_epoch_started;
+ last_epoch_started_any = info.history.last_epoch_started;
}
void PG::peer(ObjectStore::Transaction& t,
} else {
dout(10) << " still active from last started: " << last_started << dendl;
}
- } else if (osd->osdmap->get_epoch() > info.epoch_created) { // FIXME hrm is htis right?
+ } else if (osd->osdmap->get_epoch() > info.history.epoch_created) { // FIXME hrm is htis right?
dout(10) << " crashed since epoch " << last_epoch_started_any << dendl;
state_set(PG_STATE_CRASHED);
}
state_clear(PG_STATE_CRASHED);
state_clear(PG_STATE_REPLAY);
}
- last_epoch_started_any = info.last_epoch_started = osd->osdmap->get_epoch();
+ last_epoch_started_any = info.history.last_epoch_started = osd->osdmap->get_epoch();
if (role == 0) { // primary state
peers_complete_thru = eversion_t(0,0); // we don't know (yet)!
eversion_t log_bottom; // oldest log entry.
bool log_backlog; // do we store a complete log?
- epoch_t epoch_created; // epoch in which it was created
- epoch_t last_epoch_started; // last epoch started.
-
struct History {
+ epoch_t epoch_created; // epoch in which it was created
+ epoch_t last_epoch_started; // last epoch started.
+
epoch_t same_since; // same acting set since
epoch_t same_primary_since; // same primary at least back through this epoch.
epoch_t same_acker_since; // same acker at least back through this epoch.
- History() : same_since(0), same_primary_since(0), same_acker_since(0) {}
+ History() :
+ epoch_created(0),
+ last_epoch_started(0),
+ same_since(0), same_primary_since(0), same_acker_since(0) {}
void encode(bufferlist &bl) const {
+ ::encode(epoch_created, bl);
+ ::encode(last_epoch_started, bl);
::encode(same_since, bl);
::encode(same_primary_since, bl);
::encode(same_acker_since, bl);
}
void decode(bufferlist::iterator &bl) {
+ ::decode(epoch_created, bl);
+ ::decode(last_epoch_started, bl);
::decode(same_since, bl);
::decode(same_primary_since, bl);
::decode(same_acker_since, bl);
} history;
Info(pg_t p=0) : pgid(p),
- log_backlog(false),
- epoch_created(0),
- last_epoch_started(0)
+ log_backlog(false)
{ }
bool is_uptodate() const { return last_update == last_complete; }
bool is_empty() const { return last_update.version == 0; }
- bool dne() const { return epoch_created == 0; }
+ bool dne() const { return history.epoch_created == 0; }
void encode(bufferlist &bl) const {
::encode(pgid, bl);
::encode(last_complete, bl);
::encode(log_bottom, bl);
::encode(log_backlog, bl);
- ::encode(epoch_created, bl);
- ::encode(last_epoch_started, bl);
history.encode(bl);
}
void decode(bufferlist::iterator &bl) {
::decode(last_complete, bl);
::decode(log_bottom, bl);
::decode(log_backlog, bl);
- ::decode(epoch_created, bl);
- ::decode(last_epoch_started, bl);
history.decode(bl);
}
};
inline ostream& operator<<(ostream& out, const PG::Info::History& h)
{
- return out << h.same_since << "/" << h.same_primary_since << "/" << h.same_acker_since;
+ return out << " ec " << h.epoch_created
+ << " les " << h.last_epoch_started
+ << h.same_since << "/" << h.same_primary_since << "/" << h.same_acker_since;
}
inline ostream& operator<<(ostream& out, const PG::Info& pgi)
<< " (" << pgi.log_bottom << "," << pgi.last_update << "]"
<< (pgi.log_backlog ? "+backlog":"");
//out << " c " << pgi.epoch_created;
- out << " e " << pgi.last_epoch_started
- << " " << pgi.history
+ out << " " << pgi.history
<< ")";
return out;
}