]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix PG::copy_after vs backlog
authorSage Weil <sage.weil@dreamhost.com>
Wed, 21 Sep 2011 22:46:37 +0000 (15:46 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 21 Sep 2011 23:27:06 +0000 (16:27 -0700)
If you call copy_after(..., 0) on a log with a backlog, you get all the
backlog entries, but no backlog flag.  That's invalid.  You either need
the _complete_ backlog + the flag, or no backlog entries; getting only
some of them is useless information.

Make copy_after stop when it hits the tail.  Callers who need the backlog
are already checking for that and copying the whole log as appropriate.

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

index fa3dbd803a91c7dc0856c1fc23c7893070f482a5..de0ee124b669ae29a3dd8b51d04cb3c3b3539300 100644 (file)
@@ -56,7 +56,7 @@ void PG::Log::copy_after(const Log &other, eversion_t v)
   for (list<Entry>::const_reverse_iterator i = other.log.rbegin();
        i != other.log.rend();
        i++) {
-    if (i->version <= v) {
+    if (i->version <= v || i->version <= other.tail) {
       tail = i->version;
       break;
     }
@@ -3504,8 +3504,7 @@ void PG::fulfill_log(int from, const Query &query)
       } else
        mlog->log.copy_after(log, query.since);
     }
-       
-    if (query.type == PG::Query::BACKLOG) {
+    else if (query.type == PG::Query::BACKLOG) {
       dout(10) << "sending info+missing+backlog" << dendl;
       assert(log.backlog);
       mlog->log = log;