0, creating_pgs[pgid].acting, creating_pgs[pgid].acting,
history, pi,
*rctx.transaction);
+ pg->info.last_epoch_started = pg->info.history.last_epoch_started;
creating_pgs.erase(pgid);
wake_pg_waiters(pg->info.pgid);
pg->handle_create(&rctx);
for (map<int, pg_info_t>::const_iterator i = infos.begin();
i != infos.end();
++i) {
- if (max_last_epoch_started_found < i->second.history.last_epoch_started) {
+ if (max_last_epoch_started_found < i->second.last_epoch_started) {
min_last_update_acceptable = eversion_t::max();
- max_last_epoch_started_found = i->second.history.last_epoch_started;
+ max_last_epoch_started_found = i->second.last_epoch_started;
}
- if (max_last_epoch_started_found == i->second.history.last_epoch_started) {
+ if (max_last_epoch_started_found == i->second.last_epoch_started) {
if (min_last_update_acceptable > i->second.last_update)
min_last_update_acceptable = i->second.last_update;
}
send_notify = false;
+ info.last_epoch_started = query_epoch;
+
if (is_primary()) {
// If necessary, create might_have_unfound to help us find our unfound objects.
// NOTE: It's important that we build might_have_unfound before trimming the
assert(is_primary());
assert(peer_activated.size() == acting.size());
- info.history.last_epoch_started = get_osdmap()->get_epoch();
+ // info.last_epoch_started is set during activate()
+ info.history.last_epoch_started = info.last_epoch_started;
share_pg_info();
update_stats();
// share new pg_info_t with replicas
for (unsigned i=1; i<acting.size(); i++) {
int peer = acting[i];
+ if (peer_info.count(i)) {
+ peer_info[i].last_epoch_started = info.last_epoch_started;
+ peer_info[i].history.merge(info.history);
+ }
MOSDPGInfo *m = new MOSDPGInfo(get_osdmap()->get_epoch());
m->pg_list.push_back(
make_pair(
dirty_info = true;
osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp);
+ assert(oinfo.last_epoch_started == info.last_epoch_started);
+ assert(info.history.last_epoch_started == oinfo.last_epoch_started);
+ assert(oinfo.history.last_epoch_started == oinfo.last_epoch_started);
+
// Handle changes to purged_snaps ONLY IF we have caught up
if (last_complete_ondisk.epoch >= info.history.last_epoch_started) {
interval_set<snapid_t> p;
// We pull the log from the peer's last_epoch_started to ensure we
// get enough log to detect divergent updates.
- eversion_t since(pi.history.last_epoch_started, 0);
+ eversion_t since(pi.last_epoch_started, 0);
assert(pi.last_update >= pg->info.log_tail); // or else choose_acting() did a bad thing
if (pi.log_tail <= since) {
dout(10) << " requesting log+missing since " << since << " from osd." << *i << dendl;
void pg_info_t::encode(bufferlist &bl) const
{
- ENCODE_START(26, 26, bl);
+ ENCODE_START(27, 26, bl);
::encode(pgid, bl);
::encode(last_update, bl);
::encode(last_complete, bl);
::encode(stats, bl);
history.encode(bl);
::encode(purged_snaps, bl);
+ ::encode(last_epoch_started, bl);
ENCODE_FINISH(bl);
}
void pg_info_t::decode(bufferlist::iterator &bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(26, 26, 26, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(27, 26, 26, bl);
if (struct_v < 23) {
old_pg_t opgid;
::decode(opgid, bl);
set<snapid_t> snap_trimq;
::decode(snap_trimq, bl);
}
+ if (struct_v < 27) {
+ last_epoch_started = history.last_epoch_started;
+ } else {
+ ::decode(last_epoch_started, bl);
+ }
DECODE_FINISH(bl);
}
f->dump_int("empty", is_empty());
f->dump_int("dne", dne());
f->dump_int("incomplete", is_incomplete());
+ f->dump_int("last_epoch_started", last_epoch_started);
}
void pg_info_t::generate_test_instances(list<pg_info_t*>& o)
pg_t pgid;
eversion_t last_update; // last object version applied to store.
eversion_t last_complete; // last version pg was complete through.
+ epoch_t last_epoch_started;// last epoch at which this pg started on this osd
eversion_t log_tail; // oldest log entry.
pg_history_t history;
pg_info_t()
- : last_backfill(hobject_t::get_max())
+ : last_epoch_started(0), last_backfill(hobject_t::get_max())
{ }
pg_info_t(pg_t p)
: pgid(p),
- last_backfill(hobject_t::get_max())
+ last_epoch_started(0), last_backfill(hobject_t::get_max())
{ }
bool is_empty() const { return last_update.version == 0; }
out << " lb " << pgi.last_backfill;
}
//out << " c " << pgi.epoch_created;
+ out << " local-les=" << pgi.last_epoch_started;
out << " n=" << pgi.stats.stats.sum.num_objects;
out << " " << pgi.history
<< ")";