osd: fix PG::copy_after vs backlog

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>
This commit is contained in:
Sage Weil 2011-09-21 15:46:37 -07:00
parent ca63faf551
commit 68fe748fc2

View 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;