mds: Don't expire log segment before it's fully flushed
PATCH 1/2 mds: Don't expire log segment before it's fully flushed
From: "Yan, Zheng" <[email protected]>
Expiring log segment before it's fully flushed may cause various issues during log replay.
Signed-off-by Yan, Zheng <[email protected]>
--- src/leveldb | 2 +- src/mds/MDLog.cc | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-)
src/mds/MDLog.cc +5 -3
@@ -330,6 +330,11 @@ void MDLog::trim(int m) assert(ls); p++; + if (ls->end > journaler->get_write_safe_pos()) { + dout(5) << "trim segment " << ls->offset << ", not fully flushed yet, safe " + << journaler->get_write_safe_pos() << " < end " << ls->end << dendl; + break; + } if (expiring_segments.count(ls)) { dout(5) << "trim already expiring segment " << ls->offset << ", " << ls->num_events << " events" << dendl; } else if (expired_segments.count(ls)) {
@@ -412,9 +417,6 @@ void MDLog::_expired(LogSegment *ls) if (!capped && ls == get_current_segment()) { dout(5) << "_expired not expiring " << ls->offset << ", last one and !capped" << dendl; - } else if (ls->end > journaler->get_write_safe_pos()) { - dout(5) << "_expired not expiring " << ls->offset << ", not fully flushed yet, safe " - << journaler->get_write_safe_pos() << " < end " << ls->end << dendl; } else { // expired. expired_segments.insert(ls);
Signature · 1 line
1.7.11.7
PATCH 2/2 mds: Clear lock flushed if replica is waiting for AC_LOCKFLUSHED
From: "Yan, Zheng" <[email protected]>
So eval_gather() will not skip calling scatter_writebehind(), otherwise the replica lock may be in flushing state forever.
Signed-off-by Yan, Zheng <[email protected]>
--- src/mds/Locker.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
src/mds/Locker.cc +5 -1
@@ -4383,8 +4383,12 @@ void Locker::handle_file_lock(ScatterLock *lock, MLock *m) if (lock->get_state() == LOCK_MIX_LOCK || lock->get_state() == LOCK_MIX_LOCK2 || lock->get_state() == LOCK_MIX_EXCL || - lock->get_state() == LOCK_MIX_TSYN) + lock->get_state() == LOCK_MIX_TSYN) { lock->decode_locked_state(m->get_data()); + // replica is waiting for AC_LOCKFLUSHED, eval_gather() should not + // delay calling scatter_writebehind(). + lock->clear_flushed(); + } if (lock->is_gathering()) { dout(7) << "handle_file_lock " << *in << " from " << from
Signature · 1 line
1.7.11.7