From: Sage Weil Date: Sun, 9 Aug 2015 14:46:10 +0000 (-0400) Subject: osd/PGLog: dirty_to is inclusive X-Git-Tag: v0.80.11~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cd1396cd62c79b177e46cfb57ab6b3b6fdcd227b;p=ceph.git osd/PGLog: dirty_to is inclusive 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 (cherry picked from commit f0ca14df0641daa04eee39d98d8bd0faf46e4e6d) --- diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index f08105513549..7f35f7dbefe6 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -560,6 +560,7 @@ void PGLog::merge_log(ObjectStore::Transaction& t, dout(10) << "merge_log extending tail to " << olog.tail << dendl; list::iterator from = olog.log.begin(); list::iterator to; + eversion_t last; for (to = from; to != olog.log.end(); ++to) { @@ -567,12 +568,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); @@ -794,7 +793,7 @@ void PGLog::_write_log( map keys; for (list::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); diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index 18739f509448..508b295fd9c6 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -212,9 +212,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 trimmed; ///< must clear keys in trimmed bool dirty_divergent_priors; CephContext *cct;