From b670715eb4abeebb636120241b1e59b48130673d Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 12 Mar 2020 18:01:45 +0800 Subject: [PATCH] osd/PeeringState: do not trim pg log past last_update_ondisk Trimming past last_update_ondisk would be really bad, e.g., a new interval change would cancel&redo a previous op, and if we trim past last_update_ondisk, there could be potential object inconsistencies as log merging won't necessarily be able to find all divergent entries later (we lost track of the unfinished op that should really be reverted). Fixes: https://tracker.ceph.com/issues/44532 Signed-off-by: xie xingguo (cherry picked from commit eef1928e0153f09dc2522bb885b0ad9f5c65f4bd) Conflicts: src/osd/PeeringState.cc - changes applied manually in src/osd/PrimaryLogPG.cc --- src/osd/PrimaryLogPG.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 7caed663360c0..3b3e3e59292b7 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1663,9 +1663,10 @@ void PrimaryLogPG::calc_trim_to_aggressive() target = cct->_conf->osd_max_pg_log_entries; } // limit pg log trimming up to the can_rollback_to value - eversion_t limit = std::min( + eversion_t limit = std::min({ pg_log.get_head(), - pg_log.get_can_rollback_to()); + pg_log.get_can_rollback_to(), + last_update_ondisk}); dout(10) << __func__ << " limit = " << limit << dendl; if (limit != eversion_t() && -- 2.39.5