From 630daa1d7d233aa01a2d49bf1bc7b858bf73348a Mon Sep 17 00:00:00 2001 From: Neha Ojha Date: Fri, 3 Aug 2018 17:38:22 -0700 Subject: [PATCH] osd/PGLog.cc: check if complete_to points to log.end() Signed-off-by: Neha Ojha --- src/osd/PGLog.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index 073f5d2c30eb3..eb88dc1db3c52 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -51,7 +51,8 @@ void PGLog::IndexedLog::trim( eversion_t *write_from_dups) { assert(s <= can_rollback_to); - lgeneric_subdout(cct, osd, 20) << " complete_to " << complete_to->version << dendl; + if (complete_to != log.end()) + lgeneric_subdout(cct, osd, 20) << " complete_to " << complete_to->version << dendl; auto earliest_dup_version = log.rbegin()->version.version < cct->_conf->osd_pg_log_dups_tracked @@ -87,7 +88,7 @@ void PGLog::IndexedLog::trim( bool reset_complete_to = false; // we are trimming past complete_to, so reset complete_to - if (e.version >= complete_to->version) + if (complete_to != log.end() && e.version >= complete_to->version) reset_complete_to = true; if (rollback_info_trimmed_to_riter == log.rend() || e.version == rollback_info_trimmed_to_riter->version) { @@ -181,7 +182,8 @@ void PGLog::trim( dout(10) << "trim " << log << " to " << trim_to << dendl; log.trim(cct, trim_to, &trimmed, &trimmed_dups, &write_from_dups); info.log_tail = log.tail; - dout(10) << " after trim complete_to " << log.complete_to->version << dendl; + if (log.complete_to != log.log.end()) + dout(10) << " after trim complete_to " << log.complete_to->version << dendl; } } -- 2.39.5