Skip to content

Commit

Permalink
mds: fix dropping events in standby replay
Browse files Browse the repository at this point in the history
Ensure that we never drop the last segment during
standby replay -- this avoids the case where we
start ignoring events because we think we're
still waiting to see a subtreemap.

Fixes: http://tracker.ceph.com/issues/17954
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit e3f2fa3)
  • Loading branch information
John Spray authored and smithfarm committed Jan 26, 2017
1 parent a632cc4 commit 5eda4aa
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/mds/MDLog.cc
Expand Up @@ -1416,9 +1416,20 @@ void MDLog::standby_trim_segments()
bool removed_segment = false;
while (have_any_segments()) {
LogSegment *seg = get_oldest_segment();
if (seg->end > expire_pos)
dout(10) << " segment seq=" << seg->seq << " " << seg->offset <<
"~" << seg->end - seg->offset << dendl;

if (seg->end > expire_pos) {
dout(10) << " won't remove, not expired!" << dendl;
break;
}

if (segments.size() == 1) {
dout(10) << " won't remove, last segment!" << dendl;
break;
dout(10) << " removing segment " << seg->seq << "/" << seg->offset << dendl;
}

dout(10) << " removing segment" << dendl;
mds->mdcache->standby_trim_segment(seg);
remove_oldest_segment();
removed_segment = true;
Expand All @@ -1427,8 +1438,9 @@ void MDLog::standby_trim_segments()
if (removed_segment) {
dout(20) << " calling mdcache->trim!" << dendl;
mds->mdcache->trim(-1);
} else
} else {
dout(20) << " removed no segments!" << dendl;
}
}

void MDLog::dump_replay_status(Formatter *f) const
Expand Down

0 comments on commit 5eda4aa

Please sign in to comment.