]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog::proc_replica_log: select divergent log entries correctly 1416/head
authorSamuel Just <sam.just@inktank.com>
Sat, 8 Mar 2014 00:51:36 +0000 (16:51 -0800)
committerSamuel Just <sam.just@inktank.com>
Sat, 8 Mar 2014 00:53:51 +0000 (16:53 -0800)
Looking for an entry in olog which matches one of ours might add
extra divergent entries.  Instead, do what merge_log does and
walk back through the auth log looking for an entry in olog.

Fixes: 7657
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/PGLog.cc

index a468dcb4470e3a8c8dc18caa96ed0626e663232a..ef826c1013c29b28182e9e3eb72fff6ce1fe468f 100644 (file)
@@ -169,6 +169,22 @@ void PGLog::proc_replica_log(
             << " have " << i->second.have << dendl;
   }
 
+  list<pg_log_entry_t>::const_iterator toiter = log.log.end();
+  list<pg_log_entry_t>::const_iterator fromiter = log.log.end();
+  eversion_t lower_bound = log.tail;
+  while (1) {
+    if (fromiter == log.log.begin())
+      break;
+    --fromiter;
+    if (fromiter->version <= olog.head) {
+      dout(20) << "merge_log cut point (usually last shared) is "
+              << *fromiter << dendl;
+      lower_bound = fromiter->version;
+      ++fromiter;
+      break;
+    }
+  }
+
   list<pg_log_entry_t> divergent;
   list<pg_log_entry_t>::const_iterator pp = olog.log.end();
   eversion_t lu(oinfo.last_update);
@@ -183,16 +199,13 @@ void PGLog::proc_replica_log(
 
     // don't continue past the tail of our log.
     if (oe.version <= log.tail) {
+      lu = oe.version;
       ++pp;
       break;
     }
 
-    ceph::unordered_map<hobject_t, pg_log_entry_t*>::const_iterator i =
-      log.objects.find(oe.soid);
-    if (i != log.objects.end() && i->second->version == oe.version) {
-      dout(10) << " had " << oe << " new " << *(i->second)
-              << " : match, stopping" << dendl;
-      lu = pp->version;
+    if (oe.version <= lower_bound) {
+      lu = oe.version;
       ++pp;
       break;
     }