target = cct->_conf->osd_max_pg_log_entries;
}
- if (min_last_complete_ondisk != eversion_t() &&
- min_last_complete_ondisk != pg_trim_to &&
+ eversion_t limit = MIN(
+ min_last_complete_ondisk,
+ pg_log.get_can_rollback_to());
+ if (limit != eversion_t() &&
+ limit != pg_trim_to &&
pg_log.get_log().approx_size() > target) {
size_t num_to_trim = pg_log.get_log().approx_size() - target;
if (num_to_trim < cct->_conf->osd_pg_log_trim_min) {
for (size_t i = 0; i < num_to_trim; ++i) {
new_trim_to = it->version;
++it;
- if (new_trim_to > min_last_complete_ondisk) {
- new_trim_to = min_last_complete_ondisk;
+ if (new_trim_to > limit) {
+ new_trim_to = limit;
dout(10) << "calc_trim_to trimming to min_last_complete_ondisk" << dendl;
break;
}