]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix merge_log when log and olog share bottom
authorSage Weil <sage@newdream.net>
Wed, 24 Jun 2009 05:06:24 +0000 (22:06 -0700)
committerSage Weil <sage@newdream.net>
Wed, 24 Jun 2009 05:06:24 +0000 (22:06 -0700)
If log has 6'10 and olog has 7'10, on same object, merge_log
was failing to throw out log's 6'10 entry because the
last_kept iterator was still end().  Use a simple eversion_t
instead, and simplify existing (and otherwise correct)
log.bottom logic, but without the last_kept != end() guard
that threw us off.

09.06.23 16:52:56.032981 1145465168 osd4 485 pg[1.cd( v 469'11021/469'11021 (469'11020,469'11021] n=8151 ec=2 les=476 485/480) r=0 lcod 0'0 mlcod 469'11021 !hml crashed+peering] merge_log log(469'11020,476'11021] from osd0 into log(469'11020,469'11021]
09.06.23 16:52:56.033001 1145465168 osd4 485 pg[1.cd( v 469'11021/469'11021 (469'11020,469'11021] n=8151 ec=2 les=476 485/480) r=0 lcod 0'0 mlcod 469'11021 !hml crashed+peering] merge_log extending top to 476'11021
09.06.23 16:52:56.033033 1145465168 osd4 485 pg[1.cd( v 469'11021/469'11021 (469'11020,469'11021] n=8151 ec=2 les=476 485/480) r=0 lcod 0'0 mlcod 469'11021 !hml crashed+peering]   ? 476'11021 (0'0) m 10001641d24.00000000/head by mds0.16:33860 09.06.23 16:50:28.931949
09.06.23 16:52:56.033057 1145465168 osd4 485 pg[1.cd( v 469'11021/469'11021 (469'11020,469'11021] n=8151 ec=2 les=476 485/480) r=0 lcod 0'0 mlcod 469'11021 !hml crashed+peering] merge_log 476'11021 (0'0) m 10001641d24.00000000/head by mds0.16:33860 09.06.23 16:50:28.931949
09.06.23 16:52:56.033090 1145465168 osd4 485 pg[1.cd( v 476'11021/469'11021 (469'11020,476'11021] n=8151 ec=2 les=476 485/480) r=0 lcod 0'0 mlcod 469'11021 !hml crashed+peering m=1 l=1] merge_log result log(469'11020,476'11021] missing(1) changed=1

src/osd/PG.cc

index be3a09bd05e1f78a820f1a7d15f3fdfcd2d0d0e8..75622023520e08cb56e1b39f088f27834ee01a2e 100644 (file)
@@ -438,7 +438,7 @@ void PG::merge_log(ObjectStore::Transaction& t,
       // find start point in olog
       list<Log::Entry>::iterator to = olog.log.end();
       list<Log::Entry>::iterator from = olog.log.end();
-      list<Log::Entry>::iterator last_kept = olog.log.end();
+      eversion_t lower_bound = olog.bottom;
       while (1) {
         if (from == olog.log.begin())
          break;
@@ -446,7 +446,7 @@ void PG::merge_log(ObjectStore::Transaction& t,
         dout(20) << "  ? " << *from << dendl;
         if (from->version <= log.top) {
          dout(20) << "merge_log last shared is " << *from << dendl;
-         last_kept = from;
+         lower_bound = from->version;
           from++;
           break;
         }
@@ -464,16 +464,13 @@ void PG::merge_log(ObjectStore::Transaction& t,
       
       // move aside divergent items
       list<Log::Entry> divergent;
-      if (last_kept != olog.log.end()) {
-       while (1) {
-         Log::Entry &oe = *log.log.rbegin();
-         if (oe.version == last_kept->version ||
-             oe.version <= olog.bottom)
-           break;
-         dout(10) << "merge_log divergent " << oe << dendl;
-         divergent.push_front(oe);
-         log.log.pop_back();
-       }
+      while (!log.log.empty()) {
+       Log::Entry &oe = *log.log.rbegin();
+       if (oe.version <= lower_bound)
+         break;
+       dout(10) << "merge_log divergent " << oe << dendl;
+       divergent.push_front(oe);
+       log.log.pop_back();
       }
 
       // splice