]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: take remote log when it is clearly superior
authorSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 07:27:00 +0000 (00:27 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 20 May 2011 07:27:00 +0000 (00:27 -0700)
I'm hitting a case where the primary is compensating for a replica's
last_complete < log.tail by sending a log+backlog, but the replica
isn't smart enough to take advantage.  In this case,

      replica: log(781'26629,781'26631]
 from primary: log(781'26629,781'26631]+backlog
       result: log(781'26629,781'26631]

Doh!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/PG.cc

index aa496c3cef9e4253950178c02d9827b845faeae1..4e741e388b7936213a99c52aaa54222528fa51ef 100644 (file)
@@ -388,7 +388,10 @@ void PG::merge_log(ObjectStore::Transaction& t,
   bool changed = false;
 
   if (log.empty() ||
-      (olog.tail > log.head && olog.backlog)) { // e.g. log=(0,20] olog=(40,50]+backlog) 
+      (olog.tail > log.head && olog.backlog) ||  // e.g. log=(0,20] olog=(40,50]+backlog) 
+      (log.head <= olog.head &&
+       log.tail >= olog.tail &&
+       !log.backlog && olog.backlog)) {          // olog is clearly superior in every way
 
     if (is_primary()) {
       // we should have our own backlog already; see peer() code where