We can't merge using the primary's log since we haven't decided whether
to send them a complete log yet. Thus, merge based on the truncated olog
rather than the primary's log. This is a consequence of the division
between trimming divergent entries in peering/unfound search and sending
a complete log to actual members of the actingbackfill set in activate().
_merge_divergent_entries on the truncated log and add_next_event() on the
newer entries result in the same missing/log regardless of the order in
which they are performed.
Signed-off-by: Samuel Just <sam.just@inktank.com>
// don't continue past the tail of our log.
if (oe.version <= log.tail) {
+ ++pp;
break;
}
dout(10) << " had " << oe << " new " << *(i->second)
<< " : match, stopping" << dendl;
lu = pp->version;
+ ++pp;
break;
}
divergent.push_front(oe);
}
- for (list<pg_log_entry_t>::iterator i = divergent.begin();
- i != divergent.end();
- ++i) {
- _merge_old_entry(
- t,
- *i,
- oinfo,
- omissing,
- olog.can_rollback_to,
- 0,
- 0);
- }
+
+ IndexedLog folog;
+ folog.log.insert(folog.log.begin(), olog.log.begin(), pp);
+ folog.index();
+ _merge_divergent_entries(
+ folog,
+ divergent,
+ oinfo,
+ olog.can_rollback_to,
+ omissing,
+ 0,
+ 0);
if (lu < oinfo.last_update) {
dout(10) << " peer osd." << from << " last_update now " << lu << dendl;