]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PGLog: dirty_to is inclusive 5763/head
authorSage Weil <sage@redhat.com>
Sun, 9 Aug 2015 14:46:10 +0000 (10:46 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 2 Sep 2015 19:26:36 +0000 (21:26 +0200)
There are only two callers of mark_dirty_to who do not pass max,
and they are both in the merge_log extending tail path.  In that
case, we want to include the last version specified in the log
writeout.  Fix the tail extending code to always specify the
last entry added, inclusive.

Fixes: #12652
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit f0ca14df0641daa04eee39d98d8bd0faf46e4e6d)

src/osd/PGLog.cc
src/osd/PGLog.h

index 2dc57c84a0aa2095e8a6fac0fd77649544a04e4c..b619bcd929bf8a4c9f7f1814c4edeeaa4e2a0e1d 100644 (file)
@@ -583,6 +583,7 @@ void PGLog::merge_log(ObjectStore::Transaction& t,
     dout(10) << "merge_log extending tail to " << olog.tail << dendl;
     list<pg_log_entry_t>::iterator from = olog.log.begin();
     list<pg_log_entry_t>::iterator to;
+    eversion_t last;
     for (to = from;
         to != olog.log.end();
         ++to) {
@@ -590,12 +591,10 @@ void PGLog::merge_log(ObjectStore::Transaction& t,
        break;
       log.index(*to);
       dout(15) << *to << dendl;
+      last = to->version;
     }
-      
-    if (to == olog.log.end())
-      mark_dirty_to(oinfo.last_update);
-    else
-      mark_dirty_to(to->version);
+    mark_dirty_to(last);
+
     // splice into our log.
     log.log.splice(log.log.begin(),
                   olog.log, from, to);
@@ -819,7 +818,7 @@ void PGLog::_write_log(
 
   map<string,bufferlist> keys;
   for (list<pg_log_entry_t>::iterator p = log.log.begin();
-       p != log.log.end() && p->version < dirty_to;
+       p != log.log.end() && p->version <= dirty_to;
        ++p) {
     bufferlist bl(sizeof(*p) * 2);
     p->encode_with_checksum(bl);
index dcb966b7de93c8a9432154a933b3f04055b8c18e..7029e90b64aca83b0544e59e070b3d3b330ab141 100644 (file)
@@ -307,9 +307,9 @@ protected:
 
   /// Log is clean on [dirty_to, dirty_from)
   bool touched_log;
-  eversion_t dirty_to;         ///< must clear/writeout all keys up to dirty_to
-  eversion_t dirty_from;       ///< must clear/writeout all keys past dirty_from
-  eversion_t writeout_from;    ///< must writout keys past writeout_from
+  eversion_t dirty_to;         ///< must clear/writeout all keys <= dirty_to
+  eversion_t dirty_from;       ///< must clear/writeout all keys >= dirty_from
+  eversion_t writeout_from;    ///< must writout keys >= writeout_from
   set<eversion_t> trimmed;     ///< must clear keys in trimmed
   bool dirty_divergent_priors;
   CephContext *cct;