]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog::proc_replica_log: _merge_divergent_entries based on truncated olog
authorSamuel Just <sam.just@inktank.com>
Sun, 2 Mar 2014 21:42:16 +0000 (13:42 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 4 Mar 2014 00:05:16 +0000 (16:05 -0800)
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>
src/osd/PGLog.cc

index e563b4e4c9957116159d0f77fd0b0ba52825b954..beb2f0d905a12769a6eb8c8d969f21714274326a 100644 (file)
@@ -183,6 +183,7 @@ void PGLog::proc_replica_log(
 
     // don't continue past the tail of our log.
     if (oe.version <= log.tail) {
+      ++pp;
       break;
     }
 
@@ -192,24 +193,25 @@ void PGLog::proc_replica_log(
       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;